]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/drm/drm_modeset_helper.c
drm/i915: Fallback to single PAGE_SIZE segments for DMA remapping
[karo-tx-linux.git] / drivers / gpu / drm / drm_modeset_helper.c
index 1d45738f8f980ba1767a5696a6ae8bf879ef0d09..2f452b3dd40e154c94c35ed76a14201cb7804051 100644 (file)
@@ -70,8 +70,24 @@ 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) {
+               struct drm_format_name_buf format_name;
+
+               DRM_DEBUG_KMS("non-RGB pixel format %s\n",
+                             drm_get_format_name(mode_cmd->pixel_format,
+                                                 &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 +95,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;
 }