For the DRI2 lowered YUV import separate pipe_resources get created
but in the end the first resource just gets asked for NPLANES.
Since
1) (Almost) everything uses the first resource + a plane index in the
Gallium interface.
2) This mirrors non-imported textures.
lets fix this in the driver.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4779>
tex->buffer.external_usage = usage;
tex->num_planes = 1;
+ /* Account for multiple planes with lowered yuv import. */
+ struct pipe_resource *next_plane = tex->buffer.b.b.next;
+ while(next_plane) {
+ struct si_texture *next_tex = (struct si_texture *)next_plane;
+ ++next_tex->num_planes;
+ ++tex->num_planes;
+ next_plane = next_plane->next;
+ }
+
if (!si_read_tex_bo_metadata(sscreen, tex, offset, &metadata)) {
si_texture_reference(&tex, NULL);
return NULL;