From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomi Valkeinen Subject: Re: [PATCH v3 02/20] drm: omapdrm: fb: Use format information provided by the DRM core Date: Tue, 20 Sep 2016 15:47:57 +0300 Message-ID: <41803d25-2ba2-e022-984f-c0d3653cec97@ti.com> References: <1474288063-5315-1-git-send-email-laurent.pinchart@ideasonboard.com> <1474288063-5315-3-git-send-email-laurent.pinchart@ideasonboard.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0201598886==" Return-path: Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [198.47.19.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9BF386E713 for ; Tue, 20 Sep 2016 12:48:03 +0000 (UTC) In-Reply-To: <1474288063-5315-3-git-send-email-laurent.pinchart@ideasonboard.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Laurent Pinchart , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0201598886== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jaelig5noeuCp85QSVf6fm9u5X4lQiORh" --jaelig5noeuCp85QSVf6fm9u5X4lQiORh Content-Type: multipart/mixed; boundary="B4G8dhldoXFdAH0O84Sjn8n3EuKHXhI1P"; protected-headers="v1" From: Tomi Valkeinen To: Laurent Pinchart , dri-devel@lists.freedesktop.org Message-ID: <41803d25-2ba2-e022-984f-c0d3653cec97@ti.com> Subject: Re: [PATCH v3 02/20] drm: omapdrm: fb: Use format information provided by the DRM core References: <1474288063-5315-1-git-send-email-laurent.pinchart@ideasonboard.com> <1474288063-5315-3-git-send-email-laurent.pinchart@ideasonboard.com> In-Reply-To: <1474288063-5315-3-git-send-email-laurent.pinchart@ideasonboard.com> --B4G8dhldoXFdAH0O84Sjn8n3EuKHXhI1P Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19/09/16 15:27, Laurent Pinchart wrote: > The driver stores in a custom structure named format several pieces of > information about the format that are available in the DRM core. Remove= > them and get the information from the DRM core instead. >=20 > Signed-off-by: Laurent Pinchart > --- > @@ -128,13 +122,13 @@ static const struct drm_framebuffer_funcs omap_fr= amebuffer_funcs =3D { > }; > =20 > static uint32_t get_linear_addr(struct plane *plane, > - const struct format *format, int n, int x, int y) > + const struct drm_format_info *format, int n, int x, int y) > { > uint32_t offset; > =20 > - offset =3D plane->offset + > - (x * format->planes[n].stride_bpp) + > - (y * plane->pitch / format->planes[n].sub_y); > + offset =3D plane->offset > + + (x * format->cpp[n] / (n =3D=3D 1 ? 1 : format->hsub)) > + + (y * plane->pitch / (n =3D=3D 1 ? 1 : format->vsub)); n is the plane number? Shouldn't the above be (n =3D=3D 0 ? 1 : format->h= sub)? > @@ -413,28 +410,32 @@ struct drm_framebuffer *omap_framebuffer_init(str= uct drm_device *dev, > =20 > fb =3D &omap_fb->base; > omap_fb->format =3D format; > + omap_fb->dss_format =3D dss_format; > mutex_init(&omap_fb->lock); > =20 > - for (i =3D 0; i < n; i++) { > + for (i =3D 0; i < format->num_planes; i++) { > struct plane *plane =3D &omap_fb->planes[i]; > - int size, pitch =3D mode_cmd->pitches[i]; > + unsigned int pitch =3D mode_cmd->pitches[i]; > + unsigned int hsub =3D i =3D=3D 0 ? 1 : format->hsub; > + unsigned int vsub =3D i =3D=3D 0 ? 1 : format->vsub; This makes me wonder... Will all drivers do something like the above? It's a bit laborious way to get the pixel subsampling factor, and I presume something like above is quite common so that all the calculations can be more generic (and not specific to a UV plane). Tomi --B4G8dhldoXFdAH0O84Sjn8n3EuKHXhI1P-- --jaelig5noeuCp85QSVf6fm9u5X4lQiORh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX4S/9AAoJEPo9qoy8lh71w9cP/1GukNaGdheK1CTp9U+0sU9A If3ivJ5ChugNNyfksXs1lJDC9rAtskz1wCIXdPDy72VBoKmrg9RplKGv65TF/Wbu EvezZd7QMsTPTZTgnv/iIho9Up+k5MfbNsQ5pirKS9CLYvy1D/bAll6cvNXQLAJR faSlVzVQbR8d8C9em1NPYAwhsgbYGCAE6b+LMp5Tm5zHU3FVDz597bxvTEL3dkUX 6tzK0I9MWCXjOeHxK2brDWDG077uXpgQWLCbUt0Rhh464D3G9AExqI+xG7B/eHi0 2++4ut84bqoaLH/cwMu+bqkk98XZLAjs+omC09H4CjoGuFBAVklSmA1k2A3ZJQ1V DpajM+0eJo+01xLqCz7dNlAxdne7yCY083vejwUu7I5vN4R+4OvwigVKZkxexGLf yxvlNWUIEAdRqTeD+ITvGXmCoLNMo/xpUJeU/euLwZDWWZRc4WuvBfA+/dLwQ9i1 J2uNeOd6TwbUzdrUT1CVF1iqOieWx27Csr4pN+DlCRay1hAdlDYEOwwpI8OU0fUO 83GE73qcosakNyIH36sCAW9dY/A1cF+ZALuy6aLbI86jDsJ8Kx9DTVLUFg7X5ZIu Mx0ePpAeqjpJJuWKIohynK7QMVRvLvXfthmDiai6AE8KvkQOiuCZ6rCQCrQfA4L3 Loy6G4WJ14hShpXhYd0/ =t2Zh -----END PGP SIGNATURE----- --jaelig5noeuCp85QSVf6fm9u5X4lQiORh-- --===============0201598886== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0201598886==--