ui patch queue
Hi,
Flushing the ui patch queue with two older patches. The curses patch arrived during the 2.5 freeze. The sdl2 virgl patch is even older and was held back due to testing problems. Those went magically away meanwhile, so it most likely was either a bug somewhere else or some issue with the test setup. So going forward merging it now.
please pull,
Gerd
The following changes since commit a7e00e2536941a6e570b45b7ab4afec4505ff67e:
petalogix-ml605: Set the MicroBlaze CPU version to 8.10.a (2016-01-07 14:57:26 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-ui-20160108-1
for you to fetch changes up to cb47dc9ab9f55083017291b2b8fbae639c576ec2:
sdl2/opengl: add opengl context and scanout support (2016-01-08 12:20:15 +0100)
----------------------------------------------------------------
sdl2/opengl: add opengl context and scanout support ui/curses: Fix color attribute of monitor for curses
----------------------------------------------------------------
Gerd Hoffmann (1):
sdl2/opengl: add opengl context and scanout support
OGAWA Hirofumi (1):
ui/curses: Fix color attribute of monitor for curses
hw/display/jazz_led.c | 6 ++- hw/display/vga.c | 3 +- include/ui/console.h | 15 ++++++ include/ui/sdl2.h | 22 +++++++- ui/console.c | 101 +++++++++++++++++-------------------- ui/curses.c | 13 +++-- ui/sdl2-gl.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++ ui/sdl2.c | 7 +++ 8 files changed, 239 insertions(+), 63 deletions(-)
[Qemu-devel] [PULL 2/2] sdl2/opengl: add opengl context and scanout support
This allows virtio-gpu to render in 3d mode.
--- include/ui/sdl2.h | 22 ++++++++- ui/sdl2-gl.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ ui/sdl2.c | 7 +++ 3 files changed, 163 insertions(+), 1 deletion(-)
include/ui/sdl2.h +21 -1
@@ -15,12 +15,18 @@ struct sdl2_console {SDL_Renderer *real_renderer;int idx;int last_vm_running;/* per console for caption reasons */ -int x, y; +int x, y, w, h;int hidden;int opengl;int updates;SDL_GLContext winctx; +#ifdef CONFIG_OPENGL ConsoleGLState *gls; +GLuint tex_id; +GLuint fbo_id; +bool y0_top; +bool scanout_mode; +#endif };void sdl2_window_create (struct sdl2_console *scon);
@@ -48,4 +54,18 @@ void sdl2_gl_switch(DisplayChangeListener *dcl,void sdl2_gl_refresh (DisplayChangeListener *dcl);void sdl2_gl_redraw (struct sdl2_console *scon); +QEMUGLContext sdl2_gl_create_context (DisplayChangeListener *dcl, +QEMUGLParams *params); +void sdl2_gl_destroy_context (DisplayChangeListener *dcl,QEMUGLContext ctx); +int sdl2_gl_make_context_current (DisplayChangeListener *dcl, +QEMUGLContext ctx); +QEMUGLContext sdl2_gl_get_current_context (DisplayChangeListener *dcl); + +void sdl2_gl_scanout (DisplayChangeListener *dcl, +uint32_t backing_id,bool backing_y_0_top, +uint32_t x,uint32_t y, +uint32_t w,uint32_t h); +void sdl2_gl_scanout_flush (DisplayChangeListener *dcl, +uint32_t x,uint32_t y,uint32_t w,uint32_t h); +#endif /* SDL2_H */
ui/sdl2-gl.c +135 -0
149 lines not on this page · raw message
ui/sdl2.c +7 -0
@@ -700,6 +700,13 @@ static const DisplayChangeListenerOps dcl_gl_ops = { .dpy_refresh = sdl2_gl_refresh, .dpy_mouse_set = sdl_mouse_warp, .dpy_cursor_define = sdl_mouse_define, + + .dpy_gl_ctx_create = sdl2_gl_create_context, + .dpy_gl_ctx_destroy = sdl2_gl_destroy_context, + .dpy_gl_ctx_make_current = sdl2_gl_make_context_current, + .dpy_gl_ctx_get_current = sdl2_gl_get_current_context, + .dpy_gl_scanout = sdl2_gl_scanout, + .dpy_gl_update = sdl2_gl_scanout_flush, };#endif
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 1/2] ui/curses: Fix color attribute of monitor for curses
In reply to Gerd HoffmannFrom: OGAWA Hirofumi <[email protected]>
Current text_console_update() writes totally broken color attributes to console_write_ch(). The format now is writing,
[WRONG]
bold << 21 | fg << 12 | bg << 8 | char fg == 3bits curses color number bg == 3bits curses color number
I can't see this format is where come from. Anyway, this doesn't work at all.
What curses expects is actually (and vga.c is using),
[RIGHT]
bold << 21 | bg << 11 | fg << 8 | char fg == 3bits vga color number bg == 3bits vga color number
And curses set COLOR_PAIR() up to match this format, and curses's chtype. I.e,
bold | color_pair | char color_pair == (bg << 3 | fg)
To fix, this simply uses VGA color number everywhere except curses.c internal. Then, convert it to above [RIGHT] format to write by console_write_ch(). And as bonus, this reduces to expose curses define to other parts (removes COLOR_* from console.c).
[Tested the first line is displayed as white on blue back for monitor in curses console]
Message-id: [email protected]
--- hw/display/jazz_led.c | 6 ++- hw/display/vga.c | 3 +- include/ui/console.h | 15 ++++++++ ui/console.c | 101 ++++++++++++++++++++++---------------------------- ui/curses.c | 13 +++++-- 5 files changed, 76 insertions(+), 62 deletions(-)
hw/display/jazz_led.c +4 -2
@@ -233,8 +233,10 @@ static void jazz_led_text_update(void *opaque, console_ch_t *chardata)/* TODO: draw the segments */ snprintf (buf,2 ,"%02hhx\n" , s->segments); -console_write_ch (chardata++,0x00200100 | buf[0 ]); -console_write_ch (chardata++,0x00200100 | buf[1 ]); +console_write_ch (chardata++,ATTR2CHTYPE (buf[0 ],QEMU_COLOR_BLUE , +QEMU_COLOR_BLACK ,1 )); +console_write_ch (chardata++,ATTR2CHTYPE (buf[1 ],QEMU_COLOR_BLUE , +QEMU_COLOR_BLACK ,1 ));dpy_text_update (s->con,0 ,0 ,2 ,1 ); }
hw/display/vga.c +2 -1
@@ -1979,7 +1979,8 @@ static void vga_update_text(void *opaque, console_ch_t *chardata) width = (s->last_width - size) /2 ; dst = chardata + s->last_width + width;for (i =0 ; i < size; i ++) -console_write_ch (dst ++,0x00200100 | msg_buffer[i]); +console_write_ch (dst ++,ATTR2CHTYPE (msg_buffer[i],QEMU_COLOR_BLUE , +QEMU_COLOR_BLACK ,1 ));dpy_text_update (s->con,0 ,0 , s->last_width, height); }
include/ui/console.h +15 -0
@@ -30,6 +30,21 @@#define GUI_REFRESH_INTERVAL_DEFAULT 30#define GUI_REFRESH_INTERVAL_IDLE 3000 +/* Color number is match to standard vga palette */ +enum qemu_color_names { +QEMU_COLOR_BLACK =0 , +QEMU_COLOR_BLUE =1 , +QEMU_COLOR_GREEN =2 , +QEMU_COLOR_CYAN =3 , +QEMU_COLOR_RED =4 , +QEMU_COLOR_MAGENTA =5 , +QEMU_COLOR_YELLOW =6 , +QEMU_COLOR_WHITE =7 +}; +/* Convert to curses char attributes */ +#define ATTR2CHTYPE (c, fg, bg, bold) \ + ((bold) << 21 | (bg) << 11 | (fg) << 8 | (c)) +typedef void QEMUPutKBDEvent (void *opaque,int keycode);typedef void QEMUPutLEDEvent (void *opaque,int ledstate);typedef void QEMUPutMouseEvent (void *opaque,int dx,int dy,int dz,int buttons_state);
ui/console.c +45 -56
181 lines not on this page · raw message
ui/curses.c +10 -3
@@ -333,8 +333,14 @@ static void curses_atexit(void)static void curses_setup (void ) {int i, colour_default[8 ] = { -COLOR_BLACK ,COLOR_BLUE ,COLOR_GREEN ,COLOR_CYAN , -COLOR_RED ,COLOR_MAGENTA ,COLOR_YELLOW ,COLOR_WHITE , + [QEMU_COLOR_BLACK ] =COLOR_BLACK , + [QEMU_COLOR_BLUE ] =COLOR_BLUE , + [QEMU_COLOR_GREEN ] =COLOR_GREEN , + [QEMU_COLOR_CYAN ] =COLOR_CYAN , + [QEMU_COLOR_RED ] =COLOR_RED , + [QEMU_COLOR_MAGENTA ] =COLOR_MAGENTA , + [QEMU_COLOR_YELLOW ] =COLOR_YELLOW , + [QEMU_COLOR_WHITE ] =COLOR_WHITE , };/* input as raw as possible, let everything be interpreted
@@ -343,10 +349,11 @@ static void curses_setup(void)nodelay (stdscr, TRUE);nonl ();keypad (stdscr, TRUE);start_color ();raw ();scrollok (stdscr, FALSE); +/* Make color pair to match color format (3bits bg:3bits fg) */ for (i =0 ; i <64 ; i++) {init_pair (i, colour_default[i &7 ], colour_default[i >>3 ]); } -/* Set default color for more than 64. (monitor uses 0x74xx for example) */ +/* Set default color for more than 64 for safety. */ for (i =64 ; i <COLOR_PAIRS ; i++) {init_pair (i,COLOR_WHITE ,COLOR_BLACK ); }
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 21 lines · Gerd Hoffmann
Hi,
Flushing the ui patch queue with two older patches. The curses patch arrived during the 2.5 freeze. The sdl2 virgl patch is even older and was held back due to testing problems. Those went magically away meanwhile, so it most likely was either a bug somewhere else or some issue with the test setup. So going forward merging it now.
please pull,
GerdThe following changes since commit
a7e00e2536941a6e570b45b7ab4afec4505ff67e:petalogix-ml605: Set the MicroBlaze CPU version to 8.10.a (2016-01-07 14:57:26 +0100)
are available in the git repository at:
git://git.kraxel.org/qemutags/pull-ui-20160108-1for you to fetch changes up to
cb47dc9ab9f55083017291b2b8fbae639c576ec2:
Quoted 7 lines
sdl2/opengl: add opengl context and scanout support (2016-01-08 12:20:15 +0100)
----------------------------------------------------------------
sdl2/opengl: add opengl context and scanout support ui/curses: Fix color attribute of monitor for curses----------------------------------------------------------------
Applied, thanks.
-- PMM