diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2017-03-21 19:12:16 +0100 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2017-03-22 18:45:00 +0100 |
commit | 6a0f9ebfc5e753bb948c13353615324462d73795 (patch) | |
tree | 1ccb2551fc4bd3293ce63a995c2f3301ee4690a9 /drivers/gpu/drm/drm_fourcc.c | |
parent | drm: Remove fb hsub/vsub alignment requirement (diff) | |
download | linux-6a0f9ebfc5e753bb948c13353615324462d73795.tar.xz linux-6a0f9ebfc5e753bb948c13353615324462d73795.zip |
drm: Add mode_config .get_format_info() hook
Allow drivers to return a custom drm_format_info structure for special
fb layouts. We'll use this for the compression control surface in i915.
v2: Fix drm_get_format_info() kernel doc (Laurent)
Don't pass 'dev' to the new hook (Laurent)
v3: s/compresssion/compression/ (Ben)
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Link: http://patchwork.freedesktop.org/patch/msgid/20170321181218.10042-4-ville.syrjala@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_fourcc.c')
-rw-r--r-- | drivers/gpu/drm/drm_fourcc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index 90d2cc8da8eb..f9b6445e846a 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -199,6 +199,31 @@ const struct drm_format_info *drm_format_info(u32 format) EXPORT_SYMBOL(drm_format_info); /** + * drm_get_format_info - query information for a given framebuffer configuration + * @dev: DRM device + * @mode_cmd: metadata from the userspace fb creation request + * + * Returns: + * The instance of struct drm_format_info that describes the pixel format, or + * NULL if the format is unsupported. + */ +const struct drm_format_info * +drm_get_format_info(struct drm_device *dev, + const struct drm_mode_fb_cmd2 *mode_cmd) +{ + const struct drm_format_info *info = NULL; + + if (dev->mode_config.funcs->get_format_info) + info = dev->mode_config.funcs->get_format_info(mode_cmd); + + if (!info) + info = drm_format_info(mode_cmd->pixel_format); + + return info; +} +EXPORT_SYMBOL(drm_get_format_info); + +/** * drm_format_num_planes - get the number of planes for format * @format: pixel format (DRM_FORMAT_*) * |