|
@@ -70,8 +70,23 @@ EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
|
|
void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
|
|
void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
|
|
const struct drm_mode_fb_cmd2 *mode_cmd)
|
|
const struct drm_mode_fb_cmd2 *mode_cmd)
|
|
{
|
|
{
|
|
|
|
+ const struct drm_format_info *info;
|
|
int i;
|
|
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->width = mode_cmd->width;
|
|
fb->height = mode_cmd->height;
|
|
fb->height = mode_cmd->height;
|
|
for (i = 0; i < 4; i++) {
|
|
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->offsets[i] = mode_cmd->offsets[i];
|
|
fb->modifier[i] = mode_cmd->modifier[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->pixel_format = mode_cmd->pixel_format;
|
|
fb->flags = mode_cmd->flags;
|
|
fb->flags = mode_cmd->flags;
|
|
}
|
|
}
|