From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE4RE-0002gJ-SD for qemu-devel@nongnu.org; Tue, 18 Sep 2012 16:30:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TE4RD-0006cM-IG for qemu-devel@nongnu.org; Tue, 18 Sep 2012 16:30:32 -0400 Received: from smtp.nfit.au.dk ([130.225.17.180]:48110 helo=nysmtp.nfit.au.dk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE4RD-0006ZQ-9w for qemu-devel@nongnu.org; Tue, 18 Sep 2012 16:30:31 -0400 From: sandmann@cs.au.dk (=?utf-8?Q?S=C3=B8ren?= Sandmann) References: <1347952634-12286-1-git-send-email-kraxel@redhat.com> <1347952634-12286-8-git-send-email-kraxel@redhat.com> Date: Tue, 18 Sep 2012 22:30:28 +0200 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") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 7/9] fbdev: move to pixman List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Gerd Hoffmann writes: > +static pixman_image_t *pixman_from_displaystate(DisplayState *ds) > +{ > + PixelFormat *pf =3D &ds->surface->pf; > + pixman_format_code_t format; > + pixman_image_t *image; > + int type; > + > + type =3D pixman_shifts_to_type(pf->rshift, pf->gshift, pf->bshift); > + format =3D PIXMAN_FORMAT(pf->bits_per_pixel, type, > + pf->abits, pf->rbits, pf->gbits, pf->bbits); > + image =3D 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 =3D pixman_shifts_to_type(fb_var.red.offset, > + fb_var.green.offset, > + fb_var.blue.offset); > + format =3D 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 =3D 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 =3D ds_get_data(ds) + y * ds_get_linesize(ds) > - + x * ds_get_bytes_per_pixel(ds); > - dst =3D fb_mem + y * fb_fix.line_length > - + x * fbpf.bytes_per_pixel; > - > - dst +=3D cy * fb_fix.line_length; > - dst +=3D cx * fbpf.bytes_per_pixel; > + assert(surface); >=20=20 > - if (h > fb_var.yres - y) { > - h =3D fb_var.yres - y; > - } > - if (w > fb_var.xres - x) { > - w =3D fb_var.xres - x; > - } > - > - for (line =3D y; line < y+h; line++) { > - qemu_pf_conv_run(conv, dst, src, w); > - dst +=3D fb_fix.line_length; > - src +=3D 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=C3=B8ren