pan/texture: Accept holes in the pan_image_view::planes array
We are about to add multiplanar depth/stencil support. A stencil only view of a multiplanar d32_s8 format will have NULL depth plane (plane0), so we need to prepare the texture logic to deal with that. Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32275>
This commit is contained in:
committed by
Marge Bot
parent
5df95a97f1
commit
878a7d6de0
@@ -66,8 +66,11 @@ mali_sampling_mode(const struct pan_image_view *view)
|
||||
unsigned nr_samples = pan_image_view_get_nr_samples(view);
|
||||
|
||||
if (nr_samples > 1) {
|
||||
ASSERTED const struct pan_image *first_plane =
|
||||
pan_image_view_get_first_plane(view);
|
||||
|
||||
assert(view->nr_samples == nr_samples);
|
||||
assert(view->planes[0]->layout.slices[0].surface_stride != 0);
|
||||
assert(first_plane->layout.slices[0].surface_stride != 0);
|
||||
return MALI_MSAA_LAYERED;
|
||||
}
|
||||
|
||||
@@ -86,7 +89,8 @@ static bool
|
||||
renderblock_fits_in_single_pass(const struct pan_image_view *view,
|
||||
unsigned tile_size)
|
||||
{
|
||||
uint64_t mod = view->planes[0]->layout.modifier;
|
||||
const struct pan_image *first_plane = pan_image_view_get_first_plane(view);
|
||||
uint64_t mod = first_plane->layout.modifier;
|
||||
|
||||
if (!drm_is_afbc(mod))
|
||||
return tile_size >= 16 * 16;
|
||||
@@ -512,9 +516,10 @@ pan_prepare_rt(const struct pan_fb_info *fb, unsigned layer_idx,
|
||||
|
||||
cfg->dithering_enable = true;
|
||||
|
||||
const struct pan_image *first_plane = pan_image_view_get_first_plane(rt);
|
||||
unsigned level = rt->first_level;
|
||||
ASSERTED unsigned layer_count = rt->dim == MALI_TEXTURE_DIMENSION_3D
|
||||
? rt->planes[0]->layout.depth
|
||||
? first_plane->layout.depth
|
||||
: rt->last_layer - rt->first_layer + 1;
|
||||
|
||||
assert(rt->last_level == rt->first_level);
|
||||
|
||||
@@ -622,10 +622,10 @@ void
|
||||
GENX(panfrost_new_texture)(const struct pan_image_view *iview, void *out,
|
||||
const struct panfrost_ptr *payload)
|
||||
{
|
||||
const struct pan_image *base_image = pan_image_view_get_plane(iview, 0);
|
||||
const struct pan_image_layout *layout = &base_image->layout;
|
||||
enum pipe_format format = iview->format;
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
const struct pan_image *first_plane = pan_image_view_get_first_plane(iview);
|
||||
const struct pan_image_layout *layout = &first_plane->layout;
|
||||
uint32_t mali_format = GENX(panfrost_format_from_pipe_format)(format)->hw;
|
||||
unsigned char swizzle[4];
|
||||
|
||||
|
||||
@@ -162,12 +162,39 @@ pan_image_view_get_plane(const struct pan_image_view *iview, uint32_t idx)
|
||||
return iview->planes[idx];
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
pan_image_view_get_plane_mask(const struct pan_image_view *iview)
|
||||
{
|
||||
unsigned mask = 0;
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(iview->planes); i++) {
|
||||
if (iview->planes[i])
|
||||
mask |= BITFIELD_BIT(i);
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
pan_image_view_get_first_plane_idx(const struct pan_image_view *iview)
|
||||
{
|
||||
unsigned mask = pan_image_view_get_plane_mask(iview);
|
||||
|
||||
assert(mask);
|
||||
return ffs(mask) - 1;
|
||||
}
|
||||
|
||||
static inline const struct pan_image *
|
||||
pan_image_view_get_first_plane(const struct pan_image_view *iview)
|
||||
{
|
||||
unsigned first_plane_idx = pan_image_view_get_first_plane_idx(iview);
|
||||
return pan_image_view_get_plane(iview, first_plane_idx);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
pan_image_view_get_nr_samples(const struct pan_image_view *iview)
|
||||
{
|
||||
/* All planes should have the same nr_samples value, so we
|
||||
* just pick the first plane. */
|
||||
const struct pan_image *image = pan_image_view_get_plane(iview, 0);
|
||||
const struct pan_image *image = pan_image_view_get_first_plane(iview);
|
||||
|
||||
if (!image)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user