Skip to contentSkip to conversation

sdl shared buffer support

PATCH In review Stefano Stabellini 2 participants 4 messages Sep 4, 2008 – Sep 8, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdl shared buffer support

This patch implements shared buffer support in sdl.c. It also supports paletted 8 bit colour depths using the palette functions provided by the SDL library.

---

console.h +1 -0
index a054d97..7d252b7 100644
@@ -81,6 +81,7 @@ struct DisplayState {
     int width;
     int height;
     void *opaque;
+    uint32_t *palette;
     struct QEMUTimer *gui_timer;
     uint64_t gui_timer_interval;
     int idle; /* there is nothing to update (window invisible), set by vnc/sdl */
hw/vga.c +1 -0
index 6e40d3d..d5265c0 100644
@@ -2026,6 +2026,7 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
     s->vram_offset = vga_ram_offset;
     s->vram_size = vga_ram_size;
     s->ds = ds;
+    ds->palette = s->last_palette;
     s->get_bpp = vga_get_bpp;
     s->get_offsets = vga_get_offsets;
     s->get_resolution = vga_get_resolution;
sdl.c +104 -26

182 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Stefano Stabellini

This patch implements shared buffer support in sdl.c. It also supports paletted 8 bit colour depths using the palette functions provided by the SDL library.

So the theory goes that it's possible with this patch that both surfaces are hardware surfaces so blitting is fast? In practice, when using X11 both surfaces are going to be XShmImages so I don't think this is going to perform any better than the current code.

Do you have any sort of measurements that show an advantage with this patch?

I sort of think you want the opposite interface. One where the VGA code uses ds->data directly if the guest ds->data is in a supportable format.

Regards,

Anthony Liguori

#2 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 4 lines · Stefano Stabellini

This patch implements shared buffer support in sdl.c. It also supports paletted 8 bit colour depths using the palette functions provided by the SDL library.

So the theory goes that it's possible with this patch that both surfaces are hardware surfaces so blitting is fast?

The theory goes that SDL blitting and color conversion functions should be as optimized as you can get, and hardware accelerated if your card supports it.
Besides I think that offloading blitting and color conversion to a graphic library is a good idea.

Quoted 3 lines

In practice, when using X11
both surfaces are going to be XShmImages so I don't think this is going to perform any better than the current code.

Only the guest framebuffer derived surface is always a software surface, the host window can be an hardware surface (as far as I know).

Quoted 2 lines

Do you have any sort of measurements that show an advantage with this patch?

I don't have any numbers, but I'll try to get some.

Quoted 2 lines

I sort of think you want the opposite interface. One where the VGA code uses ds->data directly if the guest ds->data is in a supportable format.

Not really, because the frontend can often change his own internal resolution and pixel format (ex.: vnc).

#3 lore raw
Quoted 15 lines · Stefano Stabellini
Quoted 10 lines · Anthony Liguori
Quoted 5 lines · Stefano Stabellini

This patch implements shared buffer support in sdl.c. It also supports paletted 8 bit colour depths using the palette functions provided by the SDL library.

So the theory goes that it's possible with this patch that both surfaces are hardware surfaces so blitting is fast?

Quoted 6 lines

The theory goes that SDL blitting and color conversion functions should be as optimized as you can get, and hardware accelerated if your card supports it.
Besides I think that offloading blitting and color conversion to a graphic library is a good idea.

It requires two paths in the code to handle the case where the backend can't handle conversion itself. If we're not getting any sort of benefit from offloading, then I don't see the need for increased code complexity.

Quoted 8 lines
Quoted 4 lines

In practice, when using X11
both surfaces are going to be XShmImages so I don't think this is going to perform any better than the current code.

Only the guest framebuffer derived surface is always a software surface, the host window can be an hardware surface (as far as I know).

Not when using SDL on X11. It will use an XShmImage if possible, otherwise falling back to a normal XImage. There's really no other way to do surfaces in X11 without using one of the extensions (like DGA).

Regards,

Anthony Liguori