Half-revert "gallium/dri2: Pass the resource that corresponds to the plane"

This reverts the resource_get_param changes from Tomeu's commit
ab7744b280.  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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9847>
This commit is contained in:
Kenneth Graunke 2021-03-25 18:18:17 -07:00
parent f903a4be9f
commit 640e8cb3dc

View File

@ -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);
}