Hello,
That didn't get applied, was there a problem with it?
Samuel Thibault, le Mon 03 Mar 2008 16:30:32 +0000, a écrit :
ioemu: support shared and linesize != width * depth
When sharing the buffer between e.g. xenfb and SDL, SDL must follow the
line size.
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
diff -r 3e970c2cae16 tools/ioemu/cocoa.m
--- a/tools/ioemu/cocoa.m Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/cocoa.m Mon Mar 03 16:27:44 2008 +0000
@@ -96,7 +96,7 @@ static void cocoa_update(DisplayState *d
cocoa_resize
------------------------------------------------------
*/
-static void cocoa_resize(DisplayState *ds, int w, int h)
+static void cocoa_resize(DisplayState *ds, int w, int h, int linesize)
{
const int device_bpp = 32;
static void *screen_pixels;
diff -r 3e970c2cae16 tools/ioemu/hw/pl110.c
--- a/tools/ioemu/hw/pl110.c Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/hw/pl110.c Mon Mar 03 16:27:44 2008 +0000
@@ -262,7 +262,7 @@ static void pl110_resize(pl110_state *s,
{
if (width != s->cols || height != s->rows) {
if (pl110_enabled(s)) {
- dpy_resize(s->ds, width, height);
+ dpy_resize(s->ds, width, height, width * 4);
}
}
s->cols = width;
@@ -375,7 +375,7 @@ static void pl110_write(void *opaque, ta
s->cr = val;
s->bpp = (val >> 1) & 7;
if (pl110_enabled(s)) {
- dpy_resize(s->ds, s->cols, s->rows);
+ dpy_resize(s->ds, s->cols, s->rows, s->cols * 4);
}
break;
case 10: /* LCDICR */
diff -r 3e970c2cae16 tools/ioemu/hw/tcx.c
--- a/tools/ioemu/hw/tcx.c Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/hw/tcx.c Mon Mar 03 16:27:44 2008 +0000
@@ -342,7 +342,7 @@ void tcx_init(DisplayState *ds, uint32_t
register_savevm("tcx", addr, 1, tcx_save, tcx_load, s);
qemu_register_reset(tcx_reset, s);
tcx_reset(s);
- dpy_resize(s->ds, width, height);
+ dpy_resize(s->ds, width, height, width * 1);
}
static void tcx_screen_dump(void *opaque, const char *filename)
diff -r 3e970c2cae16 tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/hw/vga.c Mon Mar 03 16:27:44 2008 +0000
@@ -1141,7 +1141,7 @@ static void vga_draw_text(VGAState *s, i
cw != s->last_cw || cheight != s->last_ch) {
s->last_scr_width = width * cw;
s->last_scr_height = height * cheight;
- dpy_resize(s->ds, s->last_scr_width, s->last_scr_height);
+ dpy_resize(s->ds, s->last_scr_width, s->last_scr_height,
s->last_scr_width * (depth / 8));
s->last_width = width;
s->last_height = height;
s->last_ch = cheight;
@@ -1563,7 +1563,7 @@ static void vga_draw_graphic(VGAState *s
}
if (disp_width != s->last_width ||
height != s->last_height) {
- dpy_resize(s->ds, disp_width, height);
+ dpy_resize(s->ds, disp_width, height, disp_width * (depth / 8));
s->last_scr_width = disp_width;
s->last_scr_height = height;
s->last_width = disp_width;
@@ -2229,7 +2229,7 @@ static void vga_save_dpy_update(DisplayS
{
}
-static void vga_save_dpy_resize(DisplayState *s, int w, int h)
+static void vga_save_dpy_resize(DisplayState *s, int w, int h, int linesize)
{
s->linesize = w * 4;
s->data = qemu_malloc(h * s->linesize);
diff -r 3e970c2cae16 tools/ioemu/hw/xenfb.c
--- a/tools/ioemu/hw/xenfb.c Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/hw/xenfb.c Mon Mar 03 16:27:44 2008 +0000
@@ -1183,7 +1183,7 @@ static int xenfb_register_console(struct
xenfb_screen_dump,
xenfb);
dpy_colourdepth(xenfb->ds, xenfb->depth);
- dpy_resize(xenfb->ds, xenfb->width, xenfb->height);
+ dpy_resize(xenfb->ds, xenfb->width, xenfb->height, xenfb->row_stride);
if (xenfb->ds->shared_buf)
dpy_setdata(xenfb->ds, xenfb->pixels);
@@ -1227,7 +1227,7 @@ static void xenfb_pv_update(DisplayState
fbfront_update(fb_dev, x, y, w, h);
}
-static void xenfb_pv_resize(DisplayState *s, int w, int h)
+static void xenfb_pv_resize(DisplayState *s, int w, int h, int linesize)
{
struct fbfront_dev *fb_dev = s->opaque;
fprintf(stderr,"resize to %dx%d required\n", w, h);
diff -r 3e970c2cae16 tools/ioemu/sdl.c
--- a/tools/ioemu/sdl.c Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/sdl.c Mon Mar 03 16:27:44 2008 +0000
@@ -90,7 +90,7 @@ static void sdl_setdata(DisplayState *ds
ds->data = pixels;
}
-static void sdl_resize(DisplayState *ds, int w, int h)
+static void sdl_resize(DisplayState *ds, int w, int h, int linesize)
{
int flags;
@@ -130,7 +130,7 @@ static void sdl_resize(DisplayState *ds,
ds->data = screen->pixels;
ds->linesize = screen->pitch;
} else {
- ds->linesize = (ds->depth / 8) * w;
+ ds->linesize = linesize;
}
}
@@ -342,7 +342,7 @@ static void toggle_full_screen(DisplaySt
static void toggle_full_screen(DisplayState *ds)
{
gui_fullscreen = !gui_fullscreen;
- sdl_resize(ds, screen->w, screen->h);
+ sdl_resize(ds, screen->w, screen->h, ds->linesize);
if (gui_fullscreen) {
gui_saved_grab = gui_grab;
sdl_grab_start();
@@ -559,7 +559,7 @@ void sdl_display_init(DisplayState *ds,
ds->dpy_colourdepth = sdl_colourdepth;
ds->dpy_setdata = sdl_setdata;
- sdl_resize(ds, 640, 400);
+ sdl_resize(ds, 640, 400, 640 * 4);
sdl_update_caption();
SDL_EnableKeyRepeat(250, 50);
SDL_EnableUNICODE(1);
diff -r 3e970c2cae16 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/vl.c Mon Mar 03 16:27:44 2008 +0000
@@ -4446,7 +4446,7 @@ static void dumb_update(DisplayState *ds
{
}
-static void dumb_resize(DisplayState *ds, int w, int h)
+static void dumb_resize(DisplayState *ds, int w, int h, int linesize)
{
}
diff -r 3e970c2cae16 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/vl.h Mon Mar 03 16:27:44 2008 +0000
@@ -940,7 +940,7 @@ struct DisplayState {
int shared_buf;
void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
- void (*dpy_resize)(struct DisplayState *s, int w, int h);
+ void (*dpy_resize)(struct DisplayState *s, int w, int h, int linesize);
void (*dpy_colourdepth)(struct DisplayState *s, int depth);
void (*dpy_setdata)(DisplayState *s, void *pixels);
void (*dpy_refresh)(struct DisplayState *s);
@@ -952,9 +952,9 @@ static inline void dpy_update(DisplaySta
s->dpy_update(s, x, y, w, h);
}
-static inline void dpy_resize(DisplayState *s, int w, int h)
+static inline void dpy_resize(DisplayState *s, int w, int h, int linesize)
{
- s->dpy_resize(s, w, h);
+ s->dpy_resize(s, w, h, linesize);
}
static inline void dpy_colourdepth(struct DisplayState *s, int depth)
diff -r 3e970c2cae16 tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c Mon Mar 03 13:24:20 2008 +0000
+++ b/tools/ioemu/vnc.c Mon Mar 03 16:27:44 2008 +0000
@@ -362,12 +362,15 @@ static void vnc_framebuffer_update(VncSt
vnc_write_s32(vs, encoding);
}
-static void vnc_dpy_resize(DisplayState *ds, int w, int h)
+static void vnc_dpy_resize(DisplayState *ds, int w, int h, int linesize)
{
static int allocated;
int size_changed;
VncState *vs = ds->opaque;
int o;
+
+ if (linesize != w * vs->depth)
+ ds->shared_buf = 0;
if (!ds->shared_buf) {
if (allocated)
@@ -1728,7 +1731,7 @@ static void vnc_dpy_colourdepth(DisplayS
}
}
- vnc_dpy_resize(ds, ds->width, ds->height);
+ vnc_dpy_resize(ds, ds->width, ds->height, ds->linesize);
}
static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|