sdl2: add opengl rendering support.
Hi,
Now finally the pull request for the first opengl rendering bits. We'll start with sdl2. gtk is in the pipeline already, stay tuned.
please pull,
Gerd
The following changes since commit 5bccbb04a4abba7af4398de992bf06d585fd1333:
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2015-04-30 20:34:54 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-sdl-20150505-1
for you to fetch changes up to e444ea34f8ec27acfa9ead7eaa9904238c831e69:
sdl2: Fix RGB555 (2015-05-05 10:48:26 +0200)
----------------------------------------------------------------
sdl2: add opengl support
----------------------------------------------------------------
Gerd Hoffmann (5):
opengl: add shader build infrastructure
opengl: add shader helper functions.
console-gl: add opengl rendering helper functions
sdl2: move SDL_* includes to sdl2.h
sdl2: add support for display rendering using opengl.
Max Reitz (1):
sdl2: Fix RGB555
Makefile | 17 +++++ configure | 2 +- include/ui/console.h | 37 ++++++++++ include/ui/sdl2.h | 17 +++++ include/ui/shader.h | 11 +++ scripts/shaderinclude.pl | 16 +++++ ui/Makefile.objs | 13 ++++ ui/console-gl.c | 168 ++++++++++++++++++++++++++++++++++++++++++++ ui/sdl.c | 10 +++ ui/sdl2-2d.c | 28 +++++--- ui/sdl2-gl.c | 112 +++++++++++++++++++++++++++++ ui/sdl2-input.c | 6 -- ui/sdl2.c | 71 +++++++++++++++---- ui/shader.c | 114 ++++++++++++++++++++++++++++++ ui/shader/texture-blit.frag | 10 +++ ui/shader/texture-blit.vert | 10 +++ vl.c | 23 ++++++ 17 files changed, 637 insertions(+), 28 deletions(-) create mode 100644 include/ui/shader.h create mode 100644 scripts/shaderinclude.pl create mode 100644 ui/console-gl.c create mode 100644 ui/sdl2-gl.c create mode 100644 ui/shader.c create mode 100644 ui/shader/texture-blit.frag create mode 100644 ui/shader/texture-blit.vert
[Qemu-devel] [PULL 1/6] opengl: add shader build infrastructure
perl script to transform shader programs into c include files with static string constands containing the shader programs, so we can easily embed them into qemu. Also some Makefile logic for them.
--- Makefile | 14 ++++++++++++++ scripts/shaderinclude.pl | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 scripts/shaderinclude.pl
Makefile +14 -0
@@ -296,6 +296,7 @@ clean: rm -f fsdev/*.pod rm -rf .libs */.libs rm -f qemu-img-cmds.h + rm -f ui/shader/*-vert.h ui/shader/*-frag.h @# May not be present in GENERATED_HEADERS rm -f trace/generated-tracers-dtrace.dtrace* rm -f trace/generated-tracers-dtrace.h*
@@ -441,6 +442,19 @@ cscope: find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files cscope -b +# opengl shader programs +ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl + @mkdir -p $(dir $@) + $(call quiet-command,\ + perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\ + " VERT $@") + +ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl + @mkdir -p $(dir $@) + $(call quiet-command,\ + perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\ + " FRAG $@") + # documentation MAKEINFO=makeinfo MAKEINFOFLAGS=--no-headers --no-split --number-sections
scripts/shaderinclude.pl new file +16 -0
@@ -0,0 +1,16 @@ +#!/usr/bin/perl +use strict; +use warnings; + +my $file = shift; +open FILE, "<", $file or die "open $file: $!"; +my $name = $file; +$name =~ s|.*/||; +$name =~ s/[-.]/_/g; +print "static GLchar ${name}_src[] =\n"; +while (<FILE>) { + chomp; + printf " \"%s\\n\"\n", $_; +} +print " \"\\n\";\n"; +close FILE;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 2/6] opengl: add shader helper functions.
In reply to Gerd HoffmannHelper functions to compile, link and run opengl shader programs.
--- include/ui/shader.h | 9 +++++ ui/Makefile.objs | 7 ++++ ui/shader.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 include/ui/shader.h create mode 100644 ui/shader.c
include/ui/shader.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifdef CONFIG_OPENGL +# include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> +#endif + +GLuint qemu_gl_create_compile_shader (GLenum type,const GLchar *src); +GLuint qemu_gl_create_link_program (GLuint vert,GLuint frag); +GLuint qemu_gl_create_compile_link_program (const GLchar *vert_src, +const GLchar *frag_src);
ui/Makefile.objs +7 -0
@@ -24,4 +24,11 @@ sdl.mo-objs := sdl2.o sdl2-input.o sdl2-2d.o endif sdl.mo-cflags := $(SDL_CFLAGS) +ifeq ($(CONFIG_OPENGL),y) +common-obj-y += shader.o +endif + gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) +shader.o-cflags += $(OPENGL_CFLAGS) + +shader.o-libs += $(OPENGL_LIBS)
ui/shader.c new file +95 -0
95 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 4/6] sdl2: move SDL_* includes to sdl2.h
In reply to Gerd Hoffmann--- include/ui/sdl2.h | 6 ++++++ ui/sdl2-2d.c | 6 ------ ui/sdl2-input.c | 6 ------ ui/sdl2.c | 6 ------ 4 files changed, 6 insertions(+), 18 deletions(-)
include/ui/sdl2.h +6 -0
@@ -1,6 +1,12 @@ #ifndef SDL2_H #define SDL2_H +/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */ +#undef WIN32_LEAN_AND_MEAN + +#include <SDL.h> +#include <SDL_syswm.h> + struct sdl2_console { DisplayChangeListener dcl; DisplaySurface *surface;
ui/sdl2-2d.c +0 -6
@@ -23,12 +23,6 @@*/ /* Ported SDL 1.2 code to 2.0 by Dave Airlie. */ -/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */ -#undef WIN32_LEAN_AND_MEAN - -#include <SDL.h> -#include <SDL_syswm.h> -#include "qemu-common.h" #include "ui/console.h" #include "ui/input.h"
ui/sdl2-input.c +0 -6
@@ -23,12 +23,6 @@*/ /* Ported SDL 1.2 code to 2.0 by Dave Airlie. */ -/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */ -#undef WIN32_LEAN_AND_MEAN - -#include <SDL.h> -#include <SDL_syswm.h> -#include "qemu-common.h" #include "ui/console.h" #include "ui/input.h"
ui/sdl2.c +0 -6
@@ -23,12 +23,6 @@*/ /* Ported SDL 1.2 code to 2.0 by Dave Airlie. */ -/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */ -#undef WIN32_LEAN_AND_MEAN - -#include <SDL.h> -#include <SDL_syswm.h> -#include "qemu-common.h" #include "ui/console.h" #include "ui/input.h"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 6/6] sdl2: Fix RGB555
In reply to Gerd HoffmannFrom: Max Reitz <[email protected]>
Reproducable with:
$ x86_64-softmmu/qemu-system-x86_64 \
-kernel $vmlinuz_of_your_choice \
-append vga=0x313 -sdl--- include/ui/console.h | 5 +++++ ui/sdl2-2d.c | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)
include/ui/console.h +5 -0
@@ -280,6 +280,11 @@ static inline int surface_bytes_per_pixel(DisplaySurface *s)return (bits +7 ) /8 ; } +static inline pixman_format_code_t surface_format (DisplaySurface *s) +{ +return s->format; +} +#ifdef CONFIG_CURSES #include <curses.h> typedef chtype console_ch_t ;
ui/sdl2-2d.c +13 -2
@@ -89,10 +89,21 @@ void sdl2_2d_switch(DisplayChangeListener *dcl,surface_width (new_surface), surface_height(new_surface)); -if (surface_bits_per_pixel (scon->surface) ==16 ) { +switch (surface_format (scon->surface)) { +case PIXMAN_x1r5g5b5: + format =SDL_PIXELFORMAT_ARGB1555 ; +break ; +case PIXMAN_r5g6b5: format =SDL_PIXELFORMAT_RGB565 ; - }else if (surface_bits_per_pixel (scon->surface) ==32 ) { +break ; +case PIXMAN_x8r8g8b8: format =SDL_PIXELFORMAT_ARGB8888 ; +break ; +case PIXMAN_r8g8b8x8: + format =SDL_PIXELFORMAT_RGBA8888 ; +break ; +default : +g_assert_not_reached (); } scon->texture = SDL_CreateTexture(scon->real_renderer, format, SDL_TEXTUREACCESS_STREAMING,
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 3/6] console-gl: add opengl rendering helper functions
In reply to Gerd Hoffmann--- Makefile | 3 + configure | 2 +- include/ui/console.h | 31 ++++++++ include/ui/shader.h | 2 + ui/Makefile.objs | 3 + ui/console-gl.c | 168 ++++++++++++++++++++++++++++++++++++++++++++ ui/shader.c | 19 +++++ ui/shader/texture-blit.frag | 10 +++ ui/shader/texture-blit.vert | 10 +++ 9 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 ui/console-gl.c create mode 100644 ui/shader/texture-blit.frag create mode 100644 ui/shader/texture-blit.vert
Makefile +3 -0
@@ -455,6 +455,9 @@ ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclu perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\ " FRAG $@") +ui/console-gl.o: $(SRC_PATH)/ui/console-gl.c \ + ui/shader/texture-blit-vert.h ui/shader/texture-blit-frag.h + # documentation MAKEINFO=makeinfo MAKEINFOFLAGS=--no-headers --no-split --number-sections
configure +1 -1
@@ -3142,7 +3142,7 @@ else fi if test "$opengl" != "no" ; then - opengl_pkgs="gl" + opengl_pkgs="gl glesv2" if $pkg_config $opengl_pkgs x11 && test "$have_glx" = "yes"; then opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags" opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
include/ui/console.h +31 -0
@@ -9,6 +9,11 @@#include "qapi-types.h" #include "qapi/error.h" +#ifdef CONFIG_OPENGL +# include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> +#endif +/* keyboard/mouse support */ #define MOUSE_EVENT_LBUTTON 0x01
@@ -117,6 +122,11 @@ struct DisplaySurface {pixman_format_code_t format;pixman_image_t *image;uint8_t flags; +#ifdef CONFIG_OPENGL +GLenum glformat; +GLenum gltype; +GLuint texture; +#endif }; typedef struct QemuUIInfo {
@@ -322,6 +332,27 @@ void qemu_console_copy(QemuConsole *con, int src_x, int src_y, int dst_x, int dst_y, int w, int h);DisplaySurface *qemu_console_surface (QemuConsole *con); +/* console-gl.c */ +typedef struct ConsoleGLState ConsoleGLState ; +#ifdef CONFIG_OPENGL +ConsoleGLState *console_gl_init_context (void ); +void console_gl_fini_context (ConsoleGLState *gls); +bool console_gl_check_format (DisplayChangeListener *dcl, +pixman_format_code_t format); +void surface_gl_create_texture (ConsoleGLState *gls, +DisplaySurface *surface); +void surface_gl_update_texture (ConsoleGLState *gls, +DisplaySurface *surface, +int x,int y,int w,int h); +void surface_gl_render_texture (ConsoleGLState *gls, +DisplaySurface *surface); +void surface_gl_destroy_texture (ConsoleGLState *gls, +DisplaySurface *surface); +void surface_gl_setup_viewport (ConsoleGLState *gls, +DisplaySurface *surface, +int ww,int wh); +#endif +/* sdl.c */ void sdl_display_init (DisplayState *ds,int full_screen,int no_frame);
include/ui/shader.h +2 -0
@@ -3,6 +3,8 @@# include <GLES2/gl2ext.h> #endif +void qemu_gl_run_texture_blit (GLint texture_blit_prog); +GLuint qemu_gl_create_compile_shader (GLenum type,const GLchar *src);GLuint qemu_gl_create_link_program (GLuint vert,GLuint frag); GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src,
ui/Makefile.objs +3 -0
@@ -26,9 +26,12 @@ sdl.mo-cflags := $(SDL_CFLAGS) ifeq ($(CONFIG_OPENGL),y) common-obj-y += shader.o +common-obj-y += console-gl.o endif gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) shader.o-cflags += $(OPENGL_CFLAGS) +console-gl.o-cflags += $(OPENGL_CFLAGS) shader.o-libs += $(OPENGL_LIBS) +console-gl.o-libs += $(OPENGL_LIBS)
ui/console-gl.c new file +168 -0
168 lines not on this page · raw message
ui/shader.c +19 -0
@@ -29,6 +29,25 @@/* ---------------------------------------------------------------------- */ +void qemu_gl_run_texture_blit (GLint texture_blit_prog) +{ +GLfloat in_position[] = { +-1 ,-1 , +1 ,-1 , +-1 ,1 , +1 ,1 , + }; +GLint l_position; + +glUseProgram (texture_blit_prog); + l_position =glGetAttribLocation (texture_blit_prog,"in_position" ); +glVertexAttribPointer (l_position,2 ,GL_FLOAT ,GL_FALSE ,0 , in_position); +glEnableVertexAttribArray (l_position); +glDrawArrays (GL_TRIANGLE_STRIP , l_position,4 ); +} + +/* ---------------------------------------------------------------------- */ +GLuint qemu_gl_create_compile_shader (GLenum type,const GLchar *src) {GLuint shader;
ui/shader/texture-blit.frag new file +10 -0
@@ -0,0 +1,10 @@ + +#version 300 es + +uniform sampler2D image; +in mediump vec2 ex_tex_coord; +out mediump vec4 out_frag_color; + +void main(void) { + out_frag_color = texture(image, ex_tex_coord); +}
ui/shader/texture-blit.vert new file +10 -0
@@ -0,0 +1,10 @@ + +#version 300 es + +in vec2 in_position; +out vec2 ex_tex_coord; + +void main(void) { + gl_Position = vec4(in_position, 0.0, 1.0); + ex_tex_coord = vec2(1.0 + in_position.x, 1.0 - in_position.y) * 0.5; +}
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 5/6] sdl2: add support for display rendering using opengl.
In reply to Gerd HoffmannAdd new sdl2-gl.c file, with display rendering functions using opengl.
--- include/ui/console.h | 1 + include/ui/sdl2.h | 11 +++++ ui/Makefile.objs | 3 ++ ui/sdl.c | 10 +++++ ui/sdl2-2d.c | 7 ++++ ui/sdl2-gl.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++ ui/sdl2.c | 65 ++++++++++++++++++++++++++---- vl.c | 23 +++++++++++ 8 files changed, 225 insertions(+), 7 deletions(-) create mode 100644 ui/sdl2-gl.c
include/ui/console.h +1 -0
@@ -354,6 +354,7 @@ void surface_gl_setup_viewport(ConsoleGLState *gls,#endif /* sdl.c */ +void sdl_display_early_init (int opengl);void sdl_display_init (DisplayState *ds,int full_screen,int no_frame);/* cocoa.m */
include/ui/sdl2.h +11 -0
@@ -17,6 +17,10 @@ struct sdl2_console {int last_vm_running;/* per console for caption reasons */ int x, y;int hidden; +int opengl; +int updates; +SDL_GLContext winctx; +ConsoleGLState *gls; };void sdl2_window_create (struct sdl2_console *scon);
@@ -37,4 +41,11 @@ void sdl2_2d_redraw(struct sdl2_console *scon);bool sdl2_2d_check_format (DisplayChangeListener *dcl,pixman_format_code_t format); +void sdl2_gl_update (DisplayChangeListener *dcl, +int x,int y,int w,int h); +void sdl2_gl_switch (DisplayChangeListener *dcl, +DisplaySurface *new_surface); +void sdl2_gl_refresh (DisplayChangeListener *dcl); +void sdl2_gl_redraw (struct sdl2_console *scon); +#endif /* SDL2_H */
ui/Makefile.objs +3 -0
@@ -21,6 +21,9 @@ sdl.mo-objs := sdl.o sdl_zoom.o endif ifeq ($(CONFIG_SDLABI),2.0) sdl.mo-objs := sdl2.o sdl2-input.o sdl2-2d.o +ifeq ($(CONFIG_OPENGL),y) +sdl.mo-objs += sdl2-gl.o +endif endif sdl.mo-cflags := $(SDL_CFLAGS)
ui/sdl.c +10 -0
@@ -908,6 +908,16 @@ static const DisplayChangeListenerOps dcl_ops = { .dpy_cursor_define = sdl_mouse_define, }; +void sdl_display_early_init (int opengl) +{ +if (opengl ==1 /* on */ ) { +fprintf (stderr, +"SDL1 display code has no opengl support.\n" +"Please recompile qemu with SDL2, using\n" +"./configure --enable-sdl --with-sdlabi=2.0\n" ); + } +} +void sdl_display_init (DisplayState *ds,int full_screen,int no_frame) {int flags;
ui/sdl2-2d.c +7 -0
@@ -36,6 +36,8 @@ void sdl2_2d_update(DisplayChangeListener *dcl,DisplaySurface *surf =qemu_console_surface (dcl->con);SDL_Rect rect; +assert (!scon->opengl); +if (!surf) {return ; }
@@ -61,6 +63,8 @@ void sdl2_2d_switch(DisplayChangeListener *dcl,DisplaySurface *old_surface = scon->surface;int format =0 ; +assert (!scon->opengl); + scon->surface = new_surface;if (scon->texture) {
@@ -101,12 +105,15 @@ void sdl2_2d_refresh(DisplayChangeListener *dcl) { struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); +assert (!scon->opengl);graphic_hw_update (dcl->con);sdl2_poll_events (scon); }void sdl2_2d_redraw (struct sdl2_console *scon) { +assert (!scon->opengl); +if (!scon->surface) {return ; }
ui/sdl2-gl.c new file +112 -0
112 lines not on this page · raw message
ui/sdl2.c +58 -7
118 lines not on this page · raw message
vl.c +23 -0
@@ -130,6 +130,7 @@ static int data_dir_idx;const char *bios_name =NULL ;enum vga_retrace_method vga_retrace_method =VGA_RETRACE_DUMB ;DisplayType display_type =DT_DEFAULT ; +int request_opengl =-1 ;int display_opengl;static int display_remote;const char * keyboard_layout =NULL ;
@@ -1990,6 +1991,15 @@ static DisplayType select_display(const char *p) }else { goto invalid_sdl_args; } + }else if (strstart (opts,",gl=" , &nextopt)) { + opts = nextopt; +if (strstart (opts,"on" , &nextopt)) { + request_opengl =1 ; + }else if (strstart (opts,"off" , &nextopt)) { + request_opengl =0 ; + }else { + goto invalid_sdl_args; + } }else { invalid_sdl_args:fprintf (stderr,"Invalid SDL option string: %s\n" , p);
@@ -4005,6 +4015,19 @@ int main(int argc, char **argv, char **envp) early_gtk_display_init(); }#endif +#if defined(CONFIG_SDL ) +if (display_type ==DT_SDL ) { +sdl_display_early_init (request_opengl); + } +#endif +if (request_opengl ==1 && display_opengl ==0 ) { +#if defined(CONFIG_OPENGL ) +fprintf (stderr,"OpenGL is not supported by the display.\n" ); +#else +fprintf (stderr,"QEMU was built without opengl support.\n" ); +#endif +exit (1 ); + }socket_init ();
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 17 lines · Gerd Hoffmann
Hi,
Now finally the pull request for the first opengl rendering bits. We'll start with sdl2. gtk is in the pipeline already, stay tuned.
please pull,
GerdThe following changes since commit
5bccbb04a4abba7af4398de992bf06d585fd1333:Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2015-04-30 20:34:54 +0100)
are available in the git repository at:
git://git.kraxel.org/qemutags/pull-sdl-20150505-1
Quoted 8 lines
for you to fetch changes up to
e444ea34f8ec27acfa9ead7eaa9904238c831e69:sdl2: Fix RGB555 (2015-05-05 10:48:26 +0200)
----------------------------------------------------------------
sdl2: add opengl support----------------------------------------------------------------
Applied, thanks.
-- PMM
Re: [Qemu-devel] [PULL 3/6] console-gl: add opengl rendering helper functions
In reply to Gerd HoffmannQuoted 3 lines · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>Reviewed-by Max Reitz <[email protected]>---
[...]
Quoted 14 lines
ui/console-gl.c new file +14
-0+void surface_gl_create_texture (ConsoleGLState *gls, +DisplaySurface *surface) +{ +assert (gls); +assert (surface_stride (surface) %surface_bytes_per_pixel (surface) ==0 ); + +switch (surface->format) { +case PIXMAN_BE_b8g8r8x8: +case PIXMAN_BE_b8g8r8a8: + surface->glformat =GL_BGRA_EXT ; + surface->gltype =GL_UNSIGNED_BYTE ; +break ; +case PIXMAN_r5g6b5: + surface->glformat =GL_RGB ;
ui/console-gl.c line 97
Quoted 10 lines
ui/console-gl.c new file +10
-0+ surface->gltype =GL_UNSIGNED_SHORT_5_6_5 ; +break ; +default : +g_assert_not_reached (); + } + +glGenTextures (1 , &surface->texture); +glEnable (GL_TEXTURE_2D ); +glBindTexture (GL_TEXTURE_2D , surface->texture); + glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT,
This doesn't compile for me on SLES11:
ui/console-gl.c: In function ‘surface_gl_create_texture’:ui/console-gl.c:97:19: error: ‘GL_UNPACK_ROW_LENGTH_EXT’ undeclared (first use in this function)ui/console-gl.c:97:19: note: each undeclared identifier is reported only once for each function it appears inui/console-gl.c: In function ‘surface_gl_update_texture’:ui/console-gl.c:117:19: error: ‘GL_UNPACK_ROW_LENGTH_EXT’ undeclared (first use in this function)
make: *** [ui/console-gl.o] Error 1
make: *** Waiting for unfinished jobs....
Didn't we have buildbots to catch these things early?
Alex
Re: [Qemu-devel] [PULL 3/6] console-gl: add opengl rendering helper functions
Quoted 35 lines · Alexander Graf
Quoted 3 lines · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>Reviewed-by Max Reitz <[email protected]>---
[...]
Quoted 14 lines
ui/console-gl.c new file +14
-0+void surface_gl_create_texture (ConsoleGLState *gls, +DisplaySurface *surface) +{ +assert (gls); +assert (surface_stride (surface) %surface_bytes_per_pixel (surface) ==0 ); + +switch (surface->format) { +case PIXMAN_BE_b8g8r8x8: +case PIXMAN_BE_b8g8r8a8: + surface->glformat =GL_BGRA_EXT ; + surface->gltype =GL_UNSIGNED_BYTE ; +break ; +case PIXMAN_r5g6b5: + surface->glformat =GL_RGB ;ui/console-gl.c line 97
Quoted 10 lines
ui/console-gl.c new file +10
-0+ surface->gltype =GL_UNSIGNED_SHORT_5_6_5 ; +break ; +default : +g_assert_not_reached (); + } + +glGenTextures (1 , &surface->texture); +glEnable (GL_TEXTURE_2D ); +glBindTexture (GL_TEXTURE_2D , surface->texture); + glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT,This doesn't compile for me on SLES11:
Quoted 10 lines
ui/console-gl.c: In function ‘surface_gl_create_texture’:ui/console-gl.c:97:19: error: ‘GL_UNPACK_ROW_LENGTH_EXT’ undeclared (first use in this function)ui/console-gl.c:97:19: note: each undeclared identifier is reported only once for each function it appears inui/console-gl.c: In function ‘surface_gl_update_texture’:ui/console-gl.c:117:19: error: ‘GL_UNPACK_ROW_LENGTH_EXT’ undeclared (first use in this function)
make: *** [ui/console-gl.o] Error 1
make: *** Waiting for unfinished jobs....
Which mesa version is this?
cheers,
Gerd
Re: [Qemu-devel] [PULL 3/6] console-gl: add opengl rendering helper functions
Quoted 47 lines · Gerd Hoffmann
Quoted 35 lines · Alexander Graf
Quoted 3 lines · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>Reviewed-by Max Reitz <[email protected]>---
[...]
Quoted 14 lines
ui/console-gl.c new file +14
-0+void surface_gl_create_texture (ConsoleGLState *gls, +DisplaySurface *surface) +{ +assert (gls); +assert (surface_stride (surface) %surface_bytes_per_pixel (surface) ==0 ); + +switch (surface->format) { +case PIXMAN_BE_b8g8r8x8: +case PIXMAN_BE_b8g8r8a8: + surface->glformat =GL_BGRA_EXT ; + surface->gltype =GL_UNSIGNED_BYTE ; +break ; +case PIXMAN_r5g6b5: + surface->glformat =GL_RGB ;ui/console-gl.c line 97
Quoted 10 lines
ui/console-gl.c new file +10
-0+ surface->gltype =GL_UNSIGNED_SHORT_5_6_5 ; +break ; +default : +g_assert_not_reached (); + } + +glGenTextures (1 , &surface->texture); +glEnable (GL_TEXTURE_2D ); +glBindTexture (GL_TEXTURE_2D , surface->texture); + glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT,This doesn't compile for me on SLES11:
Quoted 10 lines
ui/console-gl.c: In function ‘surface_gl_create_texture’:ui/console-gl.c:97:19: error: ‘GL_UNPACK_ROW_LENGTH_EXT’ undeclared (first use in this function)ui/console-gl.c:97:19: note: each undeclared identifier is reported only once for each function it appears inui/console-gl.c: In function ‘surface_gl_update_texture’:ui/console-gl.c:117:19: error: ‘GL_UNPACK_ROW_LENGTH_EXT’ undeclared (first use in this function)
make: *** [ui/console-gl.o] Error 1
make: *** Waiting for unfinished jobs....
Quoted 1 line
Which mesa version is this?
The one I first saw it on is a PPC SLES11 system:
$ rpm -qa | grep -i mesa Mesa-libGLESv2-2-9.0.2-34.3.1.ppc64 Mesa-9.0.2-34.3.1.ppc64 Mesa-libEGL1-32bit-9.0.2-34.3.1.ppc64 Mesa-libGL1-32bit-9.0.2-34.3.1.ppc64 Mesa-libglapi-devel-9.0.2-34.3.1.ppc64 Mesa-libGLESv2-2-32bit-9.0.2-34.3.1.ppc64 Mesa-32bit-9.0.2-34.3.1.ppc64 DirectFB-Mesa-1.6.2-3.1.1.ppc64 Mesa-libGLESv2-devel-9.0.2-34.3.1.ppc64 Mesa-libglapi0-9.0.2-34.3.1.ppc64 Mesa-libGL1-9.0.2-34.3.1.ppc64 Mesa-libGL-devel-9.0.2-34.3.1.ppc64 Mesa-libGLESv1_CM-devel-9.0.2-34.3.1.ppc64 Mesa-devel-9.0.2-34.3.1.ppc64 Mesa-libGLESv1_CM1-9.0.2-34.3.1.ppc64 Mesa-libglapi0-32bit-9.0.2-34.3.1.ppc64 libOSMesa9-9.0.2-34.3.1.ppc64 Mesa-libIndirectGL1-9.0.2-34.3.1.ppc64 libOSMesa-devel-9.0.2-34.3.1.ppc64 Mesa-libIndirectGL-devel-9.0.2-34.3.1.ppc64 Mesa-demo-x-8.0.1-8.1.1.ppc64 Mesa-libEGL1-9.0.2-34.3.1.ppc64 Mesa-libEGL-devel-9.0.2-34.3.1.ppc64
But I see the same error on openSUSE 12.3 x86_64 now:
x86:~ # rpm -qa | grep -i mesa
Mesa-libGLESv2-2-9.0.2-34.3.1.x86_64
Mesa-libGL1-9.0.2-34.3.1.x86_64
Mesa-libGLESv2-devel-9.0.2-34.3.1.x86_64
Mesa-libglapi0-9.0.2-34.3.1.x86_64
libOSMesa9-9.0.2-34.3.1.x86_64
Mesa-libEGL1-9.0.2-34.3.1.x86_64
Mesa-9.0.2-34.3.1.x86_64
Mesa-devel-9.0.2-34.3.1.x86_64
Mesa-libIndirectGL-devel-9.0.2-34.3.1.x86_64
Mesa-libEGL-devel-9.0.2-34.3.1.x86_64
Mesa-libglapi-devel-9.0.2-34.3.1.x86_64
libOSMesa-devel-9.0.2-34.3.1.x86_64
Mesa-libGL-devel-9.0.2-34.3.1.x86_64
Mesa-libGLESv1_CM-devel-9.0.2-34.3.1.x86_64
Mesa-libIndirectGL1-9.0.2-34.3.1.x86_64
Mesa-libGLESv1_CM1-9.0.2-34.3.1.x86_64
Alex
Re: [Qemu-devel] [PULL 3/6] console-gl: add opengl rendering helper functions
Quoted 1 line · Alexander Graf
But I see the same error on openSUSE 12.3
x86_64now:
Ah, cool, I have an iso for that laying around.
/me goes install.
thanks,
Gerd