xf86/logind: Fix drm_drop_master before vt_reldisp
When switching to VT, the ioctl DRM_DROP_MASTER must be done before the ioctl VT_RELDISP. Otherwise the kernel can't change the modesetting reliably, and this leads to the console not showing up in some cases, like after unplugging a docking station with a DP or HDMI monitor. Before doing the VT_RELDISP, send a dbus message to logind, to pause the drm device, so logind will do the ioctl DRM_DROP_MASTER. With this patch, it changes the order logind will send the resume event, and drm will be sent last instead of first. so there is a also fix to call systemd_logind_vtenter() at the right time. Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
f5bd039633
commit
da9d012a9c
|
@ -382,6 +382,17 @@ xf86VTLeave(void)
|
||||||
for (i = 0; i < xf86NumGPUScreens; i++)
|
for (i = 0; i < xf86NumGPUScreens; i++)
|
||||||
xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
|
xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
|
||||||
|
|
||||||
|
if (systemd_logind_controls_session()) {
|
||||||
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
||||||
|
if (xf86_platform_devices[i].flags & XF86_PDEV_SERVER_FD) {
|
||||||
|
int major, minor;
|
||||||
|
major = xf86_platform_odev_attributes(i)->major;
|
||||||
|
minor = xf86_platform_odev_attributes(i)->minor;
|
||||||
|
systemd_logind_drop_master(major, minor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!xf86VTSwitchAway())
|
if (!xf86VTSwitchAway())
|
||||||
goto switch_failed;
|
goto switch_failed;
|
||||||
|
|
||||||
|
|
|
@ -303,6 +303,20 @@ cleanup:
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send a message to logind, to pause the drm device
|
||||||
|
* and ensure the drm_drop_master is done before
|
||||||
|
* VT_RELDISP when switching VT
|
||||||
|
*/
|
||||||
|
void systemd_logind_drop_master(int _major, int _minor)
|
||||||
|
{
|
||||||
|
struct systemd_logind_info *info = &logind_info;
|
||||||
|
dbus_int32_t major = _major;
|
||||||
|
dbus_int32_t minor = _minor;
|
||||||
|
|
||||||
|
systemd_logind_ack_pause(info, minor, major);
|
||||||
|
}
|
||||||
|
|
||||||
static DBusHandlerResult
|
static DBusHandlerResult
|
||||||
message_filter(DBusConnection * connection, DBusMessage * message, void *data)
|
message_filter(DBusConnection * connection, DBusMessage * message, void *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus);
|
||||||
void systemd_logind_release_fd(int major, int minor, int fd);
|
void systemd_logind_release_fd(int major, int minor, int fd);
|
||||||
int systemd_logind_controls_session(void);
|
int systemd_logind_controls_session(void);
|
||||||
void systemd_logind_vtenter(void);
|
void systemd_logind_vtenter(void);
|
||||||
|
void systemd_logind_drop_master(int major, int minor);
|
||||||
#else
|
#else
|
||||||
#define systemd_logind_init()
|
#define systemd_logind_init()
|
||||||
#define systemd_logind_fini()
|
#define systemd_logind_fini()
|
||||||
|
@ -40,6 +41,7 @@ void systemd_logind_vtenter(void);
|
||||||
#define systemd_logind_release_fd(major, minor, fd) close(fd)
|
#define systemd_logind_release_fd(major, minor, fd) close(fd)
|
||||||
#define systemd_logind_controls_session() 0
|
#define systemd_logind_controls_session() 0
|
||||||
#define systemd_logind_vtenter()
|
#define systemd_logind_vtenter()
|
||||||
|
#define systemd_logind_drop_master(major, minor)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue