aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorScott Anderson <ascent12@hotmail.com>2017-06-26 17:34:15 +1200
committerScott Anderson <ascent12@hotmail.com>2017-06-26 17:34:15 +1200
commit0cd94f0cf0dd104cee9837dc2961536a078d089e (patch)
tree798abd248cf605f2a82ef732c0bed0a1812704c7 /backend
parentf252c5a79214a3d3cd7ab3f239050b234e4ae9e2 (diff)
Added software cursor fallback
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index c6e29b86..2f64066e 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -92,13 +92,13 @@ static uint32_t get_fb_for_bo(int fd, struct gbm_bo *bo) {
return *id;
}
-static void wlr_drm_output_begin(struct wlr_output_state *output) {
+static void wlr_drm_output_make_current(struct wlr_output_state *output) {
struct wlr_drm_renderer *renderer = output->renderer;
eglMakeCurrent(renderer->egl.display, output->egl,
output->egl, renderer->egl.context);
}
-static void wlr_drm_output_end(struct wlr_output_state *output) {
+static void wlr_drm_output_swap_buffers(struct wlr_output_state *output) {
struct wlr_drm_renderer *renderer = output->renderer;
if (!eglSwapBuffers(renderer->egl.display, output->egl)) {
@@ -207,10 +207,10 @@ static void wlr_drm_output_enable(struct wlr_output_state *output, bool enable)
DRM_MODE_DPMS_ON);
// Start rendering loop again by drawing a black frame
- wlr_drm_output_begin(output);
+ wlr_drm_output_make_current(output);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- wlr_drm_output_end(output);
+ wlr_drm_output_swap_buffers(output);
} else {
drmModeConnectorSetProperty(state->fd, output->connector, output->props.dpms,
DRM_MODE_DPMS_STANDBY);
@@ -342,8 +342,13 @@ static bool wlr_drm_output_set_cursor(struct wlr_output_state *output,
wlr_log(L_ERROR, "Failed to write cursor to bo");
return false;
}
- return !drmModeSetCursor(state->fd, output->crtc,
- gbm_bo_get_handle(bo).s32, width, height);
+
+ if (drmModeSetCursor(state->fd, output->crtc, gbm_bo_get_handle(bo).u32, width, height)) {
+ wlr_log_errno(L_INFO, "Failed to set hardware cursor");
+ return false;
+ }
+
+ return true;
}
static bool wlr_drm_output_move_cursor(struct wlr_output_state *output,
@@ -365,6 +370,8 @@ static struct wlr_output_impl output_impl = {
.set_cursor = wlr_drm_output_set_cursor,
.move_cursor = wlr_drm_output_move_cursor,
.destroy = wlr_drm_output_destroy,
+ .make_current = wlr_drm_output_make_current,
+ .swap_buffers = wlr_drm_output_swap_buffers,
};
static int32_t calculate_refresh_rate(drmModeModeInfo *mode) {
@@ -625,9 +632,7 @@ static void page_flip_handler(int fd, unsigned seq,
output->pageflip_pending = false;
if (output->state == DRM_OUTPUT_CONNECTED && state->session->active) {
- wlr_drm_output_begin(output);
wl_signal_emit(&output->wlr_output->events.frame, output->wlr_output);
- wlr_drm_output_end(output);
}
}