summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_modeset_helper.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-10-18 00:41:21 +0200
committerArchit Taneja <architt@codeaurora.org>2016-10-18 11:54:08 +0200
commit488546fc4d246698d4db9c46f7ec06c4839a18e1 (patch)
tree7b607e9f4d8b3bc72956eca301ae8c92e2e1e090 /drivers/gpu/drm/drm_modeset_helper.c
parentdrm/arm: mali-dp: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() (diff)
downloadlinux-488546fc4d246698d4db9c46f7ec06c4839a18e1.tar.xz
linux-488546fc4d246698d4db9c46f7ec06c4839a18e1.zip
drm: Don't export the drm_fb_get_bpp_depth() function
The function is only used by the drm_helper_mode_fill_fb_struct() core function to fill the drm_framebuffer bpp and depth fields, used by drivers that haven't been converted to use pixel formats directly yet. It should not be used by new drivers, so inline it in its only caller. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Archit Taneja <architt@codeaurora.org> Link: http://patchwork.freedesktop.org/patch/msgid/1476744081-24485-14-git-send-email-laurent.pinchart@ideasonboard.com
Diffstat (limited to 'drivers/gpu/drm/drm_modeset_helper.c')
-rw-r--r--drivers/gpu/drm/drm_modeset_helper.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
index 1d45738f8f98..2544dfe7354c 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -70,8 +70,23 @@ EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
+ const struct drm_format_info *info;
int i;
+ info = drm_format_info(mode_cmd->pixel_format);
+ if (!info || !info->depth) {
+ char *format_name = drm_get_format_name(mode_cmd->pixel_format);
+
+ DRM_DEBUG_KMS("non-RGB pixel format %s\n", format_name);
+ kfree(format_name);
+
+ fb->depth = 0;
+ fb->bits_per_pixel = 0;
+ } else {
+ fb->depth = info->depth;
+ fb->bits_per_pixel = info->cpp[0] * 8;
+ }
+
fb->width = mode_cmd->width;
fb->height = mode_cmd->height;
for (i = 0; i < 4; i++) {
@@ -79,8 +94,6 @@ void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
fb->offsets[i] = mode_cmd->offsets[i];
fb->modifier[i] = mode_cmd->modifier[i];
}
- drm_fb_get_bpp_depth(mode_cmd->pixel_format, &fb->depth,
- &fb->bits_per_pixel);
fb->pixel_format = mode_cmd->pixel_format;
fb->flags = mode_cmd->flags;
}