]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/tegra: Move tegra_drm_mode_funcs to the core
authorThierry Reding <treding@nvidia.com>
Wed, 26 Nov 2014 12:03:57 +0000 (13:03 +0100)
committerThierry Reding <treding@nvidia.com>
Tue, 27 Jan 2015 09:14:44 +0000 (10:14 +0100)
This structure will be extended using non-framebuffer related callbacks
in subsequent patches, so it should move to a more central location.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tegra/drm.h
drivers/gpu/drm/tegra/fb.c

index 219f314cc162c0bee55ee797ee96aa21fdb6656f..e29d9146b7c74ca27973b923c9b4eab6558745e3 100644 (file)
@@ -24,6 +24,13 @@ struct tegra_drm_file {
        struct list_head contexts;
 };
 
+static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
+       .fb_create = tegra_fb_create,
+#ifdef CONFIG_DRM_TEGRA_FBDEV
+       .output_poll_changed = tegra_fb_output_poll_changed,
+#endif
+};
+
 static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 {
        struct host1x_device *device = to_host1x_device(drm->dev);
@@ -52,6 +59,14 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 
        drm_mode_config_init(drm);
 
+       drm->mode_config.min_width = 0;
+       drm->mode_config.min_height = 0;
+
+       drm->mode_config.max_width = 4096;
+       drm->mode_config.max_height = 4096;
+
+       drm->mode_config.funcs = &tegra_drm_mode_funcs;
+
        err = tegra_drm_fb_prepare(drm);
        if (err < 0)
                goto config;
index 5a0e96debcb1f6ad207e0b9a324d181f8d02e628..286a970a4432dbd6d294c6f3b5e122be4135d75b 100644 (file)
@@ -292,12 +292,16 @@ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer,
 bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer);
 int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,
                        struct tegra_bo_tiling *tiling);
+struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
+                                       struct drm_file *file,
+                                       struct drm_mode_fb_cmd2 *cmd);
 int tegra_drm_fb_prepare(struct drm_device *drm);
 void tegra_drm_fb_free(struct drm_device *drm);
 int tegra_drm_fb_init(struct drm_device *drm);
 void tegra_drm_fb_exit(struct drm_device *drm);
 #ifdef CONFIG_DRM_TEGRA_FBDEV
 void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev);
+void tegra_fb_output_poll_changed(struct drm_device *drm);
 #endif
 
 extern struct platform_driver tegra_dc_driver;
index e9c715d892614853606c7563c4b335cb300d8c5f..397fb34d5d5bdd842012f0842450b05e9d7139d1 100644 (file)
@@ -129,9 +129,9 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,
        return fb;
 }
 
-static struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
-                                              struct drm_file *file,
-                                              struct drm_mode_fb_cmd2 *cmd)
+struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
+                                       struct drm_file *file,
+                                       struct drm_mode_fb_cmd2 *cmd)
 {
        unsigned int hsub, vsub, i;
        struct tegra_bo *planes[4];
@@ -377,7 +377,7 @@ void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev)
                drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev->base);
 }
 
-static void tegra_fb_output_poll_changed(struct drm_device *drm)
+void tegra_fb_output_poll_changed(struct drm_device *drm)
 {
        struct tegra_drm *tegra = drm->dev_private;
 
@@ -386,28 +386,11 @@ static void tegra_fb_output_poll_changed(struct drm_device *drm)
 }
 #endif
 
-static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
-       .fb_create = tegra_fb_create,
-#ifdef CONFIG_DRM_TEGRA_FBDEV
-       .output_poll_changed = tegra_fb_output_poll_changed,
-#endif
-};
-
 int tegra_drm_fb_prepare(struct drm_device *drm)
 {
 #ifdef CONFIG_DRM_TEGRA_FBDEV
        struct tegra_drm *tegra = drm->dev_private;
-#endif
 
-       drm->mode_config.min_width = 0;
-       drm->mode_config.min_height = 0;
-
-       drm->mode_config.max_width = 4096;
-       drm->mode_config.max_height = 4096;
-
-       drm->mode_config.funcs = &tegra_drm_mode_funcs;
-
-#ifdef CONFIG_DRM_TEGRA_FBDEV
        tegra->fbdev = tegra_fbdev_create(drm);
        if (IS_ERR(tegra->fbdev))
                return PTR_ERR(tegra->fbdev);