sdl: Refresh debug statements

Put them under a #define similar to the VGA model and make them
actually compile. Add a couple too.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
sdl: Fix crash when calling sdl_switch() with NULL surface

This happens for example when doing ctrl-alt-u and segfaults

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ui/pixman: Don't use an alpha channel for byteswapped 32bpp

Otherwise some backends like SDL are actually going to try to
blend the pixels with a not very nice result

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ui: Make qemu_default_pixman_format() return 0 on unsupported formats

In order to remove the logic for detecting supported shared
pixmap formats from device models, make qemu_default_pixman_format()
capable for failing by returning 0 which is not a possible format
value rather than asserting.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ui: Add dpy_gfx_check_format() to check backend shared surface support

This allows VGA to decide whether to use a shared surface based on
whether the UI backend supports the format or not. Backends that
don't provide the new callback fallback to native 16 and 32bpp
which is equivalent to what was supported before.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ui/gtk: Support shared surface for most pixman formats

At least all the ones I've tested. We make the assumption that
pixman is going to be better at conversion than we are.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ui/vnc: Support shared surface for most pixman formats

At least all the ones I've tested. We make the assumption that
pixman is going to be better at conversion than we are.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ui/sdl: Support shared surface for more pixman formats

At least all the ones I've tested. We make the assumption that
SDL is going to be better at conversion than we are.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ui/pixman: Fix qemu_pixelformat_from_pixman() for BGRA and RGBA with no alpha

The conversion for these is incorrect when the alpha field is empty,
as it doesn't properly account for the unused 8 bits.

Instead, substract from bpp to calculate the shifts

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>