qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: sandmann@cs.au.dk (Søren Sandmann)
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 7/9] fbdev: move to pixman
Date: Tue, 18 Sep 2012 22:30:28 +0200	[thread overview]
Message-ID: <ye8lig73wgr.fsf@llama03.cs.au.dk> (raw)
In-Reply-To: <1347952634-12286-8-git-send-email-kraxel@redhat.com> (Gerd Hoffmann's message of "Tue, 18 Sep 2012 09:17:12 +0200")

Gerd Hoffmann <kraxel@redhat.com> writes:

> +static pixman_image_t *pixman_from_displaystate(DisplayState *ds)
> +{
> +    PixelFormat *pf = &ds->surface->pf;
> +    pixman_format_code_t format;
> +    pixman_image_t *image;
> +    int type;
> +
> +    type = pixman_shifts_to_type(pf->rshift, pf->gshift, pf->bshift);
> +    format = PIXMAN_FORMAT(pf->bits_per_pixel, type,
> +                           pf->abits, pf->rbits, pf->gbits, pf->bbits);
> +    image = pixman_image_create_bits(format, ds_get_width(ds),
> +                                     ds_get_height(ds),
> +                                     (void *)ds_get_data(ds),
> +                                     ds_get_linesize(ds));
> +    return image;
> +}
> +
> +static pixman_image_t *pixman_from_framebuffer(void)
> +{
> +    pixman_format_code_t format;
> +    pixman_image_t *image;
> +    int type;
> +
> +    type = pixman_shifts_to_type(fb_var.red.offset,
> +                                 fb_var.green.offset,
> +                                 fb_var.blue.offset);
> +    format = PIXMAN_FORMAT(fb_var.bits_per_pixel, type,
> +                           fb_var.transp.length,
> +                           fb_var.red.length,
> +                           fb_var.green.length,
> +                           fb_var.blue.length);
> +    image = pixman_image_create_bits(format, fb_var.xres, fb_var.yres,
> +                                     (void *)fb_mem, fb_fix.line_length);
> +    return image;
> +}

You may want to call pixman_format_supported_source/destination() here
to ensure that the format in question is supported by pixman.

> -static void fbdev_render(DisplayState *ds, int x, int y, int w, int h)
> +static void fbdev_render(DisplayState *ds)
>  {
> -    uint8_t *dst;
> -    uint8_t *src;
> -    int line;
> -
> -    if (!conv) {
> -        return;
> -    }
> -
> -    src = ds_get_data(ds) + y * ds_get_linesize(ds)
> -        + x * ds_get_bytes_per_pixel(ds);
> -    dst = fb_mem + y * fb_fix.line_length
> -        + x * fbpf.bytes_per_pixel;
> -
> -    dst += cy * fb_fix.line_length;
> -    dst += cx * fbpf.bytes_per_pixel;
> +    assert(surface);
>  
> -    if (h > fb_var.yres - y) {
> -        h = fb_var.yres - y;
> -    }
> -    if (w > fb_var.xres - x) {
> -        w = fb_var.xres - x;
> -    }
> -
> -    for (line = y; line < y+h; line++) {
> -        qemu_pf_conv_run(conv, dst, src, w);
> -        dst += fb_fix.line_length;
> -        src += ds_get_linesize(ds);
> -    }
> +    pixman_image_set_clip_region(surface, &dirty);
> +    pixman_image_composite(PIXMAN_OP_SRC, surface, NULL, framebuffer,
> +                           0, 0, 0, 0, 0, 0, fb_var.xres, fb_var.yres);
> +    pixman_region_fini(&dirty);
> +    pixman_region_init(&dirty);
>  }

The fini()/init() here could be done with pixman_region_clear() which
was introduced in 0.26.0.


Søren

  parent reply	other threads:[~2012-09-18 20:30 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18  7:17 [Qemu-devel] [PULL 0/9] linux framebuffer display driver Gerd Hoffmann
2012-09-18  7:17 ` [Qemu-devel] [PATCH 1/9] QLIST-ify display change listeners Gerd Hoffmann
2012-09-18  7:17 ` [Qemu-devel] [PATCH 2/9] add unregister_displaychangelistener Gerd Hoffmann
2012-09-18 10:54   ` Stefano Stabellini
2012-09-18  7:17 ` [Qemu-devel] [PATCH 3/9] move set_mouse + cursor_define callbacks Gerd Hoffmann
2012-09-18 14:10   ` Stefano Stabellini
2012-09-18 16:31     ` Gerd Hoffmann
2012-09-18 16:44       ` Stefano Stabellini
2012-09-18  7:17 ` [Qemu-devel] [PATCH 4/9] fbdev: add linux framebuffer display driver Gerd Hoffmann
2012-09-18 15:01   ` Stefano Stabellini
2012-09-19  5:19     ` Gerd Hoffmann
2012-09-19 18:37   ` Blue Swirl
2012-09-18  7:17 ` [Qemu-devel] [PATCH 5/9] fbdev: add monitor command to enable/disable Gerd Hoffmann
2012-09-18 12:47   ` Luiz Capitulino
2012-09-18  7:17 ` [Qemu-devel] [PATCH 6/9] fbdev: make configurable at compile time Gerd Hoffmann
2012-09-18  7:17 ` [Qemu-devel] [PATCH 7/9] fbdev: move to pixman Gerd Hoffmann
2012-09-18 15:01   ` Stefano Stabellini
2012-09-19  5:51     ` Gerd Hoffmann
2012-09-18 19:14   ` Anthony Liguori
2012-09-18 21:08     ` Anthony Liguori
2012-11-26 18:42     ` Alexander Graf
2012-11-26 20:01       ` Gerd Hoffmann
2012-11-26 20:05         ` Alexander Graf
2012-09-18 20:30   ` Søren Sandmann [this message]
2012-09-19  5:56     ` Gerd Hoffmann
2012-09-18  7:17 ` [Qemu-devel] [PATCH 8/9] fbdev: add mouse pointer support Gerd Hoffmann
2012-09-18  7:17 ` [Qemu-devel] [PATCH 9/9] fbdev: add display scaling support Gerd Hoffmann
2012-09-18 15:02   ` Stefano Stabellini
2012-09-19  5:52     ` Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2012-09-19 11:15 [Qemu-devel] [PATCH v4 0/9] linux framebuffer display driver Gerd Hoffmann
2012-09-19 11:15 ` [Qemu-devel] [PATCH 7/9] fbdev: move to pixman Gerd Hoffmann
2012-09-19 18:10   ` Stefano Stabellini
2012-09-20  6:16     ` Gerd Hoffmann
2012-09-20 11:33       ` Stefano Stabellini
2012-09-20 13:51         ` Gerd Hoffmann
2012-09-20 15:20           ` Stefano Stabellini
2012-09-20 15:27             ` Gerd Hoffmann
2012-09-20 15:28               ` Stefano Stabellini
2012-09-20 15:33                 ` Stefano Stabellini
2012-09-21  5:40                   ` Gerd Hoffmann
2012-09-21 10:48                     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ye8lig73wgr.fsf@llama03.cs.au.dk \
    --to=sandmann@cs.au.dk \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).