From bc149e03033239d07c913d5978d7ee2afe68dadf Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 31 May 2024 14:26:52 +0200 Subject: [PATCH] iris: fix PIPE_RESOURCE_PARAM_STRIDE for buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Iris calls iris_resource_get_param with PIPE_RESOURCE_PARAM_STRIDE internally now when exporting memory objects. OpenCL's gl_sharing allows to export buffers as well, which do not have strides. This fixes the assert being hit there for buffers. Fixes: 831703157e7 ("iris: Use resource_get_param in resource_get_handle") Reviewed-by: Tapani Pälli Part-of: --- src/gallium/drivers/iris/iris_resource.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 147a9076fdb..1e429cc7b91 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1680,8 +1680,12 @@ iris_resource_get_param(struct pipe_screen *pscreen, * Also, although modifiers which use a clear color plane specify that * the plane's pitch should be ignored, some kernels have been found to * require 64-byte alignment. + * + * Also, for OpenCL gl_sharing we have to support exporting buffers, for + * which we report a stride of 0 here. */ - assert(*value != 0 && (!wants_cc || *value % 64 == 0)); + assert((*value != 0 || resource->target == PIPE_BUFFER) && + (!wants_cc || *value % 64 == 0)); return true; case PIPE_RESOURCE_PARAM_OFFSET: