vrend: Support BGRX & BGRA formats v2

These two formats are required by DRI in the guest and as such
Wayland, X11, GBM or any API built on top if DRI. The format
GL_BGRA_EXT is not supported on Desktop OpenGL.

v2: Better documentation.

Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Jakob Bornecrantz 7 years ago committed by Dave Airlie
parent 7fcd67db4b
commit 2447355893
  1. 17
      src/vrend_formats.c
  2. 6
      src/vrend_renderer.c
  3. 1
      src/vrend_renderer.h

@ -249,6 +249,11 @@ static struct vrend_format_table bptc_formats[] = {
{ VIRGL_FORMAT_BPTC_RGB_UFLOAT, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, GL_UNSIGNED_BYTE },
};
static struct vrend_format_table gles_bgra_formats[] = {
{ VIRGL_FORMAT_B8G8R8X8_UNORM, GL_BGRA_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE, 0 },
{ VIRGL_FORMAT_B8G8R8A8_UNORM, GL_BGRA_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE, 0 },
};
static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
{
int i;
@ -370,3 +375,15 @@ void vrend_build_format_list(void)
add_formats(bptc_formats);
}
void vrend_build_format_list_gles(void)
{
vrend_build_format_list();
/* The BGR[A|X] formats is required but OpenGL ES does not
* support rendering to it. Try to use GL_BGRA_EXT from the
* GL_EXT_texture_format_BGRA8888 extension. But the
* GL_BGRA_EXT format is not supported by OpenGL Desktop.
*/
add_formats(gles_bgra_formats);
}

@ -4074,7 +4074,11 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
glDisable(GL_DEBUG_OUTPUT);
}
vrend_build_format_list();
if (vrend_state.use_gles) {
vrend_build_format_list_gles();
} else {
vrend_build_format_list();
}
/* disable for format testing */
if (vrend_state.have_debug_cb) {

@ -312,6 +312,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
GLint64 vrend_renderer_get_timestamp(void);
void vrend_build_format_list(void);
void vrend_build_format_list_gles(void);
int vrend_renderer_resource_attach_iov(int res_handle, struct iovec *iov,
int num_iovs);

Loading…
Cancel
Save