diff options
author | Scott Anderson <ascent12@hotmail.com> | 2019-02-04 21:34:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-04 21:34:40 +0000 |
commit | b2f56ad4a84229239f55a6e0235fa7b76a9b2feb (patch) | |
tree | 25728ccaf55eb0743a3cf41829e2583bc195f53f /backend/drm/drm.c | |
parent | 721a810f72aed867176f3721a4462fc24c790954 (diff) | |
parent | 7bc43413edc2db04bbfba395f9606957ff2fa21c (diff) |
Merge pull request #1526 from VincentVanlaer/cursor-dmabuf
Allow cursor render surface to be used as fb
Diffstat (limited to 'backend/drm/drm.c')
-rw-r--r-- | backend/drm/drm.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 999ca494..619664d6 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -226,12 +226,6 @@ void finish_drm_resources(struct wlr_drm_backend *drm) { } free(crtc->gamma_table); } - for (size_t i = 0; i < drm->num_planes; ++i) { - struct wlr_drm_plane *plane = &drm->planes[i]; - if (plane->cursor_bo) { - gbm_bo_destroy(plane->cursor_bo); - } - } free(drm->crtcs); free(drm->planes); @@ -642,17 +636,10 @@ static bool drm_connector_set_cursor(struct wlr_output *output, drm->parent ? &drm->parent->renderer : &drm->renderer; if (!init_drm_surface(&plane->surf, renderer, w, h, - renderer->gbm_format, 0)) { + renderer->gbm_format, GBM_BO_USE_LINEAR | GBM_BO_USE_SCANOUT)) { wlr_log(WLR_ERROR, "Cannot allocate cursor resources"); return false; } - - plane->cursor_bo = gbm_bo_create(drm->renderer.gbm, w, h, - renderer->gbm_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); - if (!plane->cursor_bo) { - wlr_log_errno(WLR_ERROR, "Failed to create cursor bo"); - return false; - } } wlr_matrix_projection(plane->matrix, plane->surf.width, @@ -697,17 +684,6 @@ static bool drm_connector_set_cursor(struct wlr_output *output, return false; } - uint32_t bo_width = gbm_bo_get_width(plane->cursor_bo); - uint32_t bo_height = gbm_bo_get_height(plane->cursor_bo); - - uint32_t bo_stride; - void *bo_data; - if (!gbm_bo_map(plane->cursor_bo, 0, 0, bo_width, bo_height, - GBM_BO_TRANSFER_WRITE, &bo_stride, &bo_data)) { - wlr_log_errno(WLR_ERROR, "Unable to map buffer"); - return false; - } - make_drm_surface_current(&plane->surf, NULL); struct wlr_renderer *rend = plane->surf.renderer->wlr_rend; @@ -722,13 +698,8 @@ static bool drm_connector_set_cursor(struct wlr_output *output, wlr_render_texture_with_matrix(rend, texture, matrix, 1.0); wlr_renderer_end(rend); - wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, NULL, bo_stride, - plane->surf.width, plane->surf.height, 0, 0, 0, 0, bo_data); - swap_drm_surface_buffers(&plane->surf, NULL); - gbm_bo_unmap(plane->cursor_bo, bo_data); - plane->cursor_enabled = true; } @@ -736,7 +707,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, return true; // will be committed when session is resumed } - struct gbm_bo *bo = plane->cursor_enabled ? plane->cursor_bo : NULL; + struct gbm_bo *bo = plane->cursor_enabled ? plane->surf.back : NULL; bool ok = drm->iface->crtc_set_cursor(drm, crtc, bo); if (ok) { wlr_output_update_needs_swap(output); |