[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 7/9] fbdev: move to pixman
From: |
Søren Sandmann |
Subject: |
Re: [Qemu-devel] [PATCH 7/9] fbdev: move to pixman |
Date: |
Tue, 18 Sep 2012 22:30:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Gerd Hoffmann <address@hidden> 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
- [Qemu-devel] [PATCH 6/9] fbdev: make configurable at compile time., (continued)
- [Qemu-devel] [PATCH 6/9] fbdev: make configurable at compile time., Gerd Hoffmann, 2012/09/18
- [Qemu-devel] [PATCH 8/9] fbdev: add mouse pointer support, Gerd Hoffmann, 2012/09/18
- [Qemu-devel] [PATCH 9/9] fbdev: add display scaling support, Gerd Hoffmann, 2012/09/18
- [Qemu-devel] [PATCH 7/9] fbdev: move to pixman, Gerd Hoffmann, 2012/09/18
- [Qemu-devel] [PATCH 4/9] fbdev: add linux framebuffer display driver., Gerd Hoffmann, 2012/09/18