summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-11-04 08:07:43 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-04 08:07:43 +0100
commit48bf4bd58f72b0c6a274b286513bc7905d3c1e80 (patch)
tree3c11153ea73a3de79fb033feeefa4690eb4a3b41 /src
parent9b944add91926d0cb8f21ee30f6393df8452e1c3 (diff)
uterm: drm: force immediate modeset during wakeup
We need to call drmModeSetCrtc during wakeup to prepare for page-flips. An immediate modeset is needed, otherwise we cannot be sure the FB/Crtc configuration is still the same. Force an immediate DRM modeset on wakeup to reset the screen. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/uterm_drm_shared.c26
-rw-r--r--src/uterm_drm_shared_internal.h3
2 files changed, 19 insertions, 10 deletions
diff --git a/src/uterm_drm_shared.c b/src/uterm_drm_shared.c
index e3b7d8d..8d1e1be 100644
--- a/src/uterm_drm_shared.c
+++ b/src/uterm_drm_shared.c
@@ -645,7 +645,7 @@ err_unref:
}
int uterm_drm_video_hotplug(struct uterm_video *video,
- bool read_dpms)
+ bool read_dpms, bool modeset)
{
struct uterm_drm_video *vdrm = video->data;
drmModeRes *res;
@@ -689,15 +689,23 @@ int uterm_drm_video_hotplug(struct uterm_video *video,
continue;
disp->flags |= DISPLAY_AVAILABLE;
- if (!read_dpms || !display_is_online(disp))
+ if (!display_is_online(disp))
break;
- dpms = uterm_drm_get_dpms(vdrm->fd, conn);
- if (dpms != disp->dpms) {
- log_debug("DPMS state for display %p changed",
- disp);
- uterm_drm_display_set_dpms(disp, disp->dpms);
+ if (read_dpms) {
+ dpms = uterm_drm_get_dpms(vdrm->fd, conn);
+ if (dpms != disp->dpms) {
+ log_debug("DPMS state for display %p changed",
+ disp);
+ uterm_drm_display_set_dpms(disp, disp->dpms);
+ }
}
+
+ if (modeset) {
+ log_debug("re-activate display %p", disp);
+ uterm_display_swap(disp, true);
+ }
+
break;
}
@@ -731,7 +739,7 @@ int uterm_drm_video_wake_up(struct uterm_video *video)
}
video->flags |= VIDEO_AWAKE | VIDEO_HOTPLUG;
- ret = uterm_drm_video_hotplug(video, true);
+ ret = uterm_drm_video_hotplug(video, true, true);
if (ret) {
drmDropMaster(vdrm->fd);
return ret;
@@ -752,7 +760,7 @@ void uterm_drm_video_sleep(struct uterm_video *video)
int uterm_drm_video_poll(struct uterm_video *video)
{
video->flags |= VIDEO_HOTPLUG;
- return uterm_drm_video_hotplug(video, false);
+ return uterm_drm_video_hotplug(video, false, false);
}
/* Waits for events on DRM fd for \mtimeout milliseconds and returns 0 if the
diff --git a/src/uterm_drm_shared_internal.h b/src/uterm_drm_shared_internal.h
index c2191e6..56a56ff 100644
--- a/src/uterm_drm_shared_internal.h
+++ b/src/uterm_drm_shared_internal.h
@@ -108,7 +108,8 @@ int uterm_drm_video_init(struct uterm_video *video, const char *node,
void uterm_drm_video_destroy(struct uterm_video *video);
int uterm_drm_video_find_crtc(struct uterm_video *video, drmModeRes *res,
drmModeEncoder *enc);
-int uterm_drm_video_hotplug(struct uterm_video *video, bool read_dpms);
+int uterm_drm_video_hotplug(struct uterm_video *video, bool read_dpms,
+ bool modeset);
int uterm_drm_video_wake_up(struct uterm_video *video);
void uterm_drm_video_sleep(struct uterm_video *video);
int uterm_drm_video_poll(struct uterm_video *video);