aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2019-08-22 16:30:11 +1000
committerGert Wollny <[email protected]>2019-08-26 06:35:00 +0000
commitbba4d2f442f33bc68a4573a6f1f559f277d7ec51 (patch)
tree648ff7d65873fca2dbbc4e4c028d22789e0e90dd
parent035cd6cdf91f9d49f49f0e152e7204aee51e671b (diff)
virgl: fix format conversion for recent gallium changes.
The virgl formats are fixed in time snapshots of the gallium ones, we just need to provide a translation table between them when we enter the hardware. This fixes a regression since Eric renumbered the gallium table. Fixes: c45c33a5a2 (gallium: Remove manual defining of PIPE_FORMAT enum values.) Bugzilla: https://bugs.freedesktop.org/111454 v1 by Dave Airlie <[email protected]> v2: virgl: Add a number of formats to the table that are used, e.g. for vertex attributes v3: cover some more missing formats from a piglit run Signed-off-by: Gert Wollny <[email protected]>
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.c231
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.h1
-rw-r--r--src/gallium/drivers/virgl/virgl_hw.h68
-rw-r--r--src/gallium/drivers/virgl/virgl_screen.c10
-rw-r--r--src/gallium/drivers/virgl/virgl_texture.c6
-rw-r--r--src/gallium/drivers/virgl/virgl_winsys.h3
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.c2
-rw-r--r--src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c2
8 files changed, 305 insertions, 18 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index 0489f088012..096b7e9b026 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -39,6 +39,225 @@
#define VIRGL_ENCODE_MAX_DWORDS MIN2(VIRGL_MAX_CMDBUF_DWORDS, VIRGL_CMD0_MAX_DWORDS)
+#define CONV_FORMAT(f) [PIPE_FORMAT_##f] = VIRGL_FORMAT_##f,
+
+static const enum virgl_formats virgl_formats_conv_table[PIPE_FORMAT_COUNT] = {
+ CONV_FORMAT(B8G8R8A8_UNORM)
+ CONV_FORMAT(B8G8R8X8_UNORM)
+ CONV_FORMAT(A8R8G8B8_UNORM)
+ CONV_FORMAT(X8R8G8B8_UNORM)
+ CONV_FORMAT(B5G5R5A1_UNORM)
+ CONV_FORMAT(B4G4R4A4_UNORM)
+ CONV_FORMAT(B5G6R5_UNORM)
+ CONV_FORMAT(R10G10B10A2_UNORM)
+ CONV_FORMAT(L8_UNORM)
+ CONV_FORMAT(A8_UNORM)
+ CONV_FORMAT(L8A8_UNORM)
+ CONV_FORMAT(L16_UNORM)
+ CONV_FORMAT(Z16_UNORM)
+ CONV_FORMAT(Z32_UNORM)
+ CONV_FORMAT(Z32_FLOAT)
+ CONV_FORMAT(Z24_UNORM_S8_UINT)
+ CONV_FORMAT(S8_UINT_Z24_UNORM)
+ CONV_FORMAT(Z24X8_UNORM)
+ CONV_FORMAT(X8Z24_UNORM)
+ CONV_FORMAT(S8_UINT)
+ CONV_FORMAT(R64_FLOAT)
+ CONV_FORMAT(R64G64_FLOAT)
+ CONV_FORMAT(R64G64B64_FLOAT)
+ CONV_FORMAT(R64G64B64A64_FLOAT)
+ CONV_FORMAT(R32_FLOAT)
+ CONV_FORMAT(R32G32_FLOAT)
+ CONV_FORMAT(R32G32B32_FLOAT)
+ CONV_FORMAT(R32G32B32A32_FLOAT)
+ CONV_FORMAT(R32_UNORM)
+ CONV_FORMAT(R32G32_UNORM)
+ CONV_FORMAT(R32G32B32_UNORM)
+ CONV_FORMAT(R32G32B32A32_UNORM)
+ CONV_FORMAT(R32_USCALED)
+ CONV_FORMAT(R32G32_USCALED)
+ CONV_FORMAT(R32G32B32_USCALED)
+ CONV_FORMAT(R32G32B32A32_USCALED)
+ CONV_FORMAT(R32_SNORM)
+ CONV_FORMAT(R32G32_SNORM)
+ CONV_FORMAT(R32G32B32_SNORM)
+ CONV_FORMAT(R32G32B32A32_SNORM)
+ CONV_FORMAT(R32_SSCALED)
+ CONV_FORMAT(R32G32_SSCALED)
+ CONV_FORMAT(R32G32B32_SSCALED)
+ CONV_FORMAT(R32G32B32A32_SSCALED)
+ CONV_FORMAT(R16_UNORM)
+ CONV_FORMAT(R16G16_UNORM)
+ CONV_FORMAT(R16G16B16_UNORM)
+ CONV_FORMAT(R16G16B16A16_UNORM)
+ CONV_FORMAT(R16_USCALED)
+ CONV_FORMAT(R16G16_USCALED)
+ CONV_FORMAT(R16G16B16_USCALED)
+ CONV_FORMAT(R16G16B16A16_USCALED)
+ CONV_FORMAT(R16_SNORM)
+ CONV_FORMAT(R16G16_SNORM)
+ CONV_FORMAT(R16G16B16_SNORM)
+ CONV_FORMAT(R16G16B16A16_SNORM)
+ CONV_FORMAT(R16_SSCALED)
+ CONV_FORMAT(R16G16_SSCALED)
+ CONV_FORMAT(R16G16B16_SSCALED)
+ CONV_FORMAT(R16G16B16A16_SSCALED)
+ CONV_FORMAT(R8_UNORM)
+ CONV_FORMAT(R8G8_UNORM)
+ CONV_FORMAT(R8G8B8_UNORM)
+ CONV_FORMAT(R8G8B8A8_UNORM)
+ CONV_FORMAT(R8_USCALED)
+ CONV_FORMAT(R8G8_USCALED)
+ CONV_FORMAT(R8G8B8_USCALED)
+ CONV_FORMAT(R8G8B8A8_USCALED)
+ CONV_FORMAT(R8_SNORM)
+ CONV_FORMAT(R8G8_SNORM)
+ CONV_FORMAT(R8G8B8_SNORM)
+ CONV_FORMAT(R8G8B8A8_SNORM)
+ CONV_FORMAT(R8_SSCALED)
+ CONV_FORMAT(R8G8_SSCALED)
+ CONV_FORMAT(R8G8B8_SSCALED)
+ CONV_FORMAT(R8G8B8A8_SSCALED)
+ CONV_FORMAT(R16_FLOAT)
+ CONV_FORMAT(R16G16_FLOAT)
+ CONV_FORMAT(R16G16B16_FLOAT)
+ CONV_FORMAT(R16G16B16A16_FLOAT)
+ CONV_FORMAT(L8_SRGB)
+ CONV_FORMAT(L8A8_SRGB)
+ CONV_FORMAT(R8G8B8_SRGB)
+ CONV_FORMAT(A8B8G8R8_SRGB)
+ CONV_FORMAT(X8B8G8R8_SRGB)
+ CONV_FORMAT(B8G8R8A8_SRGB)
+ CONV_FORMAT(B8G8R8X8_SRGB)
+ CONV_FORMAT(A8R8G8B8_SRGB)
+ CONV_FORMAT(X8R8G8B8_SRGB)
+ CONV_FORMAT(R8G8B8A8_SRGB)
+ CONV_FORMAT(DXT1_RGB)
+ CONV_FORMAT(DXT1_RGBA)
+ CONV_FORMAT(DXT3_RGBA)
+ CONV_FORMAT(DXT5_RGBA)
+ CONV_FORMAT(DXT1_SRGB)
+ CONV_FORMAT(DXT1_SRGBA)
+ CONV_FORMAT(DXT3_SRGBA)
+ CONV_FORMAT(DXT5_SRGBA)
+ CONV_FORMAT(RGTC1_UNORM)
+ CONV_FORMAT(RGTC1_SNORM)
+ CONV_FORMAT(RGTC2_UNORM)
+ CONV_FORMAT(RGTC2_SNORM)
+ CONV_FORMAT(A8B8G8R8_UNORM)
+ CONV_FORMAT(B5G5R5X1_UNORM)
+ CONV_FORMAT(R10G10B10A2_USCALED)
+ CONV_FORMAT(R11G11B10_FLOAT)
+ CONV_FORMAT(R9G9B9E5_FLOAT)
+ CONV_FORMAT(Z32_FLOAT_S8X24_UINT)
+ CONV_FORMAT(B10G10R10A2_UNORM)
+ CONV_FORMAT(R8G8B8X8_UNORM)
+ CONV_FORMAT(B4G4R4X4_UNORM)
+ CONV_FORMAT(X24S8_UINT)
+ CONV_FORMAT(S8X24_UINT)
+ CONV_FORMAT(X32_S8X24_UINT)
+ CONV_FORMAT(B2G3R3_UNORM)
+ CONV_FORMAT(L16A16_UNORM)
+ CONV_FORMAT(A16_UNORM)
+ CONV_FORMAT(I16_UNORM)
+ CONV_FORMAT(LATC1_UNORM)
+ CONV_FORMAT(LATC1_SNORM)
+ CONV_FORMAT(LATC2_UNORM)
+ CONV_FORMAT(LATC2_SNORM)
+ CONV_FORMAT(A8_SNORM)
+ CONV_FORMAT(L8_SNORM)
+ CONV_FORMAT(L8A8_SNORM)
+ CONV_FORMAT(A16_SNORM)
+ CONV_FORMAT(L16_SNORM)
+ CONV_FORMAT(L16A16_SNORM)
+ CONV_FORMAT(A16_FLOAT)
+ CONV_FORMAT(L16_FLOAT)
+ CONV_FORMAT(L16A16_FLOAT)
+ CONV_FORMAT(A32_FLOAT)
+ CONV_FORMAT(L32_FLOAT)
+ CONV_FORMAT(L32A32_FLOAT)
+ CONV_FORMAT(YV12)
+ CONV_FORMAT(YV16)
+ CONV_FORMAT(IYUV)
+ CONV_FORMAT(NV12)
+ CONV_FORMAT(NV21)
+ CONV_FORMAT(R8_UINT)
+ CONV_FORMAT(R8G8_UINT)
+ CONV_FORMAT(R8G8B8_UINT)
+ CONV_FORMAT(R8G8B8A8_UINT)
+ CONV_FORMAT(R8_SINT)
+ CONV_FORMAT(R8G8_SINT)
+ CONV_FORMAT(R8G8B8_SINT)
+ CONV_FORMAT(R8G8B8A8_SINT)
+ CONV_FORMAT(R16_UINT)
+ CONV_FORMAT(R16G16_UINT)
+ CONV_FORMAT(R16G16B16_UINT)
+ CONV_FORMAT(R16G16B16A16_UINT)
+ CONV_FORMAT(R16_SINT)
+ CONV_FORMAT(R16G16_SINT)
+ CONV_FORMAT(R16G16B16_SINT)
+ CONV_FORMAT(R16G16B16A16_SINT)
+ CONV_FORMAT(R32_UINT)
+ CONV_FORMAT(R32G32_UINT)
+ CONV_FORMAT(R32G32B32_UINT)
+ CONV_FORMAT(R32G32B32A32_UINT)
+ CONV_FORMAT(R32_SINT)
+ CONV_FORMAT(R32G32_SINT)
+ CONV_FORMAT(R32G32B32_SINT)
+ CONV_FORMAT(R32G32B32A32_SINT)
+ CONV_FORMAT(A8_UINT)
+ CONV_FORMAT(L8_UINT)
+ CONV_FORMAT(L8A8_UINT)
+ CONV_FORMAT(A8_SINT)
+ CONV_FORMAT(L8_SINT)
+ CONV_FORMAT(L8A8_SINT)
+ CONV_FORMAT(A16_UINT)
+ CONV_FORMAT(L16_UINT)
+ CONV_FORMAT(L16A16_UINT)
+ CONV_FORMAT(A16_SINT)
+ CONV_FORMAT(L16_SINT)
+ CONV_FORMAT(L16A16_SINT)
+ CONV_FORMAT(A32_UINT)
+ CONV_FORMAT(L32_UINT)
+ CONV_FORMAT(L32A32_UINT)
+ CONV_FORMAT(A32_SINT)
+ CONV_FORMAT(L32_SINT)
+ CONV_FORMAT(L32A32_SINT)
+ CONV_FORMAT(R10G10B10A2_SSCALED)
+ CONV_FORMAT(R10G10B10A2_SNORM)
+ CONV_FORMAT(B10G10R10A2_SNORM)
+ CONV_FORMAT(B10G10R10A2_UINT)
+ CONV_FORMAT(R8G8B8X8_SNORM)
+ CONV_FORMAT(R8G8B8X8_SRGB)
+ CONV_FORMAT(R8G8B8X8_UINT)
+ CONV_FORMAT(R8G8B8X8_SINT)
+ CONV_FORMAT(B10G10R10X2_UNORM)
+ CONV_FORMAT(R16G16B16X16_UNORM)
+ CONV_FORMAT(R16G16B16X16_SNORM)
+ CONV_FORMAT(R16G16B16X16_FLOAT)
+ CONV_FORMAT(R16G16B16X16_UINT)
+ CONV_FORMAT(R16G16B16X16_SINT)
+ CONV_FORMAT(R32G32B32X32_FLOAT)
+ CONV_FORMAT(R32G32B32X32_UINT)
+ CONV_FORMAT(R32G32B32X32_SINT)
+ CONV_FORMAT(R10G10B10A2_UINT)
+ CONV_FORMAT(BPTC_RGBA_UNORM)
+ CONV_FORMAT(BPTC_SRGBA)
+ CONV_FORMAT(BPTC_RGB_FLOAT)
+ CONV_FORMAT(BPTC_RGB_UFLOAT)
+ CONV_FORMAT(R10G10B10X2_UNORM)
+ CONV_FORMAT(A4B4G4R4_UNORM)
+ CONV_FORMAT(R8_SRGB)
+};
+
+enum virgl_formats pipe_to_virgl_format(enum pipe_format format)
+{
+ enum virgl_formats vformat = virgl_formats_conv_table[format];
+ if (format != PIPE_FORMAT_NONE && !vformat)
+ debug_printf("VIRGL: pipe format %s not in the format table\n", util_format_name(format));
+ return vformat;
+}
+
static int virgl_encoder_write_cmd_dword(struct virgl_context *ctx,
uint32_t dword)
{
@@ -401,7 +620,7 @@ int virgl_encoder_create_vertex_elements(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, element[i].src_offset);
virgl_encoder_write_dword(ctx->cbuf, element[i].instance_divisor);
virgl_encoder_write_dword(ctx->cbuf, element[i].vertex_buffer_index);
- virgl_encoder_write_dword(ctx->cbuf, element[i].src_format);
+ virgl_encoder_write_dword(ctx->cbuf, pipe_to_virgl_format(element[i].src_format));
}
return 0;
}
@@ -488,7 +707,7 @@ int virgl_encoder_create_surface(struct virgl_context *ctx,
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_CREATE_OBJECT, VIRGL_OBJECT_SURFACE, VIRGL_OBJ_SURFACE_SIZE));
virgl_encoder_write_dword(ctx->cbuf, handle);
virgl_encoder_write_res(ctx, res);
- virgl_encoder_write_dword(ctx->cbuf, templat->format);
+ virgl_encoder_write_dword(ctx->cbuf, pipe_to_virgl_format(templat->format));
assert(templat->texture->target != PIPE_BUFFER);
virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.level);
@@ -649,7 +868,7 @@ int virgl_encode_sampler_view(struct virgl_context *ctx,
unsigned elem_size = util_format_get_blocksize(state->format);
struct virgl_screen *rs = virgl_screen(ctx->base.screen);
uint32_t tmp;
- uint32_t dword_fmt_target = state->format;
+ uint32_t dword_fmt_target = pipe_to_virgl_format(state->format);
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_CREATE_OBJECT, VIRGL_OBJECT_SAMPLER_VIEW, VIRGL_OBJ_SAMPLER_VIEW_SIZE));
virgl_encoder_write_dword(ctx->cbuf, handle);
virgl_encoder_write_res(ctx, res);
@@ -846,7 +1065,7 @@ int virgl_encode_blit(struct virgl_context *ctx,
virgl_encoder_write_res(ctx, dst_res);
virgl_encoder_write_dword(ctx->cbuf, blit->dst.level);
- virgl_encoder_write_dword(ctx->cbuf, blit->dst.format);
+ virgl_encoder_write_dword(ctx->cbuf, pipe_to_virgl_format(blit->dst.format));
virgl_encoder_write_dword(ctx->cbuf, blit->dst.box.x);
virgl_encoder_write_dword(ctx->cbuf, blit->dst.box.y);
virgl_encoder_write_dword(ctx->cbuf, blit->dst.box.z);
@@ -856,7 +1075,7 @@ int virgl_encode_blit(struct virgl_context *ctx,
virgl_encoder_write_res(ctx, src_res);
virgl_encoder_write_dword(ctx->cbuf, blit->src.level);
- virgl_encoder_write_dword(ctx->cbuf, blit->src.format);
+ virgl_encoder_write_dword(ctx->cbuf, pipe_to_virgl_format(blit->src.format));
virgl_encoder_write_dword(ctx->cbuf, blit->src.box.x);
virgl_encoder_write_dword(ctx->cbuf, blit->src.box.y);
virgl_encoder_write_dword(ctx->cbuf, blit->src.box.z);
@@ -1046,7 +1265,7 @@ int virgl_encode_set_shader_images(struct virgl_context *ctx,
for (i = 0; i < count; i++) {
if (images && images[i].resource) {
struct virgl_resource *res = virgl_resource(images[i].resource);
- virgl_encoder_write_dword(ctx->cbuf, images[i].format);
+ virgl_encoder_write_dword(ctx->cbuf, pipe_to_virgl_format(images[i].format));
virgl_encoder_write_dword(ctx->cbuf, images[i].access);
virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.offset);
virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.size);
diff --git a/src/gallium/drivers/virgl/virgl_encode.h b/src/gallium/drivers/virgl/virgl_encode.h
index a46ee216917..3a12f9e935c 100644
--- a/src/gallium/drivers/virgl/virgl_encode.h
+++ b/src/gallium/drivers/virgl/virgl_encode.h
@@ -300,4 +300,5 @@ void virgl_encode_end_transfers(struct virgl_cmd_buf *buf);
int virgl_encode_tweak(struct virgl_context *ctx, enum vrend_tweak_type tweak, uint32_t value);
+enum virgl_formats pipe_to_virgl_format(enum pipe_format format);
#endif
diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h
index e23a6194a9d..cfa89e2e2aa 100644
--- a/src/gallium/drivers/virgl/virgl_hw.h
+++ b/src/gallium/drivers/virgl/virgl_hw.h
@@ -51,32 +51,74 @@ enum virgl_formats {
VIRGL_FORMAT_Z24_UNORM_S8_UINT = 19,
VIRGL_FORMAT_S8_UINT_Z24_UNORM = 20,
VIRGL_FORMAT_Z24X8_UNORM = 21,
+ VIRGL_FORMAT_X8Z24_UNORM = 22,
VIRGL_FORMAT_S8_UINT = 23, /**< ubyte stencil */
-
+ VIRGL_FORMAT_R64_FLOAT = 24,
+ VIRGL_FORMAT_R64G64_FLOAT = 25,
+ VIRGL_FORMAT_R64G64B64_FLOAT = 26,
+ VIRGL_FORMAT_R64G64B64A64_FLOAT = 27,
VIRGL_FORMAT_R32_FLOAT = 28,
VIRGL_FORMAT_R32G32_FLOAT = 29,
VIRGL_FORMAT_R32G32B32_FLOAT = 30,
VIRGL_FORMAT_R32G32B32A32_FLOAT = 31,
+ VIRGL_FORMAT_R32_UNORM = 32,
+ VIRGL_FORMAT_R32G32_UNORM = 33,
+ VIRGL_FORMAT_R32G32B32_UNORM = 34,
+ VIRGL_FORMAT_R32G32B32A32_UNORM = 35,
+ VIRGL_FORMAT_R32_USCALED = 36,
+ VIRGL_FORMAT_R32G32_USCALED = 37,
+ VIRGL_FORMAT_R32G32B32_USCALED = 38,
+ VIRGL_FORMAT_R32G32B32A32_USCALED = 39,
+ VIRGL_FORMAT_R32_SNORM = 40,
+ VIRGL_FORMAT_R32G32_SNORM = 41,
+ VIRGL_FORMAT_R32G32B32_SNORM = 42,
+ VIRGL_FORMAT_R32G32B32A32_SNORM = 43,
+ VIRGL_FORMAT_R32_SSCALED = 44,
+ VIRGL_FORMAT_R32G32_SSCALED = 45,
+ VIRGL_FORMAT_R32G32B32_SSCALED = 46,
+ VIRGL_FORMAT_R32G32B32A32_SSCALED = 47,
+
VIRGL_FORMAT_R16_UNORM = 48,
VIRGL_FORMAT_R16G16_UNORM = 49,
-
+ VIRGL_FORMAT_R16G16B16_UNORM = 50,
VIRGL_FORMAT_R16G16B16A16_UNORM = 51,
+ VIRGL_FORMAT_R16_USCALED = 52,
+ VIRGL_FORMAT_R16G16_USCALED = 53,
+ VIRGL_FORMAT_R16G16B16_USCALED = 54,
+ VIRGL_FORMAT_R16G16B16A16_USCALED = 55,
+
VIRGL_FORMAT_R16_SNORM = 56,
VIRGL_FORMAT_R16G16_SNORM = 57,
+ VIRGL_FORMAT_R16G16B16_SNORM = 58,
VIRGL_FORMAT_R16G16B16A16_SNORM = 59,
+ VIRGL_FORMAT_R16_SSCALED = 60,
+ VIRGL_FORMAT_R16G16_SSCALED = 61,
+ VIRGL_FORMAT_R16G16B16_SSCALED = 62,
+ VIRGL_FORMAT_R16G16B16A16_SSCALED = 63,
+
VIRGL_FORMAT_R8_UNORM = 64,
VIRGL_FORMAT_R8G8_UNORM = 65,
-
+ VIRGL_FORMAT_R8G8B8_UNORM = 66,
VIRGL_FORMAT_R8G8B8A8_UNORM = 67,
+ VIRGL_FORMAT_R8_USCALED = 69,
+ VIRGL_FORMAT_R8G8_USCALED = 70,
+ VIRGL_FORMAT_R8G8B8_USCALED = 71,
+ VIRGL_FORMAT_R8G8B8A8_USCALED = 72,
+
VIRGL_FORMAT_R8_SNORM = 74,
VIRGL_FORMAT_R8G8_SNORM = 75,
VIRGL_FORMAT_R8G8B8_SNORM = 76,
VIRGL_FORMAT_R8G8B8A8_SNORM = 77,
+ VIRGL_FORMAT_R8_SSCALED = 82,
+ VIRGL_FORMAT_R8G8_SSCALED = 83,
+ VIRGL_FORMAT_R8G8B8_SSCALED = 84,
+ VIRGL_FORMAT_R8G8B8A8_SSCALED = 85,
+
VIRGL_FORMAT_R16_FLOAT = 91,
VIRGL_FORMAT_R16G16_FLOAT = 92,
VIRGL_FORMAT_R16G16B16_FLOAT = 93,
@@ -84,8 +126,13 @@ enum virgl_formats {
VIRGL_FORMAT_L8_SRGB = 95,
VIRGL_FORMAT_L8A8_SRGB = 96,
+ VIRGL_FORMAT_R8G8B8_SRGB = 97,
+ VIRGL_FORMAT_A8B8G8R8_SRGB = 98,
+ VIRGL_FORMAT_X8B8G8R8_SRGB = 99,
VIRGL_FORMAT_B8G8R8A8_SRGB = 100,
VIRGL_FORMAT_B8G8R8X8_SRGB = 101,
+ VIRGL_FORMAT_A8R8G8B8_SRGB = 102,
+ VIRGL_FORMAT_X8R8G8B8_SRGB = 103,
VIRGL_FORMAT_R8G8B8A8_SRGB = 104,
/* compressed formats */
@@ -108,6 +155,7 @@ enum virgl_formats {
VIRGL_FORMAT_A8B8G8R8_UNORM = 121,
VIRGL_FORMAT_B5G5R5X1_UNORM = 122,
+ VIRGL_FORMAT_R10G10B10A2_USCALED = 123,
VIRGL_FORMAT_R11G11B10_FLOAT = 124,
VIRGL_FORMAT_R9G9B9E5_FLOAT = 125,
VIRGL_FORMAT_Z32_FLOAT_S8X24_UINT = 126,
@@ -117,10 +165,17 @@ enum virgl_formats {
VIRGL_FORMAT_B4G4R4X4_UNORM = 135,
VIRGL_FORMAT_X24S8_UINT = 136,
VIRGL_FORMAT_S8X24_UINT = 137,
+ VIRGL_FORMAT_X32_S8X24_UINT = 138,
VIRGL_FORMAT_B2G3R3_UNORM = 139,
VIRGL_FORMAT_L16A16_UNORM = 140,
VIRGL_FORMAT_A16_UNORM = 141,
+ VIRGL_FORMAT_I16_UNORM = 142,
+
+ VIRGL_FORMAT_LATC1_UNORM = 143,
+ VIRGL_FORMAT_LATC1_SNORM = 144,
+ VIRGL_FORMAT_LATC2_UNORM = 145,
+ VIRGL_FORMAT_LATC2_SNORM = 146,
VIRGL_FORMAT_A8_SNORM = 147,
VIRGL_FORMAT_L8_SNORM = 148,
@@ -144,6 +199,10 @@ enum virgl_formats {
VIRGL_FORMAT_NV12 = 166,
VIRGL_FORMAT_NV21 = 167,
+ VIRGL_FORMAT_R10G10B10A2_SSCALED = 172,
+ VIRGL_FORMAT_R10G10B10A2_SNORM = 173,
+ VIRGL_FORMAT_B10G10R10A2_SNORM = 176,
+
VIRGL_FORMAT_R8_UINT = 177,
VIRGL_FORMAT_R8G8_UINT = 178,
VIRGL_FORMAT_R8G8B8_UINT = 179,
@@ -210,6 +269,9 @@ enum virgl_formats {
VIRGL_FORMAT_R16G16B16X16_FLOAT = 236,
VIRGL_FORMAT_R16G16B16X16_UINT = 237,
VIRGL_FORMAT_R16G16B16X16_SINT = 238,
+ VIRGL_FORMAT_R32G32B32X32_FLOAT = 239,
+ VIRGL_FORMAT_R32G32B32X32_UINT = 240,
+ VIRGL_FORMAT_R32G32B32X32_SINT = 241,
VIRGL_FORMAT_R10G10B10A2_UINT = 253,
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index f4b7a66003b..fc898ff4625 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -610,8 +610,9 @@ virgl_format_check_bitmask(enum pipe_format format,
uint32_t bitmask[16],
bool may_emulate_bgra)
{
- int big = format / 32;
- int small = format % 32;
+ enum virgl_formats vformat = pipe_to_virgl_format(format);
+ int big = vformat / 32;
+ int small = vformat % 32;
if ((bitmask[big] & (1 << small)))
return true;
@@ -626,8 +627,9 @@ virgl_format_check_bitmask(enum pipe_format format,
return false;
}
- big = format / 32;
- small = format % 32;
+ vformat = pipe_to_virgl_format(format);
+ big = vformat / 32;
+ small = vformat % 32;
if (bitmask[big] & (1 << small))
return true;
}
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index 792ddc50ff9..570f96fb14c 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -130,7 +130,7 @@ static void *texture_transfer_map_resolve(struct pipe_context *ctx,
return NULL;
enum pipe_format fmt = resource->format;
- if (!virgl_has_readback_format(ctx->screen, fmt)) {
+ if (!virgl_has_readback_format(ctx->screen, pipe_to_virgl_format(fmt))) {
if (util_format_fits_8unorm(util_format_description(fmt)))
fmt = PIPE_FORMAT_R8G8B8A8_UNORM;
else if (util_format_is_pure_sint(fmt))
@@ -139,7 +139,7 @@ static void *texture_transfer_map_resolve(struct pipe_context *ctx,
fmt = PIPE_FORMAT_R32G32B32A32_UINT;
else
fmt = PIPE_FORMAT_R32G32B32A32_FLOAT;
- assert(virgl_has_readback_format(ctx->screen, fmt));
+ assert(virgl_has_readback_format(ctx->screen, pipe_to_virgl_format(fmt)));
}
struct pipe_box dst_box = *box;
@@ -222,7 +222,7 @@ static bool needs_resolve(struct pipe_screen *screen,
if (usage & PIPE_TRANSFER_READ)
return !util_format_is_depth_or_stencil(resource->format) &&
- !virgl_has_readback_format(screen, resource->format);
+ !virgl_has_readback_format(screen, pipe_to_virgl_format(resource->format));
return false;
}
diff --git a/src/gallium/drivers/virgl/virgl_winsys.h b/src/gallium/drivers/virgl/virgl_winsys.h
index d880648d59d..9abfec6898b 100644
--- a/src/gallium/drivers/virgl/virgl_winsys.h
+++ b/src/gallium/drivers/virgl/virgl_winsys.h
@@ -156,4 +156,7 @@ static inline void virgl_ws_fill_new_caps_defaults(struct virgl_drm_caps *caps)
caps->caps.v2.max_compute_shared_memory_size = 0;
caps->caps.v2.host_feature_check_version = 0;
}
+
+extern enum virgl_formats pipe_to_virgl_format(enum pipe_format format);
+
#endif
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
index 725d1f7cbf3..c3509aef49c 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
@@ -168,7 +168,7 @@ virgl_drm_winsys_resource_create(struct virgl_winsys *qws,
memset(&createcmd, 0, sizeof(createcmd));
createcmd.target = target;
- createcmd.format = format;
+ createcmd.format = pipe_to_virgl_format(format);
createcmd.bind = bind;
createcmd.width = width;
createcmd.height = height;
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
index b6f5a8324e7..528692ffcb7 100644
--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
@@ -261,7 +261,7 @@ virgl_vtest_winsys_resource_create(struct virgl_winsys *vws,
res->height = height;
res->width = width;
res->size = size;
- virgl_vtest_send_resource_create(vtws, handle, target, format, bind,
+ virgl_vtest_send_resource_create(vtws, handle, target, pipe_to_virgl_format(format), bind,
width, height, depth, array_size,
last_level, nr_samples, size, &fd);