Replying here because my INBOX doesn't contain the original message.
On 18.09.2012, at 21:14, Anthony Liguori wrote: > Gerd Hoffmann <kra...@redhat.com> writes: > >> Stop reinventing the wheel. Use the pixman library for raster ops. >> >> Signed-off-by: Gerd Hoffmann <kra...@redhat.com> > > Why not cairo? I already have a cairo backend that uses GTK that > supports scaling. That would be a good opportunity for sharing even > more code. > > Regards, > > Anthony Liguori > >> --- >> configure | 12 ++++ >> ui/fbdev.c | 172 +++++++++++++++++++++++++++++++++++------------------------ >> 2 files changed, 114 insertions(+), 70 deletions(-) >> >> diff --git a/configure b/configure >> index c4ba338..d10ff78 100755 >> --- a/configure >> +++ b/configure >> @@ -148,6 +148,7 @@ docs="" >> fdt="" >> nptl="" >> sdl="" >> +pixman="" >> fbdev="no" >> virtfs="" >> vnc="yes" >> @@ -2153,6 +2154,17 @@ else >> exit 1 >> fi >> >> +if $pkg_config pixman-1 > /dev/null 2>&1 >> +then >> + pixman="yes" >> + pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null` >> + pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null` >> + QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags" >> + libs_softmmu="$libs_softmmu $pixman_libs" >> +else >> + fbdev="no" >> +fi >> + >> ########################################## >> # libcap probe >> >> diff --git a/ui/fbdev.c b/ui/fbdev.c >> index 40fc7d4..4cb4d1d 100644 >> --- a/ui/fbdev.c >> +++ b/ui/fbdev.c >> @@ -23,11 +23,12 @@ >> #include <linux/vt.h> >> #include <linux/fb.h> >> >> +#include <pixman.h> >> + >> #include "qemu-common.h" >> #include "console.h" >> #include "keymaps.h" >> #include "sysemu.h" >> -#include "pflib.h" >> >> /* >> * must be last so we get the linux input layer >> @@ -70,19 +71,82 @@ static bool key_down[KEY_CNT]; >> #define FB_ACQ_REQ 3 >> static int fb_switch_state; >> >> -/* qdev windup */ >> +/* qemu windup */ >> static DisplayChangeListener *dcl; >> -static QemuPfConv *conv; >> -static PixelFormat fbpf; >> static int resize_screen; >> static int redraw_screen; >> static int cx, cy, cw, ch; >> static Notifier exit_notifier; >> +static pixman_image_t *surface; >> +static pixman_image_t *framebuffer; >> +static pixman_transform_t transform; >> +static pixman_region16_t dirty; >> >> /* fwd decls */ >> static int fbdev_activate_vt(int tty, int vtno, bool wait); >> >> /* -------------------------------------------------------------------- */ >> +/* pixman helpers */ >> + >> +static int pixman_shifts_to_type(int rshift, int gshift, int bshift) >> +{ >> + int type = PIXMAN_TYPE_OTHER; >> + >> + if (rshift > gshift && gshift > bshift) { >> + if (bshift == 0) { >> + type = PIXMAN_TYPE_ARGB; >> + } else { >> +#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8) >> + type = PIXMAN_TYPE_RGBA; >> +#endif >> + } >> + } else if (rshift < gshift && gshift < bshift) { >> + if (rshift == 0) { >> + type = PIXMAN_TYPE_ABGR; >> + } else { >> + type = PIXMAN_TYPE_BGRA; This breaks for me: qemu-pixman.c: In function ‘qemu_pixman_get_type’: qemu-pixman.c:24: error: ‘PIXMAN_TYPE_BGRA’ undeclared (first use in this function) qemu-pixman.c:24: error: (Each undeclared identifier is reported only once qemu-pixman.c:24: error: for each function it appears in.) Alex