On Tue, Dec 04, 2018 at 03:22:03PM +0100, Paul Kocialkowski wrote: > In prevision of adding support for YUV formats, set the YUV to RGB > colorspace conversion coefficients if required and don't bypass the > CSC engine when converting. > > The BT601 coefficients from the A33 BSP are copied over from the backend > code. Because of module inter-dependency, we can't have the frontend use > these coefficients from the backend directly. > > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxx> > --- > drivers/gpu/drm/sun4i/sun4i_frontend.c | 45 ++++++++++++++++++++++++-- > drivers/gpu/drm/sun4i/sun4i_frontend.h | 2 ++ > 2 files changed, 45 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c > index d0eca4b8784d..1737a4394401 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c > +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c > @@ -48,6 +48,28 @@ static const u32 sun4i_frontend_horz_coef[64] = { > 0x03ff0000, 0x0000fd41, 0x01ff0000, 0x0000fe42, > }; > > +/* > + * These coefficients are taken from the A33 BSP from Allwinner. > + * > + * The first three values of each row are coded as 13-bit signed fixed-point > + * numbers, with 10 bits for the fractional part. The fourth value is a > + * constant coded as a 14-bit signed fixed-point number with 4 bits for the > + * fractional part. > + * > + * The values in table order give the following colorspace translation: > + * G = 1.164 * Y - 0.391 * U - 0.813 * V + 135 > + * R = 1.164 * Y + 1.596 * V - 222 > + * B = 1.164 * Y + 2.018 * U + 276 > + * > + * This seems to be a conversion from Y[16:235] UV[16:240] to RGB[0:255], > + * following the BT601 spec. > + */ > +static const u32 sunxi_bt601_yuv2rgb_coef[12] = { > + 0x000004a7, 0x00001e6f, 0x00001cbf, 0x00000877, > + 0x000004a7, 0x00000000, 0x00000662, 0x00003211, > + 0x000004a7, 0x00000812, 0x00000000, 0x00002eb1, > +}; > + I'd really prefer not to duplicate that structure. IIRC, we already have a dependency between the frontend and the backend (or the other way around), maybe we should just move that structure to either so that we don't have a circular dependency? Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel