Mesa (main): zink: fix dmabuf plane returns
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 29 00:44:41 UTC 2022
Module: Mesa
Branch: main
Commit: c025cb9ee9d79ebfb66a577556e04deecfe012ed
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c025cb9ee9d79ebfb66a577556e04deecfe012ed
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Apr 28 15:50:40 2022 -0400
zink: fix dmabuf plane returns
use the actual drm format plane count, not the resource format
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16226>
---
src/gallium/drivers/zink/zink_resource.c | 7 +++++--
src/gallium/drivers/zink/zink_resource.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 8474f840514..7fdbb4e52c4 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -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
diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h
index 3381463aa35..4ea411c56c7 100644
--- a/src/gallium/drivers/zink/zink_resource.h
+++ b/src/gallium/drivers/zink/zink_resource.h
@@ -158,6 +158,7 @@ struct zink_resource {
uint8_t modifiers_count;
uint64_t *modifiers;
+ enum pipe_format drm_format;
};
struct zink_transfer {
More information about the mesa-commit
mailing list