From 640e8cb3dc84ed9ba30d605c169b0708dd7e48e2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 25 Mar 2021 18:18:17 -0700 Subject: [PATCH] Half-revert "gallium/dri2: Pass the resource that corresponds to the plane" This reverts the resource_get_param changes from Tomeu's commit ab7744b280184d623cf5a67a50880bf871d8c6db. It breaks every single program run on iris (such as wflinfo -a gl -p glx). iris's I915_FORMAT_MOD_Y_TILED_CCS modifier reports two planes - one for the main surface, and a second one for the CCS surface. However, there is only one underlying pipe_resource. We only use pipe_resource::next for modifier information when importing buffers from elsewhere; there is no res->next for internally allocated resources created with modifiers. resource_get_param() is not supposed to chase res->next pointers. The hook is intended to take the base image, and the plane, as parameters. The driver can then walk its own data structures however it sees fit in order to find the appropriate plane, rather than enforcing a linked list of resources. Part-of: --- src/gallium/frontends/dri/dri2.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index b88af6a6628..ee9945d03f2 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -1204,18 +1204,10 @@ dri2_resource_get_param(__DRIimage *image, enum pipe_resource_param param, unsigned handle_usage, uint64_t *value) { struct pipe_screen *pscreen = image->texture->screen; - struct pipe_resource *tex; - int i; - if (!pscreen->resource_get_param) return false; - for (i = 0, tex = image->texture; tex; i++, tex = tex->next) - if (i == image->plane) - break; - assert(tex); - - return pscreen->resource_get_param(pscreen, NULL, tex, + return pscreen->resource_get_param(pscreen, NULL, image->texture, image->plane, 0, 0, param, handle_usage, value); }