diff options
Diffstat (limited to 'backend/drm')
-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, }; |