mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
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: 788f6dc857 ('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>
This commit is contained in:
parent
f1cd56cdc1
commit
8ba44103b3
1 changed files with 36 additions and 1 deletions
|
|
@ -581,8 +581,21 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
|
|||
struct winsys_handle *handle, unsigned usage)
|
||||
{
|
||||
struct etna_resource *rsc = etna_resource(prsc);
|
||||
struct renderonly_scanout *scanout;
|
||||
|
||||
if (handle->plane) {
|
||||
struct pipe_resource *cur = prsc;
|
||||
|
||||
for (int i = 0; i < handle->plane; i++) {
|
||||
cur = cur->next;
|
||||
if (!cur)
|
||||
return false;
|
||||
}
|
||||
rsc = etna_resource(cur);
|
||||
}
|
||||
|
||||
/* Scanout is always attached to the base resource */
|
||||
struct renderonly_scanout *scanout = rsc->scanout;
|
||||
scanout = rsc->scanout;
|
||||
|
||||
handle->stride = rsc->levels[0].stride;
|
||||
handle->offset = rsc->levels[0].offset;
|
||||
|
|
@ -608,6 +621,27 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
etna_resource_get_param(struct pipe_screen *pscreen,
|
||||
struct pipe_context *pctx, struct pipe_resource *prsc,
|
||||
unsigned plane, unsigned layer, unsigned level,
|
||||
enum pipe_resource_param param,
|
||||
unsigned usage, uint64_t *value)
|
||||
{
|
||||
switch (param) {
|
||||
case PIPE_RESOURCE_PARAM_NPLANES: {
|
||||
unsigned count = 0;
|
||||
|
||||
for (struct pipe_resource *cur = prsc; cur; cur = cur->next)
|
||||
count++;
|
||||
*value = count;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc,
|
||||
enum etna_resource_status status)
|
||||
|
|
@ -707,6 +741,7 @@ etna_resource_screen_init(struct pipe_screen *pscreen)
|
|||
pscreen->resource_create_with_modifiers = etna_resource_create_modifiers;
|
||||
pscreen->resource_from_handle = etna_resource_from_handle;
|
||||
pscreen->resource_get_handle = etna_resource_get_handle;
|
||||
pscreen->resource_get_param = etna_resource_get_param;
|
||||
pscreen->resource_changed = etna_resource_changed;
|
||||
pscreen->resource_destroy = etna_resource_destroy;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue