"Allow unsafe leaking fbdev physical smem address [default=false]");
#endif
-static LIST_HEAD(kernel_fb_helper_list);
-static DEFINE_MUTEX(kernel_fb_helper_lock);
-
/**
* DOC: fbdev helpers
*
* mmap page writes.
*/
-static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
-{
- uint16_t *r_base, *g_base, *b_base;
-
- if (crtc->funcs->gamma_set == NULL)
- return;
-
- r_base = crtc->gamma_store;
- g_base = r_base + crtc->gamma_size;
- b_base = g_base + crtc->gamma_size;
-
- crtc->funcs->gamma_set(crtc, r_base, g_base, b_base,
- crtc->gamma_size, NULL);
-}
-
-/**
- * drm_fb_helper_debug_enter - implementation for &fb_ops.fb_debug_enter
- * @info: fbdev registered by the helper
- */
-int drm_fb_helper_debug_enter(struct fb_info *info)
-{
- struct drm_fb_helper *helper = info->par;
- const struct drm_crtc_helper_funcs *funcs;
- struct drm_mode_set *mode_set;
-
- list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
- mutex_lock(&helper->client.modeset_mutex);
- drm_client_for_each_modeset(mode_set, &helper->client) {
- if (!mode_set->crtc->enabled)
- continue;
-
- funcs = mode_set->crtc->helper_private;
- if (funcs->mode_set_base_atomic == NULL)
- continue;
-
- if (drm_drv_uses_atomic_modeset(mode_set->crtc->dev))
- continue;
-
- funcs->mode_set_base_atomic(mode_set->crtc,
- mode_set->fb,
- mode_set->x,
- mode_set->y,
- ENTER_ATOMIC_MODE_SET);
- }
- mutex_unlock(&helper->client.modeset_mutex);
- }
-
- return 0;
-}
-EXPORT_SYMBOL(drm_fb_helper_debug_enter);
-
-/**
- * drm_fb_helper_debug_leave - implementation for &fb_ops.fb_debug_leave
- * @info: fbdev registered by the helper
- */
-int drm_fb_helper_debug_leave(struct fb_info *info)
-{
- struct drm_fb_helper *helper = info->par;
- struct drm_client_dev *client = &helper->client;
- struct drm_device *dev = helper->dev;
- struct drm_crtc *crtc;
- const struct drm_crtc_helper_funcs *funcs;
- struct drm_mode_set *mode_set;
- struct drm_framebuffer *fb;
-
- mutex_lock(&client->modeset_mutex);
- drm_client_for_each_modeset(mode_set, client) {
- crtc = mode_set->crtc;
- if (drm_drv_uses_atomic_modeset(crtc->dev))
- continue;
-
- funcs = crtc->helper_private;
- fb = crtc->primary->fb;
-
- if (!crtc->enabled)
- continue;
-
- if (!fb) {
- drm_err(dev, "no fb to restore?\n");
- continue;
- }
-
- if (funcs->mode_set_base_atomic == NULL)
- continue;
-
- drm_fb_helper_restore_lut_atomic(mode_set->crtc);
- funcs->mode_set_base_atomic(mode_set->crtc, fb, crtc->x,
- crtc->y, LEAVE_ATOMIC_MODE_SET);
- }
- mutex_unlock(&client->modeset_mutex);
-
- return 0;
-}
-EXPORT_SYMBOL(drm_fb_helper_debug_leave);
-
static int
__drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper,
bool force)
if (!preferred_bpp)
preferred_bpp = 32;
- INIT_LIST_HEAD(&helper->kernel_fb_list);
spin_lock_init(&helper->damage_lock);
INIT_WORK(&helper->resume_work, drm_fb_helper_resume_worker);
INIT_WORK(&helper->damage_work, drm_fb_helper_damage_work);
drm_fb_helper_release_info(fb_helper);
- mutex_lock(&kernel_fb_helper_lock);
- if (!list_empty(&fb_helper->kernel_fb_list))
- list_del(&fb_helper->kernel_fb_list);
- mutex_unlock(&kernel_fb_helper_lock);
-
if (!fb_helper->client.funcs)
drm_client_release(&fb_helper->client);
}
drm_info(dev, "fb%d: %s frame buffer device\n",
info->node, info->fix.id);
- mutex_lock(&kernel_fb_helper_lock);
- list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list);
- mutex_unlock(&kernel_fb_helper_lock);
-
return 0;
err_drm_fb_helper_release_info:
*/
struct mutex lock;
- /**
- * @kernel_fb_list:
- *
- * Entry on the global kernel_fb_helper_list, used for kgdb entry/exit.
- */
- struct list_head kernel_fb_list;
-
/**
* @delayed_hotplug:
*
.fb_setcmap = drm_fb_helper_setcmap, \
.fb_blank = drm_fb_helper_blank, \
.fb_pan_display = drm_fb_helper_pan_display, \
- .fb_debug_enter = drm_fb_helper_debug_enter, \
- .fb_debug_leave = drm_fb_helper_debug_leave, \
.fb_ioctl = drm_fb_helper_ioctl
#ifdef CONFIG_DRM_FBDEV_EMULATION
int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper);
-int drm_fb_helper_debug_enter(struct fb_info *info);
-int drm_fb_helper_debug_leave(struct fb_info *info);
#else
static inline void drm_fb_helper_prepare(struct drm_device *dev,
struct drm_fb_helper *helper,
{
return 0;
}
-
-static inline int drm_fb_helper_debug_enter(struct fb_info *info)
-{
- return 0;
-}
-
-static inline int drm_fb_helper_debug_leave(struct fb_info *info)
-{
- return 0;
-}
#endif
#endif
struct drm_writeback_connector;
struct drm_writeback_job;
-enum mode_set_atomic {
- LEAVE_ATOMIC_MODE_SET,
- ENTER_ATOMIC_MODE_SET,
-};
-
/**
* struct drm_crtc_helper_funcs - helper operations for CRTCs
*
int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
struct drm_framebuffer *old_fb);
- /**
- * @mode_set_base_atomic:
- *
- * This callback is used by the fbdev helpers to set a new framebuffer
- * and scanout without sleeping, i.e. from an atomic calling context. It
- * is only used to implement kgdb support.
- *
- * This callback is optional and only needed for kgdb support in the fbdev
- * helpers.
- *
- * RETURNS:
- *
- * 0 on success or a negative error code on failure.
- */
- int (*mode_set_base_atomic)(struct drm_crtc *crtc,
- struct drm_framebuffer *fb, int x, int y,
- enum mode_set_atomic);
-
/**
* @disable:
*