Module: Mesa
Branch: main
Commit: 9657ef95b4932fa01f0aa2cd2d602094eb021255
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9657ef95b4932fa01f0aa2cd2d602094eb021255

Author: Zhang Ning <zhangn1...@outlook.com>
Date:   Fri Nov 17 09:48:29 2023 +0800

iris: use helper util_resource_at_index

Signed-off-by: Zhang Ning <zhangn1...@outlook.com>
Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26243>

---

 src/gallium/drivers/iris/iris_resource.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_resource.c 
b/src/gallium/drivers/iris/iris_resource.c
index e1fbd85a7c2..2d6738ce298 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -39,6 +39,7 @@
 #include "util/u_inlines.h"
 #include "util/format/u_format.h"
 #include "util/u_memory.h"
+#include "util/u_resource.h"
 #include "util/u_threaded_context.h"
 #include "util/u_transfer.h"
 #include "util/u_transfer_helper.h"
@@ -1440,19 +1441,6 @@ mod_plane_is_clear_color(uint64_t modifier, uint32_t 
plane)
    }
 }
 
-static struct iris_resource *
-get_resource_for_plane(struct pipe_resource *resource,
-                       unsigned plane)
-{
-   unsigned count = 0;
-   for (struct pipe_resource *cur = resource; cur; cur = cur->next) {
-      if (count++ == plane)
-         return (struct iris_resource *)cur;
-   }
-
-   return NULL;
-}
-
 static unsigned
 get_num_planes(const struct pipe_resource *resource)
 {
@@ -1841,7 +1829,8 @@ iris_resource_get_param(struct pipe_screen *pscreen,
    struct iris_resource *base_res = (struct iris_resource *)resource;
    unsigned main_plane = get_main_plane_for_plane(base_res->external_format,
                                                   base_res->mod_info, plane);
-   struct iris_resource *res = get_resource_for_plane(resource, main_plane);
+   struct iris_resource *res =
+      (struct iris_resource *)util_resource_at_index(resource, main_plane);
    assert(res);
 
    bool mod_with_aux =

Reply via email to