mbox series

[0/3] Add Mali DP pixel formats

Message ID 20180726141005.8321-1-alexandru-cosmin.gheorghe@arm.com (mailing list archive)
Headers show
Series Add Mali DP pixel formats | expand

Message

Alexandru-Cosmin Gheorghe July 26, 2018, 2:10 p.m. UTC
Mali DP supports a bunch of pixel formats that don't have a fourcc
code defined in drm_fourcc.h, so this patchset adds the definition for
those formats and enables them in mali-dp driver.

The following new formats will be added:

Packed YCbCr444
* DRM_FORMAT_XYUV8888
* DRM_FORMAT_XVYU2101010

Two plane 10 bits format.
* DRM_FORMAT_P010

Packed YCbCr420 2x2 tiled formats
* DRM_FORMAT_Y0L0
* DRM_FORMAT_X0L0
* DRM_FORMAT_Y0L2
* DRM_FORMAT_X0L2
The difference between X0L0/X0L2 vs Y0L0/Y0L2 is that the later group
have two alpha bits per pixel.

This group is a bit special because we are dealing with a tiled format
where the first 64 bits in memory represent the pixels for a 2x2 tile,
so it needs a bit of special handling when it comes to:
 - pitch: needs to cover both rows that are in the same tile.
 - min allocation size: since a pitch cover both rows the formulas
   defined in drm_gem_fb_create don't work anymore.
 - handling of src_x and src_y offset: same as above since we are
   dealing with a tiled format drm_fb_cma_get_gem_obj doesn't return
   the correct address offset.

So, for this formats mali-dp needs a special implementation of
drm_fb_cma_get_gem_obj and drm_fb_cma_get_gem_addr which are more or
less clones of the core functions, except they take into account the
tile_size.

Other alternatives would be:
  1) Add a tile_size to drm_format_info and plumb the drm_core
     functions to proper handle this special formats.
  2) Add a driver hook that checks buffer min_size and avoid
     duplicating the code from drm_gem_fb_create_with_funcs.

If you have an opinion about how this should be handled feel free to
suggest it.

Alexandru Gheorghe (3):
  drm/fourcc: Add malidp yuv formats
  drm: Make drm_gem_fb_alloc available for drivers to use
  drm: mali-dp: Enable mali specific buffer formats

 drivers/gpu/drm/arm/malidp_drv.c             | 65 +++++++++++++++++++-
 drivers/gpu/drm/arm/malidp_hw.c              |  7 ++-
 drivers/gpu/drm/arm/malidp_planes.c          | 52 +++++++++++++---
 drivers/gpu/drm/drm_fourcc.c                 |  7 +++
 drivers/gpu/drm/drm_gem_framebuffer_helper.c |  3 +-
 include/drm/drm_gem_framebuffer_helper.h     |  5 ++
 include/uapi/drm/drm_fourcc.h                | 27 +++++++-
 7 files changed, 154 insertions(+), 12 deletions(-)