summaryrefslogtreecommitdiff
path: root/src/intel/intel_driver.c
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2014-10-21 21:02:27 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-10-23 09:19:17 +0800
commit33bbe06cc67a034d66bf419c242f6d0cb8ac9248 (patch)
tree945038b3643644ef670d46755a35d3885864ae70 /src/intel/intel_driver.c
parent2edb7451a8f92295f79e29ef16740b5cd16127f2 (diff)
Fix the bug of 1D array slice pitch
For BDW, the vertical align is 4 at least. This cause the slice pitch twice as big as the Gen7 for 1D buffer array. Because the buffer tiling alignment may change for different GENs, we move it from run time to intel driver. V2: Fix all the bugs about 1d and 2d image array. And delete the tile align size which is useless. Also integrate two image array test cases into this patch set. Signed-off-by: Junyan He <junyan.he@linux.intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'src/intel/intel_driver.c')
-rw-r--r--src/intel/intel_driver.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index 2c2ed5f4..fd44dceb 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -476,6 +476,44 @@ static int get_cl_tiling(uint32_t drm_tiling)
return CL_NO_TILE;
}
+static uint32_t intel_buffer_get_tiling_align(cl_context ctx, uint32_t tiling_mode, uint32_t dim)
+{
+ uint32_t gen_ver = ((intel_driver_t *)ctx->drv)->gen_ver;
+ uint32_t ret = 0;
+
+ switch (tiling_mode) {
+ case CL_TILE_X:
+ if (dim == 0) { //tileX width in bytes
+ ret = 512;
+ } else if (dim == 1) { //tileX height in number of rows
+ ret = 8;
+ } else
+ assert(0);
+ break;
+
+ case CL_TILE_Y:
+ if (dim == 0) { //tileY width in bytes
+ ret = 128;
+ } else if (dim == 1) { //tileY height in number of rows
+ ret = 32;
+ } else
+ assert(0);
+ break;
+
+ case CL_NO_TILE:
+ if (dim == 1) { //vertical alignment
+ if (gen_ver == 8)
+ ret = 4;
+ else
+ ret = 2;
+ } else
+ assert(0);
+ break;
+ }
+
+ return ret;
+}
+
#if defined(HAS_EGL)
#include "intel_dri_resource_sharing.h"
#include "cl_image.h"
@@ -741,5 +779,6 @@ intel_setup_callbacks(void)
cl_buffer_subdata = (cl_buffer_subdata_cb *) drm_intel_bo_subdata;
cl_buffer_wait_rendering = (cl_buffer_wait_rendering_cb *) drm_intel_bo_wait_rendering;
cl_buffer_get_fd = (cl_buffer_get_fd_cb *) drm_intel_bo_gem_export_to_prime;
+ cl_buffer_get_tiling_align = (cl_buffer_get_tiling_align_cb *)intel_buffer_get_tiling_align;
intel_set_gpgpu_callbacks(intel_get_device_id());
}