drm: Store a pointer to drm_format_info under drm_framebuffer
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 18 Nov 2016 19:52:55 +0000 (21:52 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 15 Dec 2016 12:55:29 +0000 (14:55 +0200)
To avoid having to look up the format information struct every time,
let's just store a pointer to it under drm_framebuffer.

v2: Don't populate the fb->format pointer in drm_framebuffer_init().
    instead we'll treat a NULL format as an error later

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Link: http://patchwork.freedesktop.org/patch/msgid/1479498793-31021-20-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/gpu/drm/drm_modeset_helper.c
include/drm/drm_framebuffer.h

index 57a319e3f78087faea7649224796deb4d5e633c0..1aa5e3bcc8a185b32bc6c8d5ec640cc4cf688437 100644 (file)
@@ -91,6 +91,7 @@ void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
        }
 
        fb->dev = dev;
+       fb->format = info;
        fb->width = mode_cmd->width;
        fb->height = mode_cmd->height;
        for (i = 0; i < 4; i++) {
index 1ddfa2928802249f8c5abefb80ed71577bb04c12..a3d2f25230a8d3c0c800f62019c6ab85fdd98149 100644 (file)
@@ -121,6 +121,10 @@ struct drm_framebuffer {
         * @base: base modeset object structure, contains the reference count.
         */
        struct drm_mode_object base;
+       /**
+        * @format: framebuffer format information
+        */
+       const struct drm_format_info *format;
        /**
         * @funcs: framebuffer vfunc table
         */