From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 4/7] drm/i915: factor out i915_gem_get_tile_width()
Date: Mon, 7 Jan 2013 21:47:36 +0200 [thread overview]
Message-ID: <1357588059-6631-5-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1357588059-6631-1-git-send-email-imre.deak@intel.com>
In-Reply-To: <1357317721-6313-1-git-send-email-imre.deak@intel.com>
This will be needed by the upcoming patch.
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_gem.c | 12 ++++++++++++
drivers/gpu/drm/i915/i915_gem_tiling.c | 8 ++------
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3b73615..c863b0f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1570,6 +1570,7 @@ i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode);
uint32_t
i915_gem_get_gtt_alignment(struct drm_device *dev, uint32_t size,
int tiling_mode, bool fenced);
+int i915_gem_get_tile_width(struct drm_device *dev, int tiling_mode);
int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
enum i915_cache_level cache_level);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index aa6653d..d029e9e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1435,6 +1435,18 @@ i915_gem_release_mmap(struct drm_i915_gem_object *obj)
obj->fault_mappable = false;
}
+int
+i915_gem_get_tile_width(struct drm_device *dev, int tiling_mode)
+{
+ BUG_ON(tiling_mode != I915_TILING_Y && tiling_mode != I915_TILING_X);
+
+ if (IS_GEN2(dev) ||
+ (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)))
+ return 128;
+ else
+ return 512;
+}
+
uint32_t
i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode)
{
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index e76f0d8..e2f2a71 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -210,12 +210,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
if (tiling_mode == I915_TILING_NONE)
return true;
- if (IS_GEN2(dev) ||
- (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)))
- tile_width = 128;
- else
- tile_width = 512;
-
/* check maximum stride & object size */
if (INTEL_INFO(dev)->gen >= 4) {
/* i965 stores the end address of the gtt mapping in the fence
@@ -235,6 +229,8 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
}
}
+ tile_width = i915_gem_get_tile_width(dev, tiling_mode);
+
/* 965+ just needs multiples of tile width */
if (INTEL_INFO(dev)->gen >= 4) {
if (stride & (tile_width - 1))
--
1.7.10.4
next prev parent reply other threads:[~2013-01-07 19:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 16:41 [PATCH 0/5] drm/i915: fix gtt space allocated for tiled objects Imre Deak
2013-01-04 16:41 ` [PATCH 1/5] drm/i915: merge get_gtt_alignment/get_unfenced_gtt_alignment() Imre Deak
2013-01-04 16:41 ` [PATCH 2/5] drm/i915: merge {i965, sandybridge}_write_fence_reg() Imre Deak
2013-01-04 16:41 ` [PATCH 3/5] drm/i915: use gtt_get_size() instead of open coding it Imre Deak
2013-01-04 16:41 ` [PATCH 4/5] drm/i915: factor out i915_gem_get_tile_width() Imre Deak
2013-01-04 16:42 ` [PATCH 5/5] drm/i915: fix gtt space allocated for tiled objects Imre Deak
2013-01-04 17:07 ` Chris Wilson
2013-01-04 17:23 ` Imre Deak
2013-01-04 17:47 ` Chris Wilson
2013-01-04 19:18 ` Imre Deak
2013-01-04 20:32 ` Chris Wilson
2013-01-04 20:54 ` Imre Deak
2013-01-07 19:47 ` [PATCH v2 0/7] " Imre Deak
2013-01-07 19:47 ` [PATCH v2 1/7] drm/i915: merge get_gtt_alignment/get_unfenced_gtt_alignment() Imre Deak
2013-01-07 19:47 ` [PATCH v2 2/7] drm/i915: merge {i965, sandybridge}_write_fence_reg() Imre Deak
2013-01-07 19:47 ` [PATCH v2 3/7] drm/i915: use gtt_get_size() instead of open coding it Imre Deak
2013-01-14 16:14 ` Daniel Vetter
2013-01-14 16:28 ` Imre Deak
2013-01-07 19:47 ` Imre Deak [this message]
2013-01-07 19:47 ` [PATCH v2 5/7] drm/i915: reject tiling for objects smaller than their tile row size Imre Deak
2013-01-09 15:18 ` [PATCH v3 " Imre Deak
2013-01-07 19:47 ` [PATCH v2 6/7] drm/i915: check tile object alignment explicitly Imre Deak
2013-01-07 19:47 ` [PATCH v2 7/7] drm/i915: fix gtt space allocated for tiled objects Imre Deak
2013-01-08 9:59 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357588059-6631-5-git-send-email-imre.deak@intel.com \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox