diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 6f4b5c14ccc..9abebde2266 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;