Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/cma-helper: Remove unused fbdev code

CMA helper drivers have been converted to drm_fbdev_generic_setup()
so the fbdev code can be removed.

v3: Remove CMA specific conditional in the generic fbdev client

v2: Clean up the includes some more (Laurent)

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190114121059.20704-1-noralf@tronnes.org

+4 -171
-4
drivers/gpu/drm/Kconfig
··· 170 170 bool 171 171 depends on DRM 172 172 select DRM_GEM_CMA_HELPER 173 - select DRM_KMS_FB_HELPER 174 - select FB_SYS_FILLRECT 175 - select FB_SYS_COPYAREA 176 - select FB_SYS_IMAGEBLIT 177 173 help 178 174 Choose this if you need the KMS CMA helper functions 179 175
+2 -135
drivers/gpu/drm/drm_fb_cma_helper.c
··· 17 17 * GNU General Public License for more details. 18 18 */ 19 19 20 - #include <drm/drmP.h> 21 - #include <drm/drm_client.h> 22 - #include <drm/drm_fb_helper.h> 20 + #include <drm/drm_fourcc.h> 23 21 #include <drm/drm_framebuffer.h> 24 22 #include <drm/drm_gem_cma_helper.h> 25 23 #include <drm/drm_gem_framebuffer_helper.h> 26 - #include <drm/drm_fb_cma_helper.h> 27 - #include <drm/drm_print.h> 24 + #include <drm/drm_plane.h> 28 25 #include <linux/module.h> 29 - 30 - struct drm_fbdev_cma { 31 - struct drm_fb_helper fb_helper; 32 - }; 33 26 34 27 /** 35 28 * DOC: framebuffer cma helper functions ··· 32 39 * 33 40 * drm_gem_fb_create() is used in the &drm_mode_config_funcs.fb_create 34 41 * callback function to create a cma backed framebuffer. 35 - * 36 - * An fbdev framebuffer backed by cma is also available by calling 37 - * drm_fb_cma_fbdev_init(). drm_fb_cma_fbdev_fini() tears it down. 38 42 */ 39 - 40 - static inline struct drm_fbdev_cma *to_fbdev_cma(struct drm_fb_helper *helper) 41 - { 42 - return container_of(helper, struct drm_fbdev_cma, fb_helper); 43 - } 44 43 45 44 /** 46 45 * drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer ··· 104 119 return paddr; 105 120 } 106 121 EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr); 107 - 108 - /** 109 - * drm_fb_cma_fbdev_init() - Allocate and initialize fbdev emulation 110 - * @dev: DRM device 111 - * @preferred_bpp: Preferred bits per pixel for the device. 112 - * @dev->mode_config.preferred_depth is used if this is zero. 113 - * @max_conn_count: Maximum number of connectors. 114 - * @dev->mode_config.num_connector is used if this is zero. 115 - * 116 - * Returns: 117 - * Zero on success or negative error code on failure. 118 - */ 119 - int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp, 120 - unsigned int max_conn_count) 121 - { 122 - struct drm_fbdev_cma *fbdev_cma; 123 - 124 - /* dev->fb_helper will indirectly point to fbdev_cma after this call */ 125 - fbdev_cma = drm_fbdev_cma_init(dev, preferred_bpp, max_conn_count); 126 - return PTR_ERR_OR_ZERO(fbdev_cma); 127 - } 128 - EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init); 129 - 130 - /** 131 - * drm_fb_cma_fbdev_fini() - Teardown fbdev emulation 132 - * @dev: DRM device 133 - */ 134 - void drm_fb_cma_fbdev_fini(struct drm_device *dev) 135 - { 136 - if (dev->fb_helper) 137 - drm_fbdev_cma_fini(to_fbdev_cma(dev->fb_helper)); 138 - } 139 - EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini); 140 - 141 - static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = { 142 - .fb_probe = drm_fb_helper_generic_probe, 143 - }; 144 - 145 - /** 146 - * drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct 147 - * @dev: DRM device 148 - * @preferred_bpp: Preferred bits per pixel for the device 149 - * @max_conn_count: Maximum number of connectors 150 - * 151 - * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. 152 - */ 153 - struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev, 154 - unsigned int preferred_bpp, unsigned int max_conn_count) 155 - { 156 - struct drm_fbdev_cma *fbdev_cma; 157 - struct drm_fb_helper *fb_helper; 158 - int ret; 159 - 160 - fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL); 161 - if (!fbdev_cma) 162 - return ERR_PTR(-ENOMEM); 163 - 164 - fb_helper = &fbdev_cma->fb_helper; 165 - 166 - ret = drm_client_init(dev, &fb_helper->client, "fbdev", NULL); 167 - if (ret) 168 - goto err_free; 169 - 170 - ret = drm_fb_helper_fbdev_setup(dev, fb_helper, &drm_fb_cma_helper_funcs, 171 - preferred_bpp, max_conn_count); 172 - if (ret) 173 - goto err_client_put; 174 - 175 - drm_client_add(&fb_helper->client); 176 - 177 - return fbdev_cma; 178 - 179 - err_client_put: 180 - drm_client_release(&fb_helper->client); 181 - err_free: 182 - kfree(fbdev_cma); 183 - 184 - return ERR_PTR(ret); 185 - } 186 - EXPORT_SYMBOL_GPL(drm_fbdev_cma_init); 187 - 188 - /** 189 - * drm_fbdev_cma_fini() - Free drm_fbdev_cma struct 190 - * @fbdev_cma: The drm_fbdev_cma struct 191 - */ 192 - void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma) 193 - { 194 - drm_fb_helper_unregister_fbi(&fbdev_cma->fb_helper); 195 - /* All resources have now been freed by drm_fbdev_fb_destroy() */ 196 - } 197 - EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini); 198 - 199 - /** 200 - * drm_fbdev_cma_restore_mode() - Restores initial framebuffer mode 201 - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL 202 - * 203 - * This function is usually called from the &drm_driver.lastclose callback. 204 - */ 205 - void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma) 206 - { 207 - if (fbdev_cma) 208 - drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev_cma->fb_helper); 209 - } 210 - EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode); 211 - 212 - /** 213 - * drm_fbdev_cma_hotplug_event() - Poll for hotpulug events 214 - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL 215 - * 216 - * This function is usually called from the &drm_mode_config.output_poll_changed 217 - * callback. 218 - */ 219 - void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma) 220 - { 221 - if (fbdev_cma) 222 - drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper); 223 - } 224 - EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
+2 -10
drivers/gpu/drm/drm_fb_helper.c
··· 3042 3042 static void drm_fbdev_release(struct drm_fb_helper *fb_helper) 3043 3043 { 3044 3044 drm_fbdev_cleanup(fb_helper); 3045 - 3046 - /* 3047 - * FIXME: 3048 - * Remove conditional when all CMA drivers have been moved over to using 3049 - * drm_fbdev_generic_setup(). 3050 - */ 3051 - if (fb_helper->client.funcs) { 3052 - drm_client_release(&fb_helper->client); 3053 - kfree(fb_helper); 3054 - } 3045 + drm_client_release(&fb_helper->client); 3046 + kfree(fb_helper); 3055 3047 } 3056 3048 3057 3049 /*
-22
include/drm/drm_fb_cma_helper.h
··· 2 2 #ifndef __DRM_FB_CMA_HELPER_H__ 3 3 #define __DRM_FB_CMA_HELPER_H__ 4 4 5 - struct drm_fbdev_cma; 6 - struct drm_gem_cma_object; 7 - 8 - struct drm_fb_helper_surface_size; 9 - struct drm_framebuffer_funcs; 10 - struct drm_fb_helper_funcs; 11 5 struct drm_framebuffer; 12 - struct drm_fb_helper; 13 - struct drm_device; 14 - struct drm_file; 15 - struct drm_mode_fb_cmd2; 16 - struct drm_plane; 17 6 struct drm_plane_state; 18 - 19 - int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp, 20 - unsigned int max_conn_count); 21 - void drm_fb_cma_fbdev_fini(struct drm_device *dev); 22 - 23 - struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev, 24 - unsigned int preferred_bpp, unsigned int max_conn_count); 25 - void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma); 26 - 27 - void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma); 28 - void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma); 29 7 30 8 struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, 31 9 unsigned int plane);