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 cd9a5aa12967f638a12a639a3b70b72bbaf37d45
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Thu Oct 10 10:46:55 2024 -0400

    ecore_drm2: Add internal function to apply crtc mode changes
---
 src/lib/ecore_drm2/ecore_drm2_crtcs.c   | 72 +++++++++++++++++++++++++++++++++
 src/lib/ecore_drm2/ecore_drm2_private.h |  1 +
 2 files changed, 73 insertions(+)

diff --git a/src/lib/ecore_drm2/ecore_drm2_crtcs.c b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
index ecf0604691..1a5b291257 100644
--- a/src/lib/ecore_drm2/ecore_drm2_crtcs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
@@ -252,3 +252,75 @@ _ecore_drm2_crtcs_destroy(Ecore_Drm2_Device *dev)
         thq = NULL;
      }
 }
+
+Eina_Bool
+_ecore_drm2_crtcs_mode_set(Ecore_Drm2_Crtc *crtc, Ecore_Drm2_Display_Mode *mode)
+{
+   Eina_Bool result = EINA_FALSE;
+   Ecore_Drm2_Crtc_State *cstate;
+   drmModeAtomicReq *req = NULL;
+   int ret = 0;
+
+   cstate = crtc->state.current;
+
+   if (mode)
+     {
+	if (mode->id)
+	  sym_drmModeDestroyPropertyBlob(crtc->fd, mode->id);
+
+	ret =
+	  sym_drmModeCreatePropertyBlob(crtc->fd, &mode->info,
+					sizeof(drmModeModeInfo), &mode->id);
+	if (ret < 0)
+	  {
+	     ERR("Failed to create Mode property blob: %m");
+	     return EINA_FALSE;
+	  }
+     }
+
+   req = sym_drmModeAtomicAlloc();
+   if (!req) return EINA_FALSE;
+
+   sym_drmModeAtomicSetCursor(req, 0);
+
+   if (mode)
+     {
+	cstate->active.value = 1;
+	cstate->mode.value = mode->id;
+     }
+   else
+     cstate->active.value = 0;
+
+   ret = sym_drmModeAtomicAddProperty(req, cstate->obj_id, cstate->mode.id,
+				      cstate->mode.value);
+   if (ret < 0)
+     {
+	ERR("Could not add atomic property: %m");
+	result = EINA_FALSE;
+	goto err;
+     }
+
+   ret = sym_drmModeAtomicAddProperty(req, cstate->obj_id, cstate->active.id,
+				      cstate->active.value);
+   if (ret < 0)
+     {
+	ERR("Could not add atomic property: %m");
+	result = EINA_FALSE;
+	goto err;
+     }
+
+   ret = sym_drmModeAtomicCommit(crtc->fd, req,
+				 DRM_MODE_ATOMIC_ALLOW_MODESET, crtc);
+   if (ret < 0)
+     {
+	ERR("Failed to commit atomic Modeset: %m");
+	result = EINA_FALSE;
+	goto err;
+     }
+
+   result = EINA_TRUE;
+
+err:
+   sym_drmModeAtomicFree(req);
+   return result;
+}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 6e1e06a45d..927930f7cd 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -374,6 +374,7 @@ struct _Ecore_Drm2_Device
 /* internal function prototypes */
 Eina_Bool _ecore_drm2_crtcs_create(Ecore_Drm2_Device *dev);
 void _ecore_drm2_crtcs_destroy(Ecore_Drm2_Device *dev);
+Eina_Bool _ecore_drm2_crtcs_mode_set(Ecore_Drm2_Crtc *crtc, Ecore_Drm2_Display_Mode *mode);
 
 Eina_Bool _ecore_drm2_connectors_create(Ecore_Drm2_Device *dev);
 void _ecore_drm2_connectors_destroy(Ecore_Drm2_Device *dev);

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

Reply via email to