panfrost: Add a per-gen panfrost_blendable_format_from_pipe_format() helper
Add a helper to retrieve a panfrost_blendable_format from a pipe_format without using a panfrost_device object. Only works for per-gen source files, but those are the main users of blendable formats anyway. Will be useful to stop using panfrost_device from panvk. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Constantine Shablya <constantine.shablya@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26698>
This commit is contained in:

committed by
Marge Bot

parent
e8d2b5b86d
commit
b87de3a2e0
@@ -310,7 +310,10 @@ static unsigned
|
||||
pan_bytes_per_pixel_tib(const struct panfrost_device *dev,
|
||||
enum pipe_format format)
|
||||
{
|
||||
if (dev->blendable_formats[format].internal) {
|
||||
const struct pan_blendable_format *bf =
|
||||
GENX(panfrost_blendable_format_from_pipe_format)(format);
|
||||
|
||||
if (bf->internal) {
|
||||
/* Blendable formats are always 32-bits in the tile buffer,
|
||||
* extra bits are used as padding or to dither */
|
||||
return 4;
|
||||
@@ -407,7 +410,8 @@ pan_rt_init_format(const struct panfrost_device *dev,
|
||||
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
|
||||
cfg->srgb = true;
|
||||
|
||||
struct pan_blendable_format fmt = dev->blendable_formats[rt->format];
|
||||
struct pan_blendable_format fmt =
|
||||
*GENX(panfrost_blendable_format_from_pipe_format)(rt->format);
|
||||
|
||||
if (fmt.internal) {
|
||||
cfg->internal_format = fmt.internal;
|
||||
@@ -859,7 +863,9 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
|
||||
panfrost_invert_swizzle(desc->swizzle, swizzle);
|
||||
cfg.swizzle = panfrost_translate_swizzle_4(swizzle);
|
||||
|
||||
struct pan_blendable_format fmt = dev->blendable_formats[rt->format];
|
||||
struct pan_blendable_format fmt =
|
||||
*GENX(panfrost_blendable_format_from_pipe_format)(rt->format);
|
||||
|
||||
if (fmt.internal) {
|
||||
cfg.internal_format = fmt.internal;
|
||||
cfg.color_writeback_format = fmt.writeback;
|
||||
|
@@ -55,6 +55,7 @@ struct pan_blendable_format {
|
||||
mali_pixel_format bifrost[2];
|
||||
};
|
||||
|
||||
#define panfrost_blendable_formats_v4 panfrost_blendable_formats_v5
|
||||
extern const struct pan_blendable_format
|
||||
panfrost_blendable_formats_v5[PIPE_FORMAT_COUNT];
|
||||
extern const struct pan_blendable_format
|
||||
@@ -63,6 +64,7 @@ extern const struct pan_blendable_format
|
||||
panfrost_blendable_formats_v7[PIPE_FORMAT_COUNT];
|
||||
extern const struct pan_blendable_format
|
||||
panfrost_blendable_formats_v9[PIPE_FORMAT_COUNT];
|
||||
#define panfrost_blendable_formats_v10 panfrost_blendable_formats_v9
|
||||
|
||||
#define panfrost_pipe_format_v4 panfrost_pipe_format_v5
|
||||
extern const struct panfrost_format panfrost_pipe_format_v5[PIPE_FORMAT_COUNT];
|
||||
@@ -157,6 +159,12 @@ GENX(panfrost_format_from_pipe_format)(enum pipe_format f)
|
||||
{
|
||||
return &GENX(panfrost_pipe_format)[f];
|
||||
}
|
||||
|
||||
static inline const struct pan_blendable_format *
|
||||
GENX(panfrost_blendable_format_from_pipe_format)(enum pipe_format f)
|
||||
{
|
||||
return &GENX(panfrost_blendable_formats)[f];
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user