]>
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> | |
9 | ||
5d0fe650 GH |
10 | struct sdl2_console { |
11 | DisplayChangeListener dcl; | |
12 | DisplaySurface *surface; | |
13 | SDL_Texture *texture; | |
14 | SDL_Window *real_window; | |
15 | SDL_Renderer *real_renderer; | |
16 | int idx; | |
17 | int last_vm_running; /* per console for caption reasons */ | |
cb47dc9a | 18 | int x, y, w, h; |
5d0fe650 | 19 | int hidden; |
0b71a5d5 GH |
20 | int opengl; |
21 | int updates; | |
56bdd4b6 | 22 | int idle_counter; |
0b71a5d5 | 23 | SDL_GLContext winctx; |
cb47dc9a | 24 | #ifdef CONFIG_OPENGL |
0b71a5d5 | 25 | ConsoleGLState *gls; |
cb47dc9a GH |
26 | GLuint tex_id; |
27 | GLuint fbo_id; | |
28 | bool y0_top; | |
29 | bool scanout_mode; | |
30 | #endif | |
5d0fe650 GH |
31 | }; |
32 | ||
2c3056f1 GH |
33 | void sdl2_window_create(struct sdl2_console *scon); |
34 | void sdl2_window_destroy(struct sdl2_console *scon); | |
35 | void sdl2_window_resize(struct sdl2_console *scon); | |
63ed4907 | 36 | void sdl2_poll_events(struct sdl2_console *scon); |
2c3056f1 | 37 | |
8fc1a3f5 GH |
38 | void sdl2_reset_keys(struct sdl2_console *scon); |
39 | void sdl2_process_key(struct sdl2_console *scon, | |
40 | SDL_KeyboardEvent *ev); | |
41 | ||
f1ddebd8 GH |
42 | void sdl2_2d_update(DisplayChangeListener *dcl, |
43 | int x, int y, int w, int h); | |
2c3056f1 GH |
44 | void sdl2_2d_switch(DisplayChangeListener *dcl, |
45 | DisplaySurface *new_surface); | |
62959ffe | 46 | void sdl2_2d_refresh(DisplayChangeListener *dcl); |
0d01b7ce | 47 | void sdl2_2d_redraw(struct sdl2_console *scon); |
877417d9 GH |
48 | bool sdl2_2d_check_format(DisplayChangeListener *dcl, |
49 | pixman_format_code_t format); | |
f1ddebd8 | 50 | |
0b71a5d5 GH |
51 | void sdl2_gl_update(DisplayChangeListener *dcl, |
52 | int x, int y, int w, int h); | |
53 | void sdl2_gl_switch(DisplayChangeListener *dcl, | |
54 | DisplaySurface *new_surface); | |
55 | void sdl2_gl_refresh(DisplayChangeListener *dcl); | |
56 | void sdl2_gl_redraw(struct sdl2_console *scon); | |
57 | ||
cb47dc9a GH |
58 | QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl, |
59 | QEMUGLParams *params); | |
60 | void sdl2_gl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx); | |
61 | int sdl2_gl_make_context_current(DisplayChangeListener *dcl, | |
62 | QEMUGLContext ctx); | |
63 | QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl); | |
64 | ||
65 | void sdl2_gl_scanout(DisplayChangeListener *dcl, | |
66 | uint32_t backing_id, bool backing_y_0_top, | |
9d8256eb | 67 | uint32_t backing_width, uint32_t backing_height, |
cb47dc9a GH |
68 | uint32_t x, uint32_t y, |
69 | uint32_t w, uint32_t h); | |
70 | void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, | |
71 | uint32_t x, uint32_t y, uint32_t w, uint32_t h); | |
72 | ||
5d0fe650 | 73 | #endif /* SDL2_H */ |