backend/drm: remove wlr_drm_interface.crtc_move_cursor

Instead, make the legacy backend call drmModeMoveCursor on page-flip.
This commit is contained in:
Simon Ser 2020-05-07 16:17:18 +02:00
parent 064f64dbf7
commit c9d6b18eef
5 changed files with 10 additions and 33 deletions

View File

@ -193,12 +193,6 @@ static bool atomic_crtc_set_cursor(struct wlr_drm_backend *drm,
return true; return true;
} }
static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, int x, int y) {
/* Cursor updates happen when we pageflip */
return true;
}
static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm, static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, size_t size, struct wlr_drm_crtc *crtc, size_t size,
uint16_t *r, uint16_t *g, uint16_t *b) { uint16_t *r, uint16_t *g, uint16_t *b) {
@ -258,7 +252,6 @@ const struct wlr_drm_interface atomic_iface = {
.conn_enable = atomic_conn_enable, .conn_enable = atomic_conn_enable,
.crtc_pageflip = atomic_crtc_pageflip, .crtc_pageflip = atomic_crtc_pageflip,
.crtc_set_cursor = atomic_crtc_set_cursor, .crtc_set_cursor = atomic_crtc_set_cursor,
.crtc_move_cursor = atomic_crtc_move_cursor,
.crtc_set_gamma = atomic_crtc_set_gamma, .crtc_set_gamma = atomic_crtc_set_gamma,
.crtc_get_gamma_size = atomic_crtc_get_gamma_size, .crtc_get_gamma_size = atomic_crtc_get_gamma_size,
}; };

View File

@ -112,8 +112,6 @@ static void session_signal(struct wl_listener *listener, void *data) {
} }
drm->iface->crtc_set_cursor(drm, conn->crtc, bo); drm->iface->crtc_set_cursor(drm, conn->crtc, bo);
drm->iface->crtc_move_cursor(drm, conn->crtc, conn->cursor_x,
conn->cursor_y);
if (conn->crtc->gamma_table != NULL) { if (conn->crtc->gamma_table != NULL) {
size_t size = conn->crtc->gamma_table_size; size_t size = conn->crtc->gamma_table_size;

View File

@ -953,11 +953,6 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
plane->cursor_hotspot_x = hotspot.x; plane->cursor_hotspot_x = hotspot.x;
plane->cursor_hotspot_y = hotspot.y; plane->cursor_hotspot_y = hotspot.y;
if (!drm->iface->crtc_move_cursor(drm, conn->crtc, conn->cursor_x,
conn->cursor_y)) {
return false;
}
wlr_output_update_needs_frame(output); wlr_output_update_needs_frame(output);
} }
@ -1033,7 +1028,6 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
static bool drm_connector_move_cursor(struct wlr_output *output, static bool drm_connector_move_cursor(struct wlr_output *output,
int x, int y) { int x, int y) {
struct wlr_drm_connector *conn = get_drm_connector_from_output(output); struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend);
if (!conn->crtc) { if (!conn->crtc) {
return false; return false;
} }
@ -1056,15 +1050,8 @@ static bool drm_connector_move_cursor(struct wlr_output *output,
conn->cursor_x = box.x; conn->cursor_x = box.x;
conn->cursor_y = box.y; conn->cursor_y = box.y;
if (!drm->session->active) { wlr_output_update_needs_frame(output);
return true; // will be committed when session is resumed return true;
}
bool ok = drm->iface->crtc_move_cursor(drm, conn->crtc, box.x, box.y);
if (ok) {
wlr_output_update_needs_frame(output);
}
return ok;
} }
static void drm_connector_destroy(struct wlr_output *output) { static void drm_connector_destroy(struct wlr_output *output) {

View File

@ -9,6 +9,8 @@
static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm, static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn, drmModeModeInfo *mode) { struct wlr_drm_connector *conn, drmModeModeInfo *mode) {
struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_crtc *crtc = conn->crtc;
struct wlr_drm_plane *cursor = crtc->cursor;
struct wlr_drm_fb *fb = plane_get_next_fb(crtc->primary); struct wlr_drm_fb *fb = plane_get_next_fb(crtc->primary);
struct gbm_bo *bo = drm_fb_acquire(fb, drm, &crtc->primary->mgpu_surf); struct gbm_bo *bo = drm_fb_acquire(fb, drm, &crtc->primary->mgpu_surf);
if (!bo) { if (!bo) {
@ -28,6 +30,12 @@ static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm,
} }
} }
if (cursor != NULL && cursor->cursor_enabled && drmModeMoveCursor(drm->fd,
crtc->id, conn->cursor_x, conn->cursor_y) != 0) {
wlr_log_errno(WLR_ERROR, "%s: failed to move cursor", conn->output.name);
return false;
}
if (drmModePageFlip(drm->fd, crtc->id, fb_id, DRM_MODE_PAGE_FLIP_EVENT, drm)) { if (drmModePageFlip(drm->fd, crtc->id, fb_id, DRM_MODE_PAGE_FLIP_EVENT, drm)) {
wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name); wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name);
return false; return false;
@ -75,11 +83,6 @@ bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
return true; return true;
} }
bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, int x, int y) {
return !drmModeMoveCursor(drm->fd, crtc->id, x, y);
}
static bool legacy_crtc_set_gamma(struct wlr_drm_backend *drm, static bool legacy_crtc_set_gamma(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, size_t size, struct wlr_drm_crtc *crtc, size_t size,
uint16_t *r, uint16_t *g, uint16_t *b) { uint16_t *r, uint16_t *g, uint16_t *b) {
@ -95,7 +98,6 @@ const struct wlr_drm_interface legacy_iface = {
.conn_enable = legacy_conn_enable, .conn_enable = legacy_conn_enable,
.crtc_pageflip = legacy_crtc_pageflip, .crtc_pageflip = legacy_crtc_pageflip,
.crtc_set_cursor = legacy_crtc_set_cursor, .crtc_set_cursor = legacy_crtc_set_cursor,
.crtc_move_cursor = legacy_crtc_move_cursor,
.crtc_set_gamma = legacy_crtc_set_gamma, .crtc_set_gamma = legacy_crtc_set_gamma,
.crtc_get_gamma_size = legacy_crtc_get_gamma_size, .crtc_get_gamma_size = legacy_crtc_get_gamma_size,
}; };

View File

@ -22,9 +22,6 @@ struct wlr_drm_interface {
// Enable the cursor buffer on crtc. Set bo to NULL to disable // Enable the cursor buffer on crtc. Set bo to NULL to disable
bool (*crtc_set_cursor)(struct wlr_drm_backend *drm, bool (*crtc_set_cursor)(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, struct gbm_bo *bo); struct wlr_drm_crtc *crtc, struct gbm_bo *bo);
// Move the cursor on crtc
bool (*crtc_move_cursor)(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, int x, int y);
// Set the gamma lut on crtc // Set the gamma lut on crtc
bool (*crtc_set_gamma)(struct wlr_drm_backend *drm, bool (*crtc_set_gamma)(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, size_t size, struct wlr_drm_crtc *crtc, size_t size,