@@ -20,6 +20,7 @@ typedef struct DisplaySurface {
uint8_t flags;
#ifdef CONFIG_OPENGL
GLenum glformat;
+ GLenum target_glformat;
GLenum gltype;
GLuint texture;
#endif
@@ -72,6 +72,12 @@ void surface_gl_create_texture(QemuGLShader *gls,
g_assert_not_reached();
}
+ /* The caller wants to override the glformat in some specific cases */
+ if (surface->target_glformat &&
+ surface->target_glformat != surface->glformat) {
+ surface->glformat = surface->target_glformat;
+ }
+
glGenTextures(1, &surface->texture);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, surface->texture);
In some cases where a UI component (e.g, Spice) needs to choose a particular glformat for a surface while creating a texture, this new GLenum provides an option to do so. One situation where this needs to be done is when the Host endianness is causing issues such as interchanged R and B channels. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Frediano Ziglio <freddy77@gmail.com> Cc: Dongwon Kim <dongwon.kim@intel.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> --- include/ui/surface.h | 1 + ui/console-gl.c | 6 ++++++ 2 files changed, 7 insertions(+)