From 1c4f68b089b26918fff55196122309ac43e78e1b Mon Sep 17 00:00:00 2001 From: Lepton Wu Date: Sat, 11 Apr 2020 15:10:45 -0700 Subject: [PATCH] virgl: Use ETC2 formats directly when possible. Don't emulate them with uncompressed formats if the host support them since uncompressed formats like GL_R16 could be not available on GLES hosts. Signed-off-by: Lepton Wu Reviewed-by: Gert Wollny --- src/gallium/drivers/virgl/virgl_encode.c | 10 ++++++++++ src/gallium/drivers/virgl/virgl_hw.h | 12 ++++++++++++ src/gallium/drivers/virgl/virgl_screen.c | 3 +++ 3 files changed, 25 insertions(+) diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index fa4e4c0d50e..6d71f5d6574 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -248,6 +248,16 @@ static const enum virgl_formats virgl_formats_conv_table[PIPE_FORMAT_COUNT] = { CONV_FORMAT(R10G10B10X2_UNORM) CONV_FORMAT(A4B4G4R4_UNORM) CONV_FORMAT(R8_SRGB) + CONV_FORMAT(ETC2_RGB8) + CONV_FORMAT(ETC2_SRGB8) + CONV_FORMAT(ETC2_RGB8A1) + CONV_FORMAT(ETC2_SRGB8A1) + CONV_FORMAT(ETC2_RGBA8) + CONV_FORMAT(ETC2_SRGBA8) + CONV_FORMAT(ETC2_R11_UNORM) + CONV_FORMAT(ETC2_R11_SNORM) + CONV_FORMAT(ETC2_RG11_UNORM) + CONV_FORMAT(ETC2_RG11_SNORM) }; enum virgl_formats pipe_to_virgl_format(enum pipe_format format) diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h index cfa89e2e2aa..b2bed9165ef 100644 --- a/src/gallium/drivers/virgl/virgl_hw.h +++ b/src/gallium/drivers/virgl/virgl_hw.h @@ -280,6 +280,18 @@ enum virgl_formats { VIRGL_FORMAT_BPTC_RGB_FLOAT = 257, VIRGL_FORMAT_BPTC_RGB_UFLOAT = 258, + /* etc2 compressed */ + VIRGL_FORMAT_ETC2_RGB8 = 269, + VIRGL_FORMAT_ETC2_SRGB8 = 270, + VIRGL_FORMAT_ETC2_RGB8A1 = 271, + VIRGL_FORMAT_ETC2_SRGB8A1 = 272, + VIRGL_FORMAT_ETC2_RGBA8 = 273, + VIRGL_FORMAT_ETC2_SRGBA8 = 274, + VIRGL_FORMAT_ETC2_R11_UNORM = 275, + VIRGL_FORMAT_ETC2_R11_SNORM = 276, + VIRGL_FORMAT_ETC2_RG11_UNORM = 277, + VIRGL_FORMAT_ETC2_RG11_SNORM = 278, + VIRGL_FORMAT_R10G10B10X2_UNORM = 308, VIRGL_FORMAT_A4B4G4R4_UNORM = 311, diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 869e25cc46c..235d4280104 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -759,6 +759,9 @@ virgl_is_format_supported( struct pipe_screen *screen, if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC) { goto out_lookup; } + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC) { + goto out_lookup; + } if (format == PIPE_FORMAT_R11G11B10_FLOAT) { goto out_lookup; -- 2.30.2