virgl: Use ETC2 formats directly when possible.
authorLepton Wu <lepton@chromium.org>
Sat, 11 Apr 2020 22:10:45 +0000 (15:10 -0700)
committerLepton Wu <lepton@chromium.org>
Thu, 16 Apr 2020 09:21:21 +0000 (09:21 +0000)
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 <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
src/gallium/drivers/virgl/virgl_encode.c
src/gallium/drivers/virgl/virgl_hw.h
src/gallium/drivers/virgl/virgl_screen.c

index fa4e4c0d50ebb6dbe6b6d783ffa5b22ba4d9476f..6d71f5d65747197c6210203d300019ec9a9cc66d 100644 (file)
@@ -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)
index cfa89e2e2aa3de6d2d1c4ec9e797b6a6716baa32..b2bed9165eff65420f30ae2932e5f6b7c7d89b4f 100644 (file)
@@ -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,
 
index 869e25cc46c885269388380938122d3655e0d217..235d4280104e6a04e594750bb8cd55d851977398 100644 (file)
@@ -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;