From: Simon Ser Date: Tue, 20 Dec 2022 14:38:57 +0000 (+0100) Subject: zink: fix PIPE_RESOURCE_PARAM_NPLANES with format modifier X-Git-Tag: upstream/22.3.5~140 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ee572daf8ca62b7ad4354abec5a08f4328ddeb7;p=platform%2Fupstream%2Fmesa.git zink: fix PIPE_RESOURCE_PARAM_NPLANES with format modifier Some format modifiers change the number of planes used by an image. For instance AMD DCC modifiers uses 2 or 3 planes. However the format modifier was ignored in the PIPE_RESOURCE_PARAM_NPLANES get_param hook. Fix this by using get_dmabuf_modifier_planes() instead of util_format_get_num_planes(). This fixes wlroots-based compositors under zink. Signed-off-by: Simon Ser Fixes: c025cb9ee9d7 ("zink: fix dmabuf plane returns") Reviewed-by: Erik Faye-Lund Reviewed-by: Mike Blumenkrantz Part-of: (cherry picked from commit 2e2775c11b0d17472afd53b1398a3af7d9086a75) --- diff --git a/.pick_status.json b/.pick_status.json index eb0f1c4..b7c7608 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5917,7 +5917,7 @@ "description": "zink: fix PIPE_RESOURCE_PARAM_NPLANES with format modifier", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c025cb9ee9d79ebfb66a577556e04deecfe012ed" }, diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 37ca941..a5b5293 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1351,7 +1351,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 = util_format_get_num_planes(res->drm_format); + *value = screen->base.get_dmabuf_modifier_planes(&screen->base, obj->modifier, res->internal_format); else *value = 1; break; @@ -1537,7 +1537,6 @@ zink_resource_from_handle(struct pipe_screen *pscreen, struct pipe_resource *pres = resource_create(pscreen, &templ2, whandle, usage, &modifier, modifier_count, NULL); if (pres) { struct zink_resource *res = zink_resource(pres); - res->drm_format = whandle->format; if (pres->target != PIPE_BUFFER) res->valid = true; else diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index e1b96ff..487eb0d 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1144,7 +1144,6 @@ struct zink_resource { uint8_t modifiers_count; uint64_t *modifiers; - enum pipe_format drm_format; }; static inline struct zink_resource *