swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit b561fc70a132f0bc82e7df62f1e7b12af759fbeb
parent 036667025534d59cd812e94bde738e65ee8f3815
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 20 Jan 2014 20:32:06 -0800

framebuffer_plane: Keep track of when a modeset is needed

Diffstat:
Mlibswc/framebuffer_plane.c | 37++++++++++++++++++-------------------
Mlibswc/framebuffer_plane.h | 1+
2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libswc/framebuffer_plane.c b/libswc/framebuffer_plane.c @@ -106,30 +106,28 @@ static bool attach(struct swc_view * view, struct swc_buffer * buffer) if (!framebuffer) return false; - if (drmModePageFlip(swc.drm->fd, plane->crtc, framebuffer->id, - DRM_MODE_PAGE_FLIP_EVENT, &plane->drm_handler) != 0) + if (plane->need_modeset) { - if (errno == EINVAL) + if (drmModeSetCrtc(swc.drm->fd, plane->crtc, framebuffer->id, 0, 0, + plane->connectors.data, plane->connectors.size / 4, + &plane->mode.info) == 0) { - WARNING("Page flip failed with EINVAL, trying to set CRTC\n"); - - if (drmModeSetCrtc(swc.drm->fd, plane->crtc, framebuffer->id, 0, 0, - plane->connectors.data, - plane->connectors.size / 4, - &plane->mode.info) == 0) - { - swc_view_frame(&plane->view, swc_time()); - } - else - { - ERROR("Could not set CRTC to next framebuffer: %s\n", - strerror(errno)); - return false; - } + swc_view_frame(&plane->view, swc_time()); + plane->need_modeset = false; } else { - ERROR("Could not schedule page flip: %s\n", strerror(errno)); + ERROR("Could not set CRTC to next framebuffer: %s\n", + strerror(errno)); + return false; + } + } + else + { + if (drmModePageFlip(swc.drm->fd, plane->crtc, framebuffer->id, + DRM_MODE_PAGE_FLIP_EVENT, &plane->drm_handler) != 0) + { + ERROR("Page flip failed: %s\n", strerror(errno)); return false; } } @@ -185,6 +183,7 @@ bool swc_framebuffer_plane_initialize(struct swc_framebuffer_plane * plane, plane->crtc = crtc; plane->drm_handler.page_flip = &handle_page_flip; + plane->need_modeset = true; swc_view_initialize(&plane->view, &view_impl); swc_mode_initialize(&plane->mode, mode); diff --git a/libswc/framebuffer_plane.h b/libswc/framebuffer_plane.h @@ -39,6 +39,7 @@ struct swc_framebuffer_plane struct swc_view view; struct swc_drm_handler drm_handler; struct wl_array connectors; + bool need_modeset; }; bool swc_framebuffer_plane_initialize(struct swc_framebuffer_plane * plane,