diff options
Diffstat (limited to 'include/ui')
-rw-r--r-- | include/ui/console.h | 37 | ||||
-rw-r--r-- | include/ui/sdl2.h | 17 | ||||
-rw-r--r-- | include/ui/shader.h | 11 |
3 files changed, 65 insertions, 0 deletions
diff --git a/include/ui/console.h b/include/ui/console.h index 03cd665a8f..0b7589600b 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -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 { @@ -270,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; @@ -322,7 +337,29 @@ 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_early_init(int opengl); void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); /* cocoa.m */ diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 51fff2e9b8..2fdad8f300 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -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; @@ -11,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); @@ -31,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 */ diff --git a/include/ui/shader.h b/include/ui/shader.h new file mode 100644 index 0000000000..1ff926c9e1 --- /dev/null +++ b/include/ui/shader.h @@ -0,0 +1,11 @@ +#ifdef CONFIG_OPENGL +# include <GLES2/gl2.h> +# 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, + const GLchar *frag_src); |