diff options
author | Simon Ser <contact@emersion.fr> | 2020-05-09 16:50:50 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-05-10 09:20:46 +0200 |
commit | 06d5aa57809864e45e4c59460ab4e064fd1e2df7 (patch) | |
tree | d467756e1b6eb33651e550882e8114d076095ae5 /backend | |
parent | da63d11d341e9e1bc3c0dcb040e2cc5d82a3959e (diff) |
backend/drm: GAMMA_LUT_SIZE isn't atomic
GAMMA_LUT_SIZE isn't an atomic property. It can be used with the legacy
interface too. So we can unify both codepaths and remove
wlr_drm_interface.crtc_get_gamma_size.
It's no guaranteed to exist though, so we still need to keep the
fallback.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/atomic.c | 17 | ||||
-rw-r--r-- | backend/drm/drm.c | 18 | ||||
-rw-r--r-- | backend/drm/legacy.c | 6 |
3 files changed, 15 insertions, 26 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index d4f033f0..3060d671 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -240,23 +240,6 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm, return true; } -static size_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm, - struct wlr_drm_crtc *crtc) { - 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)) { - wlr_log(WLR_ERROR, "Unable to get gamma lut size"); - return 0; - } - - return (size_t)gamma_lut_size; -} - const struct wlr_drm_interface atomic_iface = { .crtc_commit = atomic_crtc_commit, - .crtc_get_gamma_size = atomic_crtc_get_gamma_size, }; diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 60df4348..8482b368 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -581,12 +581,24 @@ static void fill_empty_gamma_table(size_t size, static size_t drm_connector_get_gamma_size(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); + struct wlr_drm_crtc *crtc = conn->crtc; - if (conn->crtc) { - return drm->iface->crtc_get_gamma_size(drm, conn->crtc); + if (crtc == NULL) { + return 0; } - return 0; + if (crtc->props.gamma_lut_size == 0) { + return (size_t)crtc->legacy_crtc->gamma_size; + } + + uint64_t gamma_lut_size; + if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size, + &gamma_lut_size)) { + wlr_log(WLR_ERROR, "Unable to get gamma lut size"); + return 0; + } + + return gamma_lut_size; } bool set_drm_connector_gamma(struct wlr_output *output, size_t size, diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c index 09e7df16..c32d0399 100644 --- a/backend/drm/legacy.c +++ b/backend/drm/legacy.c @@ -117,12 +117,6 @@ bool drm_legacy_crtc_set_gamma(struct wlr_drm_backend *drm, return true; } -static size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm, - struct wlr_drm_crtc *crtc) { - return (size_t)crtc->legacy_crtc->gamma_size; -} - const struct wlr_drm_interface legacy_iface = { .crtc_commit = legacy_crtc_commit, - .crtc_get_gamma_size = legacy_crtc_get_gamma_size, }; |