diff options
-rw-r--r-- | backend/drm/atomic.c | 10 | ||||
-rw-r--r-- | backend/drm/drm.c | 16 | ||||
-rw-r--r-- | backend/wayland/output.c | 5 | ||||
-rw-r--r-- | docs/env_vars.md | 2 | ||||
-rw-r--r-- | include/wlr/interfaces/wlr_output.h | 2 | ||||
-rw-r--r-- | types/wlr_output.c | 5 |
6 files changed, 25 insertions, 15 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index ad80f2fd..fc649d68 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -208,10 +208,12 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm, struct wlr_drm_crtc *crtc, size_t size, uint16_t *r, uint16_t *g, uint16_t *b) { // Fallback to legacy gamma interface when gamma properties are not available - // (can happen on older intel gpu's that support gamma but not degamma) - // TEMP: This is broken on AMDGPU. Always fallback to legacy until they get - // it fixed. Ref https://bugs.freedesktop.org/show_bug.cgi?id=107459 - if (crtc->props.gamma_lut == 0 || true) { + // (can happen on older Intel GPUs that support gamma but not degamma). + // TEMP: This is broken on AMDGPU. Provide a fallback to legacy until they + // get it fixed. Ref https://bugs.freedesktop.org/show_bug.cgi?id=107459 + const char *no_atomic_str = getenv("WLR_DRM_NO_ATOMIC_GAMMA"); + bool no_atomic = no_atomic_str != NULL && strcmp(no_atomic_str, "1") == 0; + if (crtc->props.gamma_lut == 0 || no_atomic) { return legacy_iface.crtc_set_gamma(drm, crtc, size, r, g, b); } diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 0b624717..9fd5c6a3 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -735,11 +735,11 @@ static bool drm_connector_move_cursor(struct wlr_output *output, return ok; } -static void drm_connector_schedule_frame(struct wlr_output *output) { +static bool drm_connector_schedule_frame(struct wlr_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 (!drm->session->active) { - return; + return false; } // We need to figure out where we are in the vblank cycle @@ -747,29 +747,33 @@ static void drm_connector_schedule_frame(struct wlr_output *output) { struct wlr_drm_crtc *crtc = conn->crtc; if (!crtc) { - return; + return false; } struct wlr_drm_plane *plane = crtc->primary; struct gbm_bo *bo = plane->surf.back; if (!bo) { // We haven't swapped buffers yet -- can't do a pageflip wlr_output_send_frame(output); - return; + return true; + } + if (drm->parent) { + bo = copy_drm_surface_mgpu(&plane->mgpu_surf, bo); } uint32_t fb_id = get_fb_for_bo(bo); if (conn->pageflip_pending) { wlr_log(WLR_ERROR, "Skipping pageflip on output '%s'", conn->output.name); - return; + return true; } if (!drm->iface->crtc_pageflip(drm, conn, crtc, fb_id, NULL)) { - return; + return false; } conn->pageflip_pending = true; wlr_output_update_enabled(output, true); + return true; } static void drm_connector_destroy(struct wlr_output *output) { diff --git a/backend/wayland/output.c b/backend/wayland/output.c index bc4067ab..f90c6009 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -197,17 +197,18 @@ static bool output_move_cursor(struct wlr_output *_output, int x, int y) { return true; } -static void output_schedule_frame(struct wlr_output *wlr_output) { +static bool output_schedule_frame(struct wlr_output *wlr_output) { struct wlr_wl_output *output = get_wl_output_from_output(wlr_output); if (output->frame_callback != NULL) { wlr_log(WLR_ERROR, "Skipping frame scheduling"); - return; + return true; } output->frame_callback = wl_surface_frame(output->surface); wl_callback_add_listener(output->frame_callback, &frame_listener, output); wl_surface_commit(output->surface); + return true; } static const struct wlr_output_impl output_impl = { diff --git a/docs/env_vars.md b/docs/env_vars.md index 1b1a5fd6..b67d1652 100644 --- a/docs/env_vars.md +++ b/docs/env_vars.md @@ -7,6 +7,8 @@ wlroots specific considered the primary DRM device. * *WLR_DRM_NO_ATOMIC*: set to 1 to use legacy DRM interface instead of atomic mode setting +* *WLR_DRM_NO_ATOMIC_GAMMA*: set to 1 to use legacy DRM interface for gamma + control instead of the atomic interface * *WLR_LIBINPUT_NO_DEVICES*: set to 1 to not fail without any input devices * *WLR_BACKENDS*: comma-separated list of backends to use (available backends: wayland, x11, headless) diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index da37cba1..f7ffe3b4 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -33,7 +33,7 @@ struct wlr_output_impl { size_t (*get_gamma_size)(struct wlr_output *output); bool (*export_dmabuf)(struct wlr_output *output, struct wlr_dmabuf_attributes *attribs); - void (*schedule_frame)(struct wlr_output *output); + bool (*schedule_frame)(struct wlr_output *output); }; void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, diff --git a/types/wlr_output.c b/types/wlr_output.c index 57503d97..9936e015 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -547,8 +547,9 @@ static void schedule_frame_handle_idle_timer(void *data) { output->idle_frame = NULL; if (!output->frame_pending && output->impl->schedule_frame) { // Ask the backend to send a frame event when appropriate - output->frame_pending = true; - output->impl->schedule_frame(output); + if (output->impl->schedule_frame(output)) { + output->frame_pending = true; + } } } |