etnaviv: fix gbm_bo_get_handle_for_plane for multiplanar images
authorPhilipp Zabel <p.zabel@pengutronix.de>
Thu, 22 Jul 2021 10:47:15 +0000 (12:47 +0200)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Tue, 27 Jul 2021 21:13:57 +0000 (23:13 +0200)
commit8ba44103b31d90b0c7531d66aa74254412485c85
treecb5e1d8c79027e7c6075d149595b15a9e3b6d876
parentf1cd56cdc11bcc348043d56dc74305b7aa71d44f
etnaviv: fix gbm_bo_get_handle_for_plane for multiplanar images

Implement resource_get_param for PIPE_RESOURCE_PARAM_NPLANES and fix
resource_get_handle to walk to the correct linked resource for
multiplanar images, allowing gbm_bo_get_handle_for_plane to be called
with plane > 0.

This fixes an assert that is triggered when a wayland client tries
to send weston an NV12 dmabuf, for example:

  weston: .../mesa/src/gbm/backends/dri/gbm_dri.c:752: gbm_dri_bo_get_handle_for_plane: Assertion `plane == 0' failed.

Fixes: 788f6dc85781 ('Revert "gallium/dri: fix dri2_from_planar for multiplanar images"')
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12037>
src/gallium/drivers/etnaviv/etnaviv_resource.c