[Beignet] [PATCH 3/4] CL: complete get_image_width/height support at runtime side.
Zhigang Gong
zhigang.gong at linux.intel.com
Fri May 17 01:59:59 PDT 2013
We get each image's information's curbe slot whcih is
actually used at kernel side, then fill the corresponding
value.
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
src/cl_command_queue.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/cl_command_queue.c b/src/cl_command_queue.c
index 3d7b02e..0708e3b 100644
--- a/src/cl_command_queue.c
+++ b/src/cl_command_queue.c
@@ -98,6 +98,15 @@ cl_command_queue_add_ref(cl_command_queue queue)
atomic_inc(&queue->ref_n);
}
+static void
+set_image_info(char *curbe, struct ImageInfo * image_info, cl_mem image)
+{
+ if (image_info->wSlot >= 0)
+ memcpy(curbe + image_info->wSlot, &image->w, sizeof(image->w));
+ if (image_info->hSlot >= 0)
+ memcpy(curbe + image_info->hSlot, &image->h, sizeof(image->h));
+}
+
LOCAL cl_int
cl_command_queue_bind_image(cl_command_queue queue, cl_kernel k)
{
@@ -105,6 +114,7 @@ cl_command_queue_bind_image(cl_command_queue queue, cl_kernel k)
for (i = 0; i < k->image_sz; i++) {
int id = k->images[i].arg_idx;
assert(gbe_kernel_get_arg_type(k->opaque, id) == GBE_ARG_IMAGE);
+ set_image_info(k->curbe, &k->images[i], k->args[id].mem);
cl_gpgpu_bind_image(queue->gpgpu, k->images[i].idx, k->args[id].mem->bo,
k->args[id].mem->intel_fmt, k->args[id].mem->type,
k->args[id].mem->w, k->args[id].mem->h,
--
1.7.11.7
More information about the Beignet
mailing list