etnaviv: fix double scanout import of multiplanar resources

etna_resource_from_handle() is called for each plane of a multiplanar
resource, so there is no point in looping over all planes to do the
renderonly scanout import. In fact that will cause us to lose track
of the scanout imports from later planes when the earlier planes are
redoing the import, overwriting the pointer to the allocated
renderonly_scanout struct.

Drop the loop and just do the import for the current plane.

Fixes: 826f95778a ("etnaviv: always try to create KMS side handles for imported resources")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20993>
This commit is contained in:
Lucas Stach 2023-01-30 18:58:30 +01:00 committed by Marge Bot
parent 8839baee57
commit 175732bb51

View file

@ -696,15 +696,9 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
level->padded_height);
level->size = level->layer_stride;
if (screen->ro) {
struct pipe_resource *imp_prsc = prsc;
do {
etna_resource(imp_prsc)->scanout =
renderonly_create_gpu_import_for_resource(imp_prsc, screen->ro,
NULL);
/* failure is expected for scanout incompatible buffers */
} while ((imp_prsc = imp_prsc->next));
}
if (screen->ro)
rsc->scanout = renderonly_create_gpu_import_for_resource(prsc, screen->ro,
NULL);
/* If the buffer is for a TS plane, skip the RS compatible checks */
if (handle->plane >= util_format_get_num_planes(prsc->format))