aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/atomic.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/drm/atomic.c')
-rw-r--r--backend/drm/atomic.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index 90acac25..fc649d68 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -104,7 +104,8 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
drmModeDestroyPropertyBlob(drm->fd, crtc->mode_id);
}
- if (drmModeCreatePropertyBlob(drm->fd, mode, sizeof(*mode), &crtc->mode_id)) {
+ if (drmModeCreatePropertyBlob(drm->fd, mode, sizeof(*mode),
+ &crtc->mode_id)) {
wlr_log_errno(WLR_ERROR, "Unable to create property blob");
return false;
}
@@ -120,6 +121,10 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
struct atomic atom;
atomic_begin(crtc, &atom);
atomic_add(&atom, conn->id, conn->props.crtc_id, crtc->id);
+ if (mode != NULL && conn->props.link_status != 0) {
+ atomic_add(&atom, conn->id, conn->props.link_status,
+ DRM_MODE_LINK_STATUS_GOOD);
+ }
atomic_add(&atom, crtc->id, crtc->props.mode_id, crtc->mode_id);
atomic_add(&atom, crtc->id, crtc->props.active, 1);
set_plane_props(&atom, crtc->primary, crtc->id, fb_id, true);
@@ -200,14 +205,16 @@ static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm,
}
static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
- struct wlr_drm_crtc *crtc, uint16_t *r, uint16_t *g, uint16_t *b,
- uint32_t size) {
+ 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) {
- return legacy_iface.crtc_set_gamma(drm, crtc, r, g, b, size);
+ // (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);
}
struct drm_color_lut *gamma = malloc(size * sizeof(struct drm_color_lut));
@@ -216,7 +223,7 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
return false;
}
- for (uint32_t i = 0; i < size; i++) {
+ for (size_t i = 0; i < size; i++) {
gamma[i].red = r[i];
gamma[i].green = g[i];
gamma[i].blue = b[i];
@@ -240,21 +247,20 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
return atomic_end(drm->fd, &atom);
}
-static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
+static size_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc) {
- uint64_t gamma_lut_size;
-
if (crtc->props.gamma_lut_size == 0) {
return legacy_iface.crtc_get_gamma_size(drm, crtc);
}
+ uint64_t gamma_lut_size;
if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
- &gamma_lut_size)) {
+ &gamma_lut_size)) {
wlr_log(WLR_ERROR, "Unable to get gamma lut size");
return 0;
}
- return (uint32_t)gamma_lut_size;
+ return (size_t)gamma_lut_size;
}
const struct wlr_drm_interface atomic_iface = {