diff options
author | 2016-10-18 01:41:09 +0300 | |
---|---|---|
committer | 2016-10-18 15:20:34 +0530 | |
commit | 84770cc24f3a51c05055665feeac1dcf22119d69 (patch) | |
tree | e702589d25858bac9929de994199609143871391 /include/drm/drm_fourcc.h | |
parent | drm: avoid uninitialized timestamp use in wait_vblank (diff) | |
download | linux-84770cc24f3a51c05055665feeac1dcf22119d69.tar.gz linux-84770cc24f3a51c05055665feeac1dcf22119d69.tar.bz2 linux-84770cc24f3a51c05055665feeac1dcf22119d69.zip |
drm: Centralize format information
Various pieces of information about DRM formats (number of planes, color
depth, chroma subsampling, ...) are scattered across different helper
functions in the DRM core. Callers of those functions often need to
access more than a single parameter of the format, leading to
inefficiencies due to multiple lookups.
Centralize all format information in a data structure and create a
function to look up information based on the format 4CC.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1476744081-24485-2-git-send-email-laurent.pinchart@ideasonboard.com
Diffstat (limited to 'include/drm/drm_fourcc.h')
-rw-r--r-- | include/drm/drm_fourcc.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 30c30fa87ee8..135fef050ee6 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -25,6 +25,27 @@ #include <linux/types.h> #include <uapi/drm/drm_fourcc.h> +/** + * struct drm_format_info - information about a DRM format + * @format: 4CC format identifier (DRM_FORMAT_*) + * @depth: Color depth (number of bits per pixel excluding padding bits), + * valid for a subset of RGB formats only. This is a legacy field, do not + * use in new code and set to 0 for new formats. + * @num_planes: Number of color planes (1 to 3) + * @cpp: Number of bytes per pixel (per plane) + * @hsub: Horizontal chroma subsampling factor + * @vsub: Vertical chroma subsampling factor + */ +struct drm_format_info { + u32 format; + u8 depth; + u8 num_planes; + u8 cpp[3]; + u8 hsub; + u8 vsub; +}; + +const struct drm_format_info *drm_format_info(u32 format); uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp); int drm_format_num_planes(uint32_t format); |