uterm: clear displays during sleep and wakeup
We shouldn't leave the content on the framebuffers when leaving kmscon. This might confuse the user. Furthermore, we shouldn't reload the old framebuffer during wakeup as this frame can be quite old and we see a short flickering during wakeup which isn't wanted, either. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
9a70af0ecc
commit
5442e5f903
@ -876,9 +876,12 @@ static void show_displays(struct uterm_video *video)
|
||||
{
|
||||
int ret;
|
||||
struct uterm_display *iter;
|
||||
struct drm_rb *rb;
|
||||
|
||||
if (!video_is_awake(video))
|
||||
return;
|
||||
if (video_do_use(video))
|
||||
return;
|
||||
|
||||
for (iter = video->displays; iter; iter = iter->next) {
|
||||
if (!display_is_online(iter))
|
||||
@ -886,9 +889,24 @@ static void show_displays(struct uterm_video *video)
|
||||
if (iter->dpms != UTERM_DPMS_ON)
|
||||
continue;
|
||||
|
||||
rb = &iter->drm.rb[iter->drm.current_rb];
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, iter->drm.fb);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, rb->rb);
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) !=
|
||||
GL_FRAMEBUFFER_COMPLETE) {
|
||||
log_warn("cannot set gl-renderbuffer");
|
||||
continue;
|
||||
}
|
||||
|
||||
glClearColor(0, 0, 0, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glFinish();
|
||||
|
||||
ret = drmModeSetCrtc(video->drm.fd, iter->drm.crtc_id,
|
||||
iter->drm.rb[iter->drm.current_rb].fb, 0, 0,
|
||||
&iter->drm.conn_id, 1, &iter->current_mode->drm.info);
|
||||
rb->fb, 0, 0, &iter->drm.conn_id, 1,
|
||||
&iter->current_mode->drm.info);
|
||||
if (ret) {
|
||||
log_err("cannot set drm-crtc on display %p", iter);
|
||||
continue;
|
||||
@ -1236,6 +1254,7 @@ static void video_sleep(struct uterm_video *video)
|
||||
if (!video_is_awake(video))
|
||||
return;
|
||||
|
||||
show_displays(video);
|
||||
drmDropMaster(video->drm.fd);
|
||||
video->flags &= ~VIDEO_AWAKE;
|
||||
}
|
||||
|
@ -626,6 +626,7 @@ static void show_displays(struct uterm_video *video)
|
||||
{
|
||||
int ret;
|
||||
struct uterm_display *iter;
|
||||
struct dumb_rb *rb;
|
||||
|
||||
if (!video_is_awake(video))
|
||||
return;
|
||||
@ -636,9 +637,11 @@ static void show_displays(struct uterm_video *video)
|
||||
if (iter->dpms != UTERM_DPMS_ON)
|
||||
continue;
|
||||
|
||||
rb = &iter->dumb.rb[iter->dumb.current_rb];
|
||||
memset(rb->map, 0, rb->size);
|
||||
ret = drmModeSetCrtc(video->dumb.fd, iter->dumb.crtc_id,
|
||||
iter->dumb.rb[iter->dumb.current_rb].fb, 0, 0,
|
||||
&iter->dumb.conn_id, 1, &iter->current_mode->dumb.info);
|
||||
rb->fb, 0, 0, &iter->dumb.conn_id, 1,
|
||||
&iter->current_mode->dumb.info);
|
||||
if (ret) {
|
||||
log_err("cannot set drm-crtc on display %p", iter);
|
||||
continue;
|
||||
@ -896,6 +899,7 @@ static void video_sleep(struct uterm_video *video)
|
||||
if (!video_is_awake(video))
|
||||
return;
|
||||
|
||||
show_displays(video);
|
||||
drmDropMaster(video->dumb.fd);
|
||||
video->flags &= ~VIDEO_AWAKE;
|
||||
}
|
||||
|
@ -305,6 +305,7 @@ static void display_deactivate_force(struct uterm_display *disp, bool force)
|
||||
uterm_mode_unref(disp->current_mode);
|
||||
disp->modes = NULL;
|
||||
disp->current_mode = NULL;
|
||||
memset(disp->fbdev.map, 0, disp->fbdev.len);
|
||||
munmap(disp->fbdev.map, disp->fbdev.len);
|
||||
|
||||
if (!force)
|
||||
|
Loading…
x
Reference in New Issue
Block a user