From 6e218edda5777de21d8b82e9f3a565bf06c4327a Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Wed, 8 Nov 2023 00:18:41 +0100 Subject: [PATCH] panfrost: Support parameter queries for main planes In order to return correct offsets, strides and possibly other parameters. This is relevant for formats like NV12 and P010 where the second plane, when produced by the V4L2 decoder, uses the same FD like the first one, but with an offset. Analogous to 7a7e577d. Also use the new helper to get the number of planes. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10094 Cc: mesa-stable Reviewed-by: Italo Nicola Part-of: (cherry picked from commit 5f4253e096de76651d3bd2bbd447abb1e9cb624f) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_resource.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index aa884ec..6640f34 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1274,7 +1274,7 @@ "description": "panfrost: Support parameter queries for main planes", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 6f4b5c1..9abebde 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -41,6 +41,7 @@ #include "util/u_drm.h" #include "util/u_gen_mipmap.h" #include "util/u_memory.h" +#include "util/u_resource.h" #include "util/u_surface.h" #include "util/u_transfer.h" #include "util/u_transfer_helper.h" @@ -219,9 +220,8 @@ panfrost_resource_get_param(struct pipe_screen *pscreen, enum pipe_resource_param param, unsigned usage, uint64_t *value) { - struct panfrost_resource *rsrc = (struct panfrost_resource *)prsc; - struct pipe_resource *cur; - unsigned count; + struct panfrost_resource *rsrc = + (struct panfrost_resource *)util_resource_at_index(prsc, plane); switch (param) { case PIPE_RESOURCE_PARAM_STRIDE: @@ -234,14 +234,7 @@ panfrost_resource_get_param(struct pipe_screen *pscreen, *value = rsrc->image.layout.modifier; return true; case PIPE_RESOURCE_PARAM_NPLANES: - /* Panfrost doesn't directly support multi-planar formats, - * but we should still handle this case for gbm users - * that might want to use resources shared with panfrost - * on video processing hardware that does. - */ - for (count = 0, cur = prsc; cur; cur = cur->next) - count++; - *value = count; + *value = util_resource_num(prsc); return true; default: return false; -- 2.7.4