summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-08-29 14:49:59 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-08-29 19:39:25 +0100
commit23d961e950e92bb00c7cb29fa73499af568e7571 (patch)
tree86c417157f29c16246f590c7a29d303019d77aa5
parent822cc6a5655db6c210204ca349dbbed05ee1838b (diff)
downloadintel-gpu-tools-23d961e950e92bb00c7cb29fa73499af568e7571.tar.gz
intel-gpu-tools-23d961e950e92bb00c7cb29fa73499af568e7571.tar.bz2
intel-gpu-tools-23d961e950e92bb00c7cb29fa73499af568e7571.zip
lib/batchbuffer: Store the gen in a local variable
Reduce lookups and improve code clarity. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/intel_batchbuffer.c10
-rw-r--r--lib/intel_batchbuffer.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 46e0b33e..84c4c538 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -100,6 +100,7 @@ intel_batchbuffer_alloc(drm_intel_bufmgr *bufmgr, uint32_t devid)
batch->bufmgr = bufmgr;
batch->devid = devid;
+ batch->gen = intel_gen(devid);
intel_batchbuffer_reset(batch);
return batch;
@@ -305,6 +306,7 @@ intel_blt_copy(struct intel_batchbuffer *batch,
drm_intel_bo *dst_bo, int dst_x1, int dst_y1, int dst_pitch,
int width, int height, int bpp)
{
+ const int gen = batch->gen;
uint32_t src_tiling, dst_tiling, swizzle;
uint32_t cmd_bits = 0;
uint32_t br13_bits;
@@ -312,12 +314,12 @@ intel_blt_copy(struct intel_batchbuffer *batch,
drm_intel_bo_get_tiling(src_bo, &src_tiling, &swizzle);
drm_intel_bo_get_tiling(dst_bo, &dst_tiling, &swizzle);
- if (IS_965(batch->devid) && src_tiling != I915_TILING_NONE) {
+ if (gen >= 4 && src_tiling != I915_TILING_NONE) {
src_pitch /= 4;
cmd_bits |= XY_SRC_COPY_BLT_SRC_TILED;
}
- if (IS_965(batch->devid) && dst_tiling != I915_TILING_NONE) {
+ if (gen >= 4 && dst_tiling != I915_TILING_NONE) {
dst_pitch /= 4;
cmd_bits |= XY_SRC_COPY_BLT_DST_TILED;
}
@@ -348,9 +350,9 @@ intel_blt_copy(struct intel_batchbuffer *batch,
CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch));
#undef CHECK_RANGE
- BEGIN_BATCH(intel_gen(batch->devid) >= 8 ? 10 : 8);
+ BEGIN_BATCH(gen >= 8 ? 10 : 8);
OUT_BATCH(XY_SRC_COPY_BLT_CMD | cmd_bits |
- (intel_gen(batch->devid) >= 8 ? 8 : 6));
+ (gen >= 8 ? 8 : 6));
OUT_BATCH((br13_bits) |
(0xcc << 16) | /* copy ROP */
dst_pitch);
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 37151618..5db70fb6 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -12,6 +12,7 @@
struct intel_batchbuffer {
drm_intel_bufmgr *bufmgr;
uint32_t devid;
+ int gen;
drm_intel_bo *bo;