[PATCH] drm: Set depth and bpp for XRGB4444 family formats

Daniel Vetter daniel at ffwll.ch
Wed Aug 10 14:12:38 UTC 2016


On Wed, Aug 10, 2016 at 01:04:54PM +0200, Fabien DESSENNE wrote:
> 
> On 08/10/2016 12:35 PM, Daniel Vetter wrote:
> > On Wed, Aug 10, 2016 at 11:21:56AM +0200, Fabien Dessenne wrote:
> >> These pixel formats are supported by format_check() from drm_crtc.c, so
> >> provide there depth and bpp.
> >>
> >> Signed-off-by: Fabien Dessenne <fabien.dessenne at st.com>
> > Why?
> At least for consistency between format_check() and drm_fb_get_bpp_depth().

fb_get_bpp_depth is kinda legacy, the recommended way is to have a switch
statement in your driver that directly decodes DRM_FORMAT_* into driver
register values. The inconsistency is intentional since just looking at
bpp and depth removes a lot of information.

Probably a better patch would be to update the kerneldoc for these
functions. Also Laurent is working on a complete reorg of all this.
-Daniel

> > Who's going to use this?
> For the time being, I can see 9 drivers that make more or less use of 
> this format (amd, atmel-hlcdc, exynos, fsl-dcu, imx, omapdrm, radeon, 
> rcar-du, sti).
> In top of that I am working on a new driver that actually needs this 
> format, and that does not work without this patch.
> > -Daniel
> >
> >> ---
> >>   drivers/gpu/drm/drm_fourcc.c | 11 +++++++++++
> >>   1 file changed, 11 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> >> index 0645c85..aa8c909 100644
> >> --- a/drivers/gpu/drm/drm_fourcc.c
> >> +++ b/drivers/gpu/drm/drm_fourcc.c
> >> @@ -80,6 +80,17 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
> >>   		*depth = 8;
> >>   		*bpp = 8;
> >>   		break;
> >> +	case DRM_FORMAT_XRGB4444:
> >> +	case DRM_FORMAT_XBGR4444:
> >> +	case DRM_FORMAT_RGBX4444:
> >> +	case DRM_FORMAT_BGRX4444:
> >> +	case DRM_FORMAT_ARGB4444:
> >> +	case DRM_FORMAT_ABGR4444:
> >> +	case DRM_FORMAT_RGBA4444:
> >> +	case DRM_FORMAT_BGRA4444:
> >> +		*depth = 12;
> >> +		*bpp = 16;
> >> +		break;
> >>   	case DRM_FORMAT_XRGB1555:
> >>   	case DRM_FORMAT_XBGR1555:
> >>   	case DRM_FORMAT_RGBX5551:
> >> -- 
> >> 1.9.1
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list