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

Configure Feed

Select the types of activity you want to include in your feed.

drm/client: Pass force parameter to client restore

Add force parameter to client restore and pass value through the
layers. The only currently used value is false.

If force is true, the client should restore its display even if it
does not hold the DRM master lock. This is be required for emergency
output, such as sysrq.

While at it, inline drm_fb_helper_lastclose(), which is a trivial
wrapper around drm_fb_helper_restore_fbdev_mode_unlocked().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patch.msgid.link/20251110154616.539328-2-tzimmermann@suse.de

+22 -34
+4 -2
drivers/gpu/drm/clients/drm_fbdev_client.c
··· 38 38 } 39 39 } 40 40 41 - static int drm_fbdev_client_restore(struct drm_client_dev *client) 41 + static int drm_fbdev_client_restore(struct drm_client_dev *client, bool force) 42 42 { 43 - drm_fb_helper_lastclose(client->dev); 43 + struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); 44 + 45 + drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, force); 44 46 45 47 return 0; 46 48 }
+2 -2
drivers/gpu/drm/drm_client_event.c
··· 102 102 } 103 103 EXPORT_SYMBOL(drm_client_dev_hotplug); 104 104 105 - void drm_client_dev_restore(struct drm_device *dev) 105 + void drm_client_dev_restore(struct drm_device *dev, bool force) 106 106 { 107 107 struct drm_client_dev *client; 108 108 int ret; ··· 115 115 if (!client->funcs || !client->funcs->restore) 116 116 continue; 117 117 118 - ret = client->funcs->restore(client); 118 + ret = client->funcs->restore(client, force); 119 119 drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); 120 120 if (!ret) /* The first one to return zero gets the privilege to restore */ 121 121 break;
+6 -18
drivers/gpu/drm/drm_fb_helper.c
··· 255 255 /** 256 256 * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration 257 257 * @fb_helper: driver-allocated fbdev helper, can be NULL 258 + * @force: ignore present DRM master 258 259 * 259 260 * This helper should be called from fbdev emulation's &drm_client_funcs.restore 260 261 * callback. It ensures that the user isn't greeted with a black screen when the ··· 264 263 * Returns: 265 264 * 0 on success, or a negative errno code otherwise. 266 265 */ 267 - int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper) 266 + int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper, bool force) 268 267 { 269 - return __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, false); 268 + return __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, force); 270 269 } 271 270 EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked); 272 271 ··· 1329 1328 * the KDSET IOCTL with KD_TEXT, and only after that drops the master 1330 1329 * status when exiting. 1331 1330 * 1332 - * In the past this was caught by drm_fb_helper_lastclose(), but on 1333 - * modern systems where logind always keeps a drm fd open to orchestrate 1334 - * the vt switching, this doesn't work. 1331 + * In the past this was caught by drm_fb_helper_restore_fbdev_mode_unlocked(), 1332 + * but on modern systems where logind always keeps a drm fd open to 1333 + * orchestrate the vt switching, this doesn't work. 1335 1334 * 1336 1335 * To not break the userspace ABI we have this special case here, which 1337 1336 * is only used for the above case. Everything else uses the normal ··· 1956 1955 return 0; 1957 1956 } 1958 1957 EXPORT_SYMBOL(drm_fb_helper_hotplug_event); 1959 - 1960 - /** 1961 - * drm_fb_helper_lastclose - DRM driver lastclose helper for fbdev emulation 1962 - * @dev: DRM device 1963 - * 1964 - * This function is obsolete. Call drm_fb_helper_restore_fbdev_mode_unlocked() 1965 - * instead. 1966 - */ 1967 - void drm_fb_helper_lastclose(struct drm_device *dev) 1968 - { 1969 - drm_fb_helper_restore_fbdev_mode_unlocked(dev->fb_helper); 1970 - } 1971 - EXPORT_SYMBOL(drm_fb_helper_lastclose);
+1 -1
drivers/gpu/drm/drm_file.c
··· 405 405 406 406 static void drm_lastclose(struct drm_device *dev) 407 407 { 408 - drm_client_dev_restore(dev); 408 + drm_client_dev_restore(dev, false); 409 409 410 410 if (dev_is_pci(dev->dev)) 411 411 vga_switcheroo_process_delayed_switch();
+5 -3
include/drm/drm_client.h
··· 57 57 * 58 58 * Note that the core does not guarantee exclusion against concurrent 59 59 * drm_open(). Clients need to ensure this themselves, for example by 60 - * using drm_master_internal_acquire() and 61 - * drm_master_internal_release(). 60 + * using drm_master_internal_acquire() and drm_master_internal_release(). 61 + * 62 + * If the caller passes force, the client should ignore any present DRM 63 + * master and restore the display anyway. 62 64 * 63 65 * This callback is optional. 64 66 */ 65 - int (*restore)(struct drm_client_dev *client); 67 + int (*restore)(struct drm_client_dev *client, bool force); 66 68 67 69 /** 68 70 * @hotplug:
+2 -2
include/drm/drm_client_event.h
··· 10 10 #if defined(CONFIG_DRM_CLIENT) 11 11 void drm_client_dev_unregister(struct drm_device *dev); 12 12 void drm_client_dev_hotplug(struct drm_device *dev); 13 - void drm_client_dev_restore(struct drm_device *dev); 13 + void drm_client_dev_restore(struct drm_device *dev, bool force); 14 14 void drm_client_dev_suspend(struct drm_device *dev); 15 15 void drm_client_dev_resume(struct drm_device *dev); 16 16 #else ··· 18 18 { } 19 19 static inline void drm_client_dev_hotplug(struct drm_device *dev) 20 20 { } 21 - static inline void drm_client_dev_restore(struct drm_device *dev) 21 + static inline void drm_client_dev_restore(struct drm_device *dev, bool force) 22 22 { } 23 23 static inline void drm_client_dev_suspend(struct drm_device *dev) 24 24 { }
+2 -6
include/drm/drm_fb_helper.h
··· 254 254 int drm_fb_helper_check_var(struct fb_var_screeninfo *var, 255 255 struct fb_info *info); 256 256 257 - int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper); 257 + int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper, 258 + bool force); 258 259 259 260 struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper); 260 261 void drm_fb_helper_release_info(struct drm_fb_helper *fb_helper); ··· 284 283 int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper); 285 284 int drm_fb_helper_debug_enter(struct fb_info *info); 286 285 int drm_fb_helper_debug_leave(struct fb_info *info); 287 - void drm_fb_helper_lastclose(struct drm_device *dev); 288 286 #else 289 287 static inline void drm_fb_helper_prepare(struct drm_device *dev, 290 288 struct drm_fb_helper *helper, ··· 408 408 static inline int drm_fb_helper_debug_leave(struct fb_info *info) 409 409 { 410 410 return 0; 411 - } 412 - 413 - static inline void drm_fb_helper_lastclose(struct drm_device *dev) 414 - { 415 411 } 416 412 #endif 417 413