From ab011406add31c518f6f352189b1dc6246a74fdb Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Sun, 4 Feb 2018 21:03:44 +0100 Subject: Add atomic gamma lut size fetching Legacy gamma lut size now uses the new legacy_crtc member of wlr_drm_crtc. This was Previously doen using old_crtc in wlr_drm_connector, but since this refers to the crtc that was connected to the ouput, this could give the wrong result. --- backend/drm/drm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'backend/drm/drm.c') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index abcfcf8a..eef1e333 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -140,6 +140,7 @@ bool wlr_drm_resources_init(struct wlr_drm_backend *drm) { for (size_t i = 0; i < drm->num_crtcs; ++i) { struct wlr_drm_crtc *crtc = &drm->crtcs[i]; crtc->id = res->crtcs[i]; + crtc->legacy_crtc = drmModeGetCrtc(drm->fd, crtc->id); wlr_drm_get_crtc_props(drm->fd, crtc->id, &crtc->props); } @@ -166,6 +167,7 @@ void wlr_drm_resources_free(struct wlr_drm_backend *drm) { for (size_t i = 0; i < drm->num_crtcs; ++i) { struct wlr_drm_crtc *crtc = &drm->crtcs[i]; drmModeAtomicFree(crtc->atomic); + drmModeFreeCrtc(crtc->legacy_crtc); if (crtc->mode_id) { drmModeDestroyPropertyBlob(drm->fd, crtc->mode_id); } @@ -235,8 +237,8 @@ static void wlr_drm_connector_set_gamma(struct wlr_output *output, static uint32_t wlr_drm_connector_get_gamma_size(struct wlr_output *output) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; - drmModeCrtc *crtc = conn->old_crtc; - return crtc ? crtc->gamma_size : 0; + struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; + return drm->iface->crtc_get_gamma_size(drm, conn->crtc); } void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { -- cgit v1.2.3