zink: fix dmabuf plane returns

use the actual drm format plane count, not the resource format

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16226>
This commit is contained in:
Mike Blumenkrantz 2022-04-28 15:50:40 -04:00 committed by Marge Bot
parent 93144175fa
commit c025cb9ee9
2 changed files with 6 additions and 2 deletions

View file

@ -1052,7 +1052,7 @@ zink_resource_get_param(struct pipe_screen *pscreen, struct pipe_context *pctx,
switch (param) {
case PIPE_RESOURCE_PARAM_NPLANES:
if (screen->info.have_EXT_image_drm_format_modifier)
*value = pscreen->get_dmabuf_modifier_planes(pscreen, obj->modifier, pres->format);
*value = util_format_get_num_planes(res->drm_format);
else
*value = 1;
break;
@ -1200,7 +1200,10 @@ zink_resource_from_handle(struct pipe_screen *pscreen,
modifier = whandle->modifier;
modifier_count = 1;
}
return resource_create(pscreen, &templ2, whandle, usage, &modifier, modifier_count, NULL);
struct pipe_resource *pres = resource_create(pscreen, &templ2, whandle, usage, &modifier, modifier_count, NULL);
if (pres)
zink_resource(pres)->drm_format = whandle->format;
return pres;
#else
return NULL;
#endif

View file

@ -158,6 +158,7 @@ struct zink_resource {
uint8_t modifiers_count;
uint64_t *modifiers;
enum pipe_format drm_format;
};
struct zink_transfer {