zink: fix PIPE_RESOURCE_PARAM_NPLANES with format modifier
authorSimon Ser <contact@emersion.fr>
Tue, 20 Dec 2022 14:38:57 +0000 (15:38 +0100)
committerEric Engestrom <eric@engestrom.ch>
Thu, 26 Jan 2023 15:40:29 +0000 (15:40 +0000)
commit8ee572daf8ca62b7ad4354abec5a08f4328ddeb7
tree7f759a41ee1c15813559b2e27a390a9ace80c9aa
parent8126a053b93855291eb64e7b069b3cc73d71464d
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 <contact@emersion.fr>
Fixes: c025cb9ee9d7 ("zink: fix dmabuf plane returns")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20395>
(cherry picked from commit 2e2775c11b0d17472afd53b1398a3af7d9086a75)
.pick_status.json
src/gallium/drivers/zink/zink_resource.c
src/gallium/drivers/zink/zink_types.h