panfrost: Fix panfrost_format_to_bifrost_blend()

panfrost_format_to_bifrost_blend() shouldn't return a pipe_format, but
a mali_format.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>
This commit is contained in:
Boris Brezillon 2020-11-12 16:03:24 +01:00
parent 8379ff292c
commit 6e069d1c3f
5 changed files with 12 additions and 8 deletions

View file

@ -219,7 +219,8 @@ panfrost_create_blend_shader(struct panfrost_context *ctx,
}
static uint64_t
bifrost_get_blend_desc(enum pipe_format fmt, unsigned rt)
bifrost_get_blend_desc(const struct panfrost_device *dev,
enum pipe_format fmt, unsigned rt)
{
const struct util_format_description *desc = util_format_description(fmt);
uint64_t res;
@ -263,7 +264,7 @@ bifrost_get_blend_desc(enum pipe_format fmt, unsigned rt)
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB;
cfg.fixed_function.conversion.memory_format.format =
panfrost_format_to_bifrost_blend(desc, true);
panfrost_format_to_bifrost_blend(dev, desc, true);
}
return res;
@ -299,7 +300,7 @@ panfrost_compile_blend_shader(struct panfrost_blend_shader *shader,
if (dev->quirks & IS_BIFROST) {
inputs.blend.bifrost_blend_desc =
bifrost_get_blend_desc(shader->key.format, shader->key.rt);
bifrost_get_blend_desc(dev, shader->key.format, shader->key.rt);
program = bifrost_compile_shader_nir(NULL, shader->nir, &inputs);
} else {
program = midgard_compile_shader_nir(NULL, shader->nir, &inputs);

View file

@ -301,7 +301,7 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
*/
cfg.bifrost.internal.fixed_function.num_comps = 4;
cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
panfrost_format_to_bifrost_blend(format_desc, true);
panfrost_format_to_bifrost_blend(dev, format_desc, true);
if (dev->quirks & HAS_SWIZZLES) {
cfg.bifrost.internal.fixed_function.conversion.memory_format.swizzle =
panfrost_get_default_swizzle(4);

View file

@ -570,7 +570,7 @@ bifrost_load_emit_blend_rt(struct pan_pool *pool, void *out,
cfg.bifrost.equation.color_mask = 0xf;
cfg.bifrost.internal.fixed_function.num_comps = 4;
cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
panfrost_format_to_bifrost_blend(format_desc, true);
panfrost_format_to_bifrost_blend(pool->dev, format_desc, true);
cfg.bifrost.internal.fixed_function.conversion.register_format =
blit_type_to_reg_fmt(T);

View file

@ -673,13 +673,14 @@ panfrost_invert_swizzle(const unsigned char *in, unsigned char *out)
}
enum mali_format
panfrost_format_to_bifrost_blend(const struct util_format_description *desc, bool dither)
panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
const struct util_format_description *desc, bool dither)
{
struct pan_blendable_format fmt = panfrost_blend_format(desc->format);
/* Formats requiring blend shaders are stored raw in the tilebuffer */
if (!fmt.internal)
return desc->format;
return MALI_EXTRACT_INDEX(dev->formats[desc->format].hw);
/* Else, pick the pixel format matching the tilebuffer format */
switch (fmt.internal) {

View file

@ -191,7 +191,9 @@ panfrost_bifrost_swizzle(unsigned components)
}
enum mali_format
panfrost_format_to_bifrost_blend(const struct util_format_description *desc, bool dither);
panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
const struct util_format_description *desc,
bool dither);
struct pan_pool;
struct pan_scoreboard;