]>
Commit | Line | Data |
---|---|---|
5d0fe650 GH |
1 | #ifndef SDL2_H |
2 | #define SDL2_H | |
3 | ||
19dadfcc GH |
4 | /* Avoid compiler warning because macro is redefined in SDL_syswm.h. */ |
5 | #undef WIN32_LEAN_AND_MEAN | |
6 | ||
7 | #include <SDL.h> | |
8 | #include <SDL_syswm.h> | |
a442fe2f DB |
9 | #ifdef CONFIG_SDL_IMAGE |
10 | # include <SDL_image.h> | |
11 | #endif | |
19dadfcc | 12 | |
371c4ef6 GH |
13 | #ifdef CONFIG_OPENGL |
14 | # include "ui/egl-helpers.h" | |
15 | #endif | |
16 | ||
5d0fe650 GH |
17 | struct sdl2_console { |
18 | DisplayChangeListener dcl; | |
19 | DisplaySurface *surface; | |
844fd50d | 20 | DisplayOptions *opts; |
5d0fe650 GH |
21 | SDL_Texture *texture; |
22 | SDL_Window *real_window; | |
23 | SDL_Renderer *real_renderer; | |
24 | int idx; | |
25 | int last_vm_running; /* per console for caption reasons */ | |
cb47dc9a | 26 | int x, y, w, h; |
5d0fe650 | 27 | int hidden; |
0b71a5d5 GH |
28 | int opengl; |
29 | int updates; | |
56bdd4b6 | 30 | int idle_counter; |
849bbe60 | 31 | int ignore_hotkeys; |
0b71a5d5 | 32 | SDL_GLContext winctx; |
cb47dc9a | 33 | #ifdef CONFIG_OPENGL |
46e19e14 | 34 | QemuGLShader *gls; |
371c4ef6 GH |
35 | egl_fb guest_fb; |
36 | egl_fb win_fb; | |
cb47dc9a GH |
37 | bool y0_top; |
38 | bool scanout_mode; | |
39 | #endif | |
5d0fe650 GH |
40 | }; |
41 | ||
2c3056f1 GH |
42 | void sdl2_window_create(struct sdl2_console *scon); |
43 | void sdl2_window_destroy(struct sdl2_console *scon); | |
44 | void sdl2_window_resize(struct sdl2_console *scon); | |
63ed4907 | 45 | void sdl2_poll_events(struct sdl2_console *scon); |
2c3056f1 | 46 | |
8fc1a3f5 GH |
47 | void sdl2_process_key(struct sdl2_console *scon, |
48 | SDL_KeyboardEvent *ev); | |
49 | ||
f1ddebd8 GH |
50 | void sdl2_2d_update(DisplayChangeListener *dcl, |
51 | int x, int y, int w, int h); | |
2c3056f1 GH |
52 | void sdl2_2d_switch(DisplayChangeListener *dcl, |
53 | DisplaySurface *new_surface); | |
62959ffe | 54 | void sdl2_2d_refresh(DisplayChangeListener *dcl); |
0d01b7ce | 55 | void sdl2_2d_redraw(struct sdl2_console *scon); |
877417d9 GH |
56 | bool sdl2_2d_check_format(DisplayChangeListener *dcl, |
57 | pixman_format_code_t format); | |
f1ddebd8 | 58 | |
0b71a5d5 GH |
59 | void sdl2_gl_update(DisplayChangeListener *dcl, |
60 | int x, int y, int w, int h); | |
61 | void sdl2_gl_switch(DisplayChangeListener *dcl, | |
62 | DisplaySurface *new_surface); | |
63 | void sdl2_gl_refresh(DisplayChangeListener *dcl); | |
64 | void sdl2_gl_redraw(struct sdl2_console *scon); | |
65 | ||
cb47dc9a GH |
66 | QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl, |
67 | QEMUGLParams *params); | |
68 | void sdl2_gl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx); | |
69 | int sdl2_gl_make_context_current(DisplayChangeListener *dcl, | |
70 | QEMUGLContext ctx); | |
71 | QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl); | |
72 | ||
db6cdfbe | 73 | void sdl2_gl_scanout_disable(DisplayChangeListener *dcl); |
f4c36bda GH |
74 | void sdl2_gl_scanout_texture(DisplayChangeListener *dcl, |
75 | uint32_t backing_id, | |
76 | bool backing_y_0_top, | |
77 | uint32_t backing_width, | |
78 | uint32_t backing_height, | |
79 | uint32_t x, uint32_t y, | |
80 | uint32_t w, uint32_t h); | |
cb47dc9a GH |
81 | void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, |
82 | uint32_t x, uint32_t y, uint32_t w, uint32_t h); | |
83 | ||
5d0fe650 | 84 | #endif /* SDL2_H */ |