From f8fca4fe611de875fbac379430237e47ce054460 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 28 Jun 2019 18:47:10 -0700 Subject: [PATCH] panfrost: Allow R11G11B10 rendering Doesn't fully work yet, but better than crashing. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_mfbd.c | 6 +++++- src/gallium/drivers/panfrost/pan_screen.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 91e04a34e80..b209ecbf580 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -81,10 +81,14 @@ panfrost_mfbd_format(struct pipe_surface *surf) /* Set flags for alternative formats */ - if (surf->texture->format == PIPE_FORMAT_B5G6R5_UNORM) { + if (surf->format == PIPE_FORMAT_B5G6R5_UNORM) { fmt.unk1 = 0x14000000; fmt.nr_channels = MALI_POSITIVE(2); fmt.unk3 |= 0x1; + } else if (surf->format == PIPE_FORMAT_R11G11B10_FLOAT) { + fmt.unk1 = 0x88000000; + fmt.unk3 = 0x0; + fmt.nr_channels = MALI_POSITIVE(4); } return fmt; diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index ddb0b7f75fd..f8463d2b3f8 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -458,13 +458,20 @@ panfrost_is_format_supported( struct pipe_screen *screen, if (format == PIPE_FORMAT_A1B5G5R5_UNORM || format == PIPE_FORMAT_X1B5G5R5_UNORM) return FALSE; + /* Allow through special formats */ + + switch (format) { + case PIPE_FORMAT_R11G11B10_FLOAT: + case PIPE_FORMAT_B5G6R5_UNORM: + return TRUE; + default: + break; + } + if (bind & PIPE_BIND_RENDER_TARGET) { if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) return FALSE; - if (format == PIPE_FORMAT_B5G6R5_UNORM) - return TRUE; - /* Check for vaguely 8UNORM formats. Looser than * util_format_is_rgba8_variant, since it permits R8 (for * instance) */ -- 2.30.2