aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorVincent Vanlaer <vincent.vanlaer@skynet.be>2019-02-05 23:39:30 +0100
committeremersion <contact@emersion.fr>2019-02-14 12:31:54 +0100
commitbc048b22fb3158e9ecad3e8e32d63e0e03eaa7bb (patch)
treecb90ef393fac64d1c591f57d334d5e0e5560c5c8 /backend
parent72c76b128e562c482868b42b1945ed49cbd44353 (diff)
Copy cursor surface to secondary gpu if necessary
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c29
-rw-r--r--backend/drm/renderer.c2
2 files changed, 24 insertions, 7 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 0fca55d8..7713b5bb 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -636,13 +636,25 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
ret = drmGetCap(drm->fd, DRM_CAP_CURSOR_HEIGHT, &h);
h = ret ? 64 : h;
- struct wlr_drm_renderer *renderer =
- drm->parent ? &drm->parent->renderer : &drm->renderer;
- if (!init_drm_surface(&plane->surf, renderer, w, h,
- renderer->gbm_format, GBM_BO_USE_LINEAR | GBM_BO_USE_SCANOUT)) {
- wlr_log(WLR_ERROR, "Cannot allocate cursor resources");
- return false;
+ if (!drm->parent) {
+ if (!init_drm_surface(&plane->surf, &drm->renderer, w, h,
+ drm->renderer.gbm_format, GBM_BO_USE_LINEAR | GBM_BO_USE_SCANOUT)) {
+ wlr_log(WLR_ERROR, "Cannot allocate cursor resources");
+ return false;
+ }
+ } else {
+ if (!init_drm_surface(&plane->surf, &drm->parent->renderer, w, h,
+ drm->parent->renderer.gbm_format, GBM_BO_USE_LINEAR)) {
+ wlr_log(WLR_ERROR, "Cannot allocate cursor resources");
+ return false;
+ }
+
+ if (!init_drm_surface(&plane->mgpu_surf, &drm->renderer, w, h,
+ drm->renderer.gbm_format, GBM_BO_USE_LINEAR | GBM_BO_USE_SCANOUT)) {
+ wlr_log(WLR_ERROR, "Cannot allocate cursor resources");
+ return false;
+ }
}
}
@@ -712,6 +724,11 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
}
struct gbm_bo *bo = plane->cursor_enabled ? plane->surf.back : NULL;
+
+ if (drm->parent) {
+ bo = copy_drm_surface_mgpu(&plane->mgpu_surf, plane->surf.back);
+ }
+
bool ok = drm->iface->crtc_set_cursor(drm, crtc, bo);
if (ok) {
wlr_output_update_needs_swap(output);
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index b77a7ce0..72cfd430 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -230,7 +230,7 @@ struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest,
struct wlr_renderer *renderer = dest->renderer->wlr_rend;
wlr_renderer_begin(renderer, dest->width, dest->height);
- wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 1.0 });
+ wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 });
wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f);
wlr_renderer_end(renderer);