@@ -65,15 +65,6 @@ static const struct fb_ops drm_fbdev_ttm_fb_ops = {
6565 .fb_destroy = drm_fbdev_ttm_fb_destroy ,
6666};
6767
68- /*
69- * This function uses the client API to create a framebuffer backed by a dumb buffer.
70- */
71- static int drm_fbdev_ttm_helper_fb_probe (struct drm_fb_helper * fb_helper ,
72- struct drm_fb_helper_surface_size * sizes )
73- {
74- return drm_fbdev_ttm_driver_fbdev_probe (fb_helper , sizes );
75- }
76-
7768static void drm_fbdev_ttm_damage_blit_real (struct drm_fb_helper * fb_helper ,
7869 struct drm_clip_rect * clip ,
7970 struct iosys_map * dst )
@@ -172,7 +163,6 @@ static int drm_fbdev_ttm_helper_fb_dirty(struct drm_fb_helper *helper,
172163}
173164
174165static const struct drm_fb_helper_funcs drm_fbdev_ttm_helper_funcs = {
175- .fb_probe = drm_fbdev_ttm_helper_fb_probe ,
176166 .fb_dirty = drm_fbdev_ttm_helper_fb_dirty ,
177167};
178168
@@ -251,112 +241,3 @@ int drm_fbdev_ttm_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
251241 return ret ;
252242}
253243EXPORT_SYMBOL (drm_fbdev_ttm_driver_fbdev_probe );
254-
255- static void drm_fbdev_ttm_client_unregister (struct drm_client_dev * client )
256- {
257- struct drm_fb_helper * fb_helper = drm_fb_helper_from_client (client );
258-
259- if (fb_helper -> info ) {
260- drm_fb_helper_unregister_info (fb_helper );
261- } else {
262- drm_client_release (& fb_helper -> client );
263- drm_fb_helper_unprepare (fb_helper );
264- kfree (fb_helper );
265- }
266- }
267-
268- static int drm_fbdev_ttm_client_restore (struct drm_client_dev * client )
269- {
270- drm_fb_helper_lastclose (client -> dev );
271-
272- return 0 ;
273- }
274-
275- static int drm_fbdev_ttm_client_hotplug (struct drm_client_dev * client )
276- {
277- struct drm_fb_helper * fb_helper = drm_fb_helper_from_client (client );
278- struct drm_device * dev = client -> dev ;
279- int ret ;
280-
281- if (dev -> fb_helper )
282- return drm_fb_helper_hotplug_event (dev -> fb_helper );
283-
284- ret = drm_fb_helper_init (dev , fb_helper );
285- if (ret )
286- goto err_drm_err ;
287-
288- if (!drm_drv_uses_atomic_modeset (dev ))
289- drm_helper_disable_unused_functions (dev );
290-
291- ret = drm_fb_helper_initial_config (fb_helper );
292- if (ret )
293- goto err_drm_fb_helper_fini ;
294-
295- return 0 ;
296-
297- err_drm_fb_helper_fini :
298- drm_fb_helper_fini (fb_helper );
299- err_drm_err :
300- drm_err (dev , "fbdev: Failed to setup emulation (ret=%d)\n" , ret );
301- return ret ;
302- }
303-
304- static const struct drm_client_funcs drm_fbdev_ttm_client_funcs = {
305- .owner = THIS_MODULE ,
306- .unregister = drm_fbdev_ttm_client_unregister ,
307- .restore = drm_fbdev_ttm_client_restore ,
308- .hotplug = drm_fbdev_ttm_client_hotplug ,
309- };
310-
311- /**
312- * drm_fbdev_ttm_setup() - Setup fbdev emulation for TTM-based drivers
313- * @dev: DRM device
314- * @preferred_bpp: Preferred bits per pixel for the device.
315- *
316- * This function sets up fbdev emulation for TTM-based drivers that support
317- * dumb buffers with a virtual address and that can be mmap'ed.
318- * drm_fbdev_ttm_setup() shall be called after the DRM driver registered
319- * the new DRM device with drm_dev_register().
320- *
321- * Restore, hotplug events and teardown are all taken care of. Drivers that do
322- * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
323- * Simple drivers might use drm_mode_config_helper_suspend().
324- *
325- * In order to provide fixed mmap-able memory ranges, fbdev emulation
326- * uses a shadow buffer in system memory. The implementation blits the shadow
327- * fbdev buffer onto the real buffer in regular intervals.
328- *
329- * This function is safe to call even when there are no connectors present.
330- * Setup will be retried on the next hotplug event.
331- *
332- * The fbdev is destroyed by drm_dev_unregister().
333- */
334- void drm_fbdev_ttm_setup (struct drm_device * dev , unsigned int preferred_bpp )
335- {
336- struct drm_fb_helper * fb_helper ;
337- int ret ;
338-
339- drm_WARN (dev , !dev -> registered , "Device has not been registered.\n" );
340- drm_WARN (dev , dev -> fb_helper , "fb_helper is already set!\n" );
341-
342- fb_helper = kzalloc (sizeof (* fb_helper ), GFP_KERNEL );
343- if (!fb_helper )
344- return ;
345- drm_fb_helper_prepare (dev , fb_helper , preferred_bpp , & drm_fbdev_ttm_helper_funcs );
346-
347- ret = drm_client_init (dev , & fb_helper -> client , "fbdev" , & drm_fbdev_ttm_client_funcs );
348- if (ret ) {
349- drm_err (dev , "Failed to register client: %d\n" , ret );
350- goto err_drm_client_init ;
351- }
352-
353- drm_client_register (& fb_helper -> client );
354-
355- return ;
356-
357- err_drm_client_init :
358- drm_fb_helper_unprepare (fb_helper );
359- kfree (fb_helper );
360- return ;
361- }
362- EXPORT_SYMBOL (drm_fbdev_ttm_setup );
0 commit comments