History

drm/sun4i: Use drm_fbdev_generic_setup()

The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing.

Noralf Trønnes committed 8 years ago

Commit 94ebfc01 parent da6a5123 files · +5 −22Browse files

Unified · Split

3 files
  1. drivers/gpu/drm/sun4i/sun4i_drv.c +3 −9
  2. drivers/gpu/drm/sun4i/sun4i_framebuffer.c +1 −11
  3. drivers/gpu/drm/sun4i/sun4i_framebuffer.h +1 −2
drivers/gpu/drm/sun4i/sun4i_drv.c+3−9
@@ -34,7 +34,6 @@ static struct drm_driver sun4i_drv_driver = { · 33 unmodified lines
3434 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC,
3535
3636 /* Generic Operations */
37− .lastclose = drm_fb_helper_lastclose,
3837 .fops = &sun4i_drv_fops,
3938 .name = "sun4i-drm",
4039 .desc = "Allwinner sun4i Display Engine",
@@ -105,12 +104,7 @@ static int sun4i_drv_bind(struct device *dev) · 64 unmodified lines
105104 /* Remove early framebuffers (ie. simplefb) */
106105 drm_fb_helper_remove_conflicting_framebuffers(NULL, "sun4i-drm-fb", false);
107106
108− /* Create our framebuffer */
109− ret = sun4i_framebuffer_init(drm);
110− if (ret) {
111− dev_err(drm->dev, "Couldn't create our framebuffer\n");
112− goto cleanup_mode_config;
113− }
107+ sun4i_framebuffer_init(drm);
114108
115109 /* Enable connectors polling */
116110 drm_kms_helper_poll_init(drm);
@@ -119,11 +113,12 @@ static int sun4i_drv_bind(struct device *dev) · 2 unmodified lines
119113 if (ret)
120114 goto finish_poll;
121115
116+ drm_fbdev_generic_setup(drm, 32);
117+
122118 return 0;
123119
124120 finish_poll:
125121 drm_kms_helper_poll_fini(drm);
126− sun4i_framebuffer_free(drm);
127122 cleanup_mode_config:
128123 drm_mode_config_cleanup(drm);
129124 of_reserved_mem_device_release(dev);
@@ -138,7 +133,6 @@ static void sun4i_drv_unbind(struct device *dev) · 8 unmodified lines
138133
139134 drm_dev_unregister(drm);
140135 drm_kms_helper_poll_fini(drm);
141− sun4i_framebuffer_free(drm);
142136 drm_mode_config_cleanup(drm);
143137 of_reserved_mem_device_release(dev);
144138 drm_dev_put(drm);
drivers/gpu/drm/sun4i/sun4i_framebuffer.c+1−11
@@ -12,8 +12,6 @@ · 11 unmodified lines
1212
1313 #include <drm/drm_atomic.h>
1414 #include <drm/drm_atomic_helper.h>
15−#include <drm/drm_fb_helper.h>
16−#include <drm/drm_fb_cma_helper.h>
1715 #include <drm/drm_gem_framebuffer_helper.h>
1816 #include <drm/drmP.h>
1917
@@ -37,7 +35,6 @@ static int sun4i_de_atomic_check(struct drm_device *dev, · 17 unmodified lines
3735 }
3836
3937 static const struct drm_mode_config_funcs sun4i_de_mode_config_funcs = {
40− .output_poll_changed = drm_fb_helper_output_poll_changed,
4138 .atomic_check = sun4i_de_atomic_check,
4239 .atomic_commit = drm_atomic_helper_commit,
4340 .fb_create = drm_gem_fb_create,
@@ -47,7 +44,7 @@ static struct drm_mode_config_helper_funcs sun4i_de_mode_config_helpers = { · 3 unmodified lines
4744 .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
4845 };
4946
50−int sun4i_framebuffer_init(struct drm_device *drm)
47+void sun4i_framebuffer_init(struct drm_device *drm)
5148 {
5249 drm_mode_config_reset(drm);
5350
@@ -56,11 +53,4 @@ int sun4i_framebuffer_init(struct drm_device *drm) · 2 unmodified lines
5653
5754 drm->mode_config.funcs = &sun4i_de_mode_config_funcs;
5855 drm->mode_config.helper_private = &sun4i_de_mode_config_helpers;
59−
60− return drm_fb_cma_fbdev_init(drm, 32, 0);
61−}
62−
63−void sun4i_framebuffer_free(struct drm_device *drm)
64−{
65− drm_fb_cma_fbdev_fini(drm);
6656 }
drivers/gpu/drm/sun4i/sun4i_framebuffer.h+1−2
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313 #ifndef _SUN4I_FRAMEBUFFER_H_
1414 #define _SUN4I_FRAMEBUFFER_H_
1515
16−int sun4i_framebuffer_init(struct drm_device *drm);
17−void sun4i_framebuffer_free(struct drm_device *drm);
16+void sun4i_framebuffer_init(struct drm_device *drm);
1817
1918 #endif /* _SUN4I_FRAMEBUFFER_H_ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t