From: Maxime Ripard Subject: Re: [RFC PATCH i-g-t 2/3] tests/chamelium: Add test case for plane formats Date: Tue, 13 Mar 2018 16:05:56 +0100 Message-ID: <20180313150556.dv7p7wjsmo572whm@flea> References: <20180305142129.18352-1-maxime.ripard@bootlin.com> <20180305142129.18352-3-maxime.ripard@bootlin.com> <878taxxgl9.fsf@anholt.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1751254766==" Return-path: Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id F081D6E568 for ; Tue, 13 Mar 2018 15:06:07 +0000 (UTC) In-Reply-To: <878taxxgl9.fsf@anholt.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Eric Anholt Cc: intel-gfx@lists.freedesktop.org, Thomas Petazzoni , eben@raspberrypi.org List-Id: intel-gfx@lists.freedesktop.org --===============1751254766== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mxxk3nwzm7bwo3c3" Content-Disposition: inline --mxxk3nwzm7bwo3c3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Eric, On Mon, Mar 12, 2018 at 12:02:26PM -0700, Eric Anholt wrote: > > +static pixman_image_t *convert_frame_format(pixman_image_t *src, > > + int format) > > +{ > > + pixman_image_t *converted; > > + unsigned int w =3D pixman_image_get_width(src); > > + unsigned int h =3D pixman_image_get_height(src); > > + void *data =3D malloc(w * h * 4); > > + > > + memset(data, 0, w * h * 4); > > + converted =3D pixman_image_create_bits(format, w, h, data, > > + PIXMAN_FORMAT_BPP(format) / 8 * w); > > + pixman_image_composite(PIXMAN_OP_ADD, src, NULL, converted, > > + 0, 0, 0, 0, 0, 0, w, h); > > + return converted; > > +} >=20 > Instead of the memset, you could just use PIXMAN_OP_SRC. I guess PIXMAN_OP_ADD will do a composition between the existing buffer content and the new one, while PIXMAN_OP_SRC will just take whatever comes from the buffer and overwrite the previous content? > Also, instead of "* 4", probably want "* PIXMAN_FORMAT_BPP(format) / 8" > there too. Ah, yes, definitely. > > +#define PIXEL_MASK 0x00f8f8f8 >=20 > If we're going to have some tolerance, the tolerance should probably > depend on the lowest depth of the channel involved. Indeed, yes. > However, I'm not sure this is needed -- we should be able to get > bit-exact from VC4 by filling in the size-extension bits in the HVS. I guess it really depends on what we're aiming for here. While it would probably work with VC4, I think this part is rather generic, so I guess we could end up in scenarios where the CRTC will not fill the bits to our expected value and where it wouldn't be something we can change. I just looked at the Allwinner display engine for example, and it didn't have such configuration (documented, at least). That's why I went with this approach here (but I can definitely change it if we want to deal with that theorical case later). Maxime --=20 Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com --mxxk3nwzm7bwo3c3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlqn6NMACgkQ0rTAlCFN r3SZqg/+J85GlH1+w9++URsYEIZuW6Lt+S68WGVoMirxqWbUw1euRRgneHgeA5Ib 6nHN2Z3J6lJKBKshSCYhQ6VkmuVf0P7JpFwjhIDDBFGPAKo8eTNj0QPOThDDYd30 5DTEigIZqKmF7tAejA1rs8IttsHS1JDZriwfzXP+uS3fJh5TGFwtahOPZ3TpUOLG BPSCscCUF32Cf47kHFKPFsFVJRrIZwqR4MEmyEESMih82I3SXUD1d+4F9zmTVbBm UtxEU+UwNLjilxaqWycBJAlMuWFFjJ6E28tah0pkom2YMUwJeUIVIZsO1/3oGdAG Bl69+I8uIspwFQK3vrs8Y6lofZd4LyOwHK0jksDUB7gGdebi0HEY5F0GKdTS2gyJ iKylv+zLXkfJMKH1V2IHV8SQwWHnfNzsux0NEP4b7TJVE9XblXYvGO6NKb+EqcNx igZCPd1TCLAZEF3uYJhS4DVGs07idF7NTSwXqFvtX++ZGC7+pThjZYbBqp7oh74t D/aL2FI7wFgDz/AypUMTwJbXMEloaIfS40lFvPOd/tr2TQxnUjz9ufEpFW+koyUs DcnkN96QxziVhZllJRzrtbyGwv68y7lvFBeTi5qSMvawbeSSuHJNm3Jyc8j7wWMP sVNHPfSuUCbBYbEOXOUJwK+v/Yp9uszvoUCRDW1ox1xRTeKjsk4= =Th88 -----END PGP SIGNATURE----- --mxxk3nwzm7bwo3c3-- --===============1751254766== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1751254766==--