panfrost: Merge bifrost_bo/midgard_bo
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 15 Jun 2020 13:20:39 +0000 (09:20 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 15 Jun 2020 21:41:18 +0000 (21:41 +0000)
The content is difference but a BO is a BO. Let's reduce code repition
between Midgard and Bifrost paths.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Christian Hewitt <christianshewitt@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5474>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index 8a8ba10e3a38a3b9807be3ab677949f8a1b6fda4..5a7658a910fb46e29d43c752998f7f1d714f605c 100644 (file)
@@ -1375,11 +1375,11 @@ panfrost_get_tex_desc(struct panfrost_batch *batch,
                               PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_READ |
                               panfrost_bo_access_for_stage(st));
 
-        panfrost_batch_add_bo(batch, view->midgard_bo,
+        panfrost_batch_add_bo(batch, view->bo,
                               PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_READ |
                               panfrost_bo_access_for_stage(st));
 
-        return view->midgard_bo->gpu;
+        return view->bo->gpu;
 }
 
 static void
@@ -1388,7 +1388,7 @@ panfrost_update_sampler_view(struct panfrost_sampler_view *view,
 {
         struct panfrost_resource *rsrc = pan_resource(view->base.texture);
         if (view->layout != rsrc->layout) {
-                panfrost_bo_unreference(view->midgard_bo);
+                panfrost_bo_unreference(view->bo);
                 panfrost_create_sampler_view_bo(view, pctx, &rsrc->base);
         }
 }
@@ -1421,7 +1421,7 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
                                               PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_READ |
                                               panfrost_bo_access_for_stage(stage));
 
-                        panfrost_batch_add_bo(batch, view->bifrost_bo,
+                        panfrost_batch_add_bo(batch, view->bo,
                                               PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_READ |
                                               panfrost_bo_access_for_stage(stage));
 
index 436fae30577a631d8430849224283ce6c448299a..fbbe63859723693b7f4935ff86869d802acae71e 100644 (file)
@@ -954,7 +954,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
                                 so->base.u.tex.last_layer,
                                 type, prsrc->layout);
 
-                so->bifrost_bo = pan_bo_create(device, size, 0);
+                so->bo = pan_bo_create(device, size, 0);
 
                 so->bifrost_descriptor = rzalloc(pctx, struct bifrost_texture_descriptor);
                 panfrost_new_texture_bifrost(
@@ -971,7 +971,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
                                 panfrost_translate_swizzle_4(composed_swizzle),
                                 prsrc->bo->gpu,
                                 prsrc->slices,
-                                so->bifrost_bo);
+                                so->bo);
         } else {
                 unsigned size = panfrost_estimate_texture_payload_size(
                                 so->base.u.tex.first_level,
@@ -981,10 +981,10 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
                                 type, prsrc->layout);
                 size += sizeof(struct mali_texture_descriptor);
 
-                so->midgard_bo = pan_bo_create(device, size, 0);
+                so->bo = pan_bo_create(device, size, 0);
 
                 panfrost_new_texture(
-                                so->midgard_bo->cpu,
+                                so->bo->cpu,
                                 texture->width0, texture->height0,
                                 texture->depth0, array_size,
                                 so->base.format,
@@ -1055,8 +1055,7 @@ panfrost_sampler_view_destroy(
         struct panfrost_sampler_view *view = (struct panfrost_sampler_view *) pview;
 
         pipe_resource_reference(&pview->texture, NULL);
-        panfrost_bo_unreference(view->midgard_bo);
-        panfrost_bo_unreference(view->bifrost_bo);
+        panfrost_bo_unreference(view->bo);
         if (view->bifrost_descriptor)
                 ralloc_free(view->bifrost_descriptor);
         ralloc_free(view);
index 306429648904fa257476c43da8ff9d85a0ecc20e..9a69b0eb5495bb1660ead39fbf45618e1a2d52be 100644 (file)
@@ -263,8 +263,7 @@ struct panfrost_sampler_state {
 
 struct panfrost_sampler_view {
         struct pipe_sampler_view base;
-        struct panfrost_bo *midgard_bo;
-        struct panfrost_bo *bifrost_bo;
+        struct panfrost_bo *bo;
         struct bifrost_texture_descriptor *bifrost_descriptor;
         enum mali_texture_layout layout;
 };