This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch devs/devilhorns/apos
in repository efl.

View the commit online.

commit 54c4164e13ece2bdcff7f53f3c50d11912e75de8
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Thu Oct 10 09:09:10 2024 -0400

    ecore_drm2: Add API function to set display gamma and start work on
    function to apply state changes to display
---
 src/lib/ecore_drm2/Ecore_Drm2.h          |  2 +
 src/lib/ecore_drm2/ecore_drm2_displays.c | 89 +++++++++++++++++++++++++++++---
 2 files changed, 85 insertions(+), 6 deletions(-)

diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 3fdb4ea79e..2ce608d26e 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -123,6 +123,8 @@ EAPI Ecore_Drm2_Display *ecore_drm2_display_find(Ecore_Drm2_Device *dev, int x,
 EAPI void ecore_drm2_display_user_data_set(Ecore_Drm2_Display *disp, void *data);
 EAPI void *ecore_drm2_display_user_data_get(Ecore_Drm2_Display *disp);
 EAPI Eina_Bool ecore_drm2_display_blanktime_get(Ecore_Drm2_Display *disp, int seq, long *sec, long *usec);
+EAPI Eina_Bool ecore_drm2_display_changes_apply(Ecore_Drm2_Display *disp);
+EAPI void ecore_drm2_display_gamma_set(Ecore_Drm2_Display *disp, uint16_t size, uint16_t *red, uint16_t *greeen, uint16_t *blue);
 
 /* Framebuffer API functions */
 EAPI Ecore_Drm2_Fb *ecore_drm2_fb_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, void *bo);
diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index 495963c9de..000ff77b47 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -455,7 +455,7 @@ _ecore_drm2_display_state_fill(Ecore_Drm2_Display *disp)
    _ecore_drm2_display_modes_get(disp);
 
    /* get gamma from crtc */
-   disp->state.current->gamma = disp->crtc->drmCrtc->gamma_size;
+   disp->state.current->gamma.size = disp->crtc->drmCrtc->gamma_size;
 
    /* get connected state */
    disp->connected = (disp->conn->drmConn->connection == DRM_MODE_CONNECTED);
@@ -772,11 +772,6 @@ ecore_drm2_display_enabled_set(Ecore_Drm2_Display *disp, Eina_Bool enabled)
 
    if (cstate->enabled == enabled) return;
 
-   if (enabled)
-     ecore_drm2_display_dpms_set(disp, DRM_MODE_DPMS_ON);
-   else
-     ecore_drm2_display_dpms_set(disp, DRM_MODE_DPMS_OFF);
-
    pstate->enabled = enabled;
    pstate->changes |= ECORE_DRM2_DISPLAY_STATE_ENABLED;
 
@@ -1114,3 +1109,85 @@ ecore_drm2_display_blanktime_get(Ecore_Drm2_Display *disp, int seq, long *sec, l
    *usec = vbl.reply.tval_usec;
    return EINA_TRUE;
 }
+
+EAPI Eina_Bool
+ecore_drm2_display_changes_apply(Ecore_Drm2_Display *disp)
+{
+   Ecore_Drm2_Display_State *pstate;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(disp, EINA_FALSE);
+
+   pstate = disp->state.pending;
+
+   if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_GAMMA)
+     {
+	uint16_t *r, *g, *b;
+
+	r = pstate->gamma.r;
+	g = pstate->gamma.g;
+	b = pstate->gamma.b;
+
+	if (sym_drmModeCrtcSetGamma(disp->crtc->fd, disp->crtc->id,
+				    pstate->gamma.size, r, g, b) < 0)
+	  ERR("Failed to set gamma for Display %s: %m", disp->name);
+	else
+	  pstate->changes &= ~ECORE_DRM2_DISPLAY_STATE_GAMMA;
+     }
+
+   if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_ROTATION)
+     {
+
+     }
+
+   if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_BACKLIGHT)
+     {
+
+     }
+
+   if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_MODE)
+     {
+
+     }
+
+   if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_PRIMARY)
+     {
+
+     }
+
+   if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_ENABLED)
+     {
+
+     }
+
+   if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_POSITION)
+     {
+
+     }
+
+   /* TODO: copy pending state to current when applying changes is successful */
+
+   return EINA_TRUE;
+}
+
+EAPI void
+ecore_drm2_display_gamma_set(Ecore_Drm2_Display *disp, uint16_t size, uint16_t *red, uint16_t *green, uint16_t *blue)
+{
+   Ecore_Drm2_Display_State *cstate, *pstate;
+
+   EINA_SAFETY_ON_NULL_RETURN(disp);
+
+   cstate = disp->state.current;
+   pstate = disp->state.pending;
+
+   if (cstate->gamma.size == size) return;
+   if ((cstate->gamma.r == red) &&
+       (cstate->gamma.g == green) &&
+       (cstate->gamma.b == blue))
+     return;
+
+   pstate->gamma.size = size;
+   pstate->gamma.r = red;
+   pstate->gamma.g = green;
+   pstate->gamma.b = blue;
+   pstate->changes |= ECORE_DRM2_DISPLAY_STATE_GAMMA;
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to