aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/drm/drm.c')
-rw-r--r--backend/drm/drm.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index db75853d..8ec27b80 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -94,23 +94,21 @@ static uint32_t get_fb_for_bo(int fd, struct gbm_bo *bo) {
return *id;
}
-void wlr_drm_output_begin(struct wlr_output *output) {
- struct wlr_output_state *_output = output->state;
- struct wlr_drm_renderer *renderer = _output->renderer;
- eglMakeCurrent(renderer->egl.display, _output->egl,
- _output->egl, renderer->egl.context);
+static void wlr_drm_output_begin(struct wlr_output_state *output) {
+ struct wlr_drm_renderer *renderer = output->renderer;
+ eglMakeCurrent(renderer->egl.display, output->egl,
+ output->egl, renderer->egl.context);
}
-void wlr_drm_output_end(struct wlr_output *output) {
- struct wlr_output_state *_output = output->state;
- struct wlr_drm_renderer *renderer = _output->renderer;
+static void wlr_drm_output_end(struct wlr_output_state *output) {
+ struct wlr_drm_renderer *renderer = output->renderer;
- eglSwapBuffers(renderer->egl.display, _output->egl);
- struct gbm_bo *bo = gbm_surface_lock_front_buffer(_output->gbm);
+ eglSwapBuffers(renderer->egl.display, output->egl);
+ struct gbm_bo *bo = gbm_surface_lock_front_buffer(output->gbm);
uint32_t fb_id = get_fb_for_bo(renderer->fd, bo);
- drmModePageFlip(renderer->fd, _output->crtc, fb_id, DRM_MODE_PAGE_FLIP_EVENT, _output);
- gbm_surface_release_buffer(_output->gbm, bo);
- _output->pageflip_pending = true;
+ drmModePageFlip(renderer->fd, output->crtc, fb_id, DRM_MODE_PAGE_FLIP_EVENT, output);
+ gbm_surface_release_buffer(output->gbm, bo);
+ output->pageflip_pending = true;
}
static bool display_init_renderer(struct wlr_drm_renderer *renderer,
@@ -396,7 +394,9 @@ static void page_flip_handler(int fd, unsigned seq,
output->pageflip_pending = false;
if (output->state == DRM_OUTPUT_CONNECTED) {
+ wlr_drm_output_begin(output);
wl_signal_emit(&output->wlr_output->events.frame, output->wlr_output);
+ wlr_drm_output_end(output);
}
}
@@ -465,10 +465,10 @@ void wlr_drm_output_dpms(int fd, struct wlr_output_state *output, bool screen_on
DRM_MODE_DPMS_ON);
// Start rendering loop again by drawing a black frame
- wlr_drm_output_begin(output->wlr_output);
+ wlr_drm_output_begin(output);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- wlr_drm_output_end(output->wlr_output);
+ wlr_drm_output_end(output);
} else {
drmModeConnectorSetProperty(fd, output->connector, output->props.dpms,
DRM_MODE_DPMS_STANDBY);