]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/fb-helper: Add fill_info() functions
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 26 Mar 2019 13:19:48 +0000 (14:19 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 27 Mar 2019 08:54:57 +0000 (09:54 +0100)
The fbdev split between fix and var information is kinda
pointless for drm drivers since everything is fixed: The fbdev
emulation doesn't support changing modes at all.

Create a new simplified helper and use it in the generic fbdev
helper code. Follow-up patches will beef it up more and roll
it out to all drivers.

v2: We need to keep sizes, since they might not match the fb dimensions
(Noralf)

v3: Fix typo in commit message and remove extraneous line in kerneldoc (Noralf)

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190326132008.11781-1-daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_fb_helper.c
include/drm/drm_fb_helper.h

index d703487dfcf27a7f009aa9adafc45c32b1827131..e80c6a6bba4df6d754862d6e35bd2c8c7c2292b5 100644 (file)
@@ -2105,6 +2105,32 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe
 }
 EXPORT_SYMBOL(drm_fb_helper_fill_var);
 
+/**
+ * drm_fb_helper_fill_info - initializes fbdev information
+ * @info: fbdev instance to set up
+ * @fb_helper: fb helper instance to use as template
+ * @sizes: describes fbdev size and scanout surface size
+ *
+ * Sets up the variable and fixed fbdev metainformation from the given fb helper
+ * instance and the drm framebuffer allocated in &drm_fb_helper.fb.
+ *
+ * Drivers should call this (or their equivalent setup code) from their
+ * &drm_fb_helper_funcs.fb_probe callback after having allocated the fbdev
+ * backing storage framebuffer.
+ */
+void drm_fb_helper_fill_info(struct fb_info *info,
+                            struct drm_fb_helper *fb_helper,
+                            struct drm_fb_helper_surface_size *sizes)
+{
+       struct drm_framebuffer *fb = fb_helper->fb;
+
+       drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
+       drm_fb_helper_fill_var(info, fb_helper,
+                              sizes->fb_width, sizes->fb_height);
+
+}
+EXPORT_SYMBOL(drm_fb_helper_fill_info);
+
 static int drm_fb_helper_probe_connector_modes(struct drm_fb_helper *fb_helper,
                                                uint32_t maxX,
                                                uint32_t maxY)
@@ -3165,8 +3191,7 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
 #endif
        strcpy(fbi->fix.id, "DRM emulated");
 
-       drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->format->depth);
-       drm_fb_helper_fill_var(fbi, fb_helper, sizes->fb_width, sizes->fb_height);
+       drm_fb_helper_fill_info(fbi, fb_helper, sizes);
 
        if (fb->funcs->dirty) {
                struct fb_ops *fbops;
index bb9acea61369396f993a15dae2fc336e2c2b218e..1833e9c5512bbcfa4f0ee610c4c7668364b33c1b 100644 (file)
@@ -292,6 +292,9 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe
                            uint32_t fb_width, uint32_t fb_height);
 void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
                            uint32_t depth);
+void drm_fb_helper_fill_info(struct fb_info *info,
+                            struct drm_fb_helper *fb_helper,
+                            struct drm_fb_helper_surface_size *sizes);
 
 void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper);