panfrost: Merge bifrost_bo/midgard_bo

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>
This commit is contained in:
Alyssa Rosenzweig 2020-06-15 09:20:39 -04:00 committed by Marge Bot
parent 84779e5822
commit 32b171d669
3 changed files with 10 additions and 12 deletions

View 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));

View 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);

View 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;
};