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 1e2517cf079b6f4eb1de832e2db55cdf65508ed1
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Tue Sep 20 12:26:45 2022 -0400
ecore_drm2: Start on code to add Display Modes
---
src/lib/ecore_drm2/ecore_drm2_displays.c | 67 +++++++++++++++++++++++++++++++-
src/lib/ecore_drm2/ecore_drm2_private.h | 2 +
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index 863aa7bbfa..7a19972369 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -217,6 +217,68 @@ _ecore_drm2_display_backlight_get(Ecore_Drm2_Display *disp)
eina_stringshare_del(dev);
}
+static Ecore_Drm2_Display_Mode *
+_ecore_drm2_display_mode_create(const drmModeModeInfo *info)
+{
+ Ecore_Drm2_Display_Mode *mode;
+ uint64_t refresh;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(info, NULL);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL((info->htotal > 0), NULL);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL((info->vtotal > 0), NULL);
+
+ mode = calloc(1, sizeof(Ecore_Drm2_Display_Mode));
+ if (!mode) return NULL;
+
+ mode->flags = 0;
+ mode->width = info->hdisplay;
+ mode->height = info->vdisplay;
+
+ refresh = (info->clock * 1000LL / info->htotal + info->vtotal / 2) /
+ info->vtotal;
+
+ if (info->flags & DRM_MODE_FLAG_INTERLACE)
+ refresh *= 2;
+ if (info->flags & DRM_MODE_FLAG_DBLSCAN)
+ refresh /= 2;
+ if (info->vscan > 1)
+ refresh /= info->vscan;
+
+ mode->refresh = refresh;
+ mode->info = *info;
+
+ if (info->type & DRM_MODE_TYPE_PREFERRED)
+ mode->flags |= DRM_MODE_TYPE_PREFERRED;
+
+ return mode;
+}
+
+static void
+_ecore_drm2_display_modes_get(Ecore_Drm2_Display *disp)
+{
+ int i = 0;
+ drmModeModeInfo crtc_mode;
+ Ecore_Drm2_Display_Mode *dmode;
+
+ memset(&crtc_mode, 0, sizeof(crtc_mode));
+
+ if (disp->crtc->dcrtc->mode_valid)
+ crtc_mode = disp->crtc->dcrtc->mode;
+
+ /* loop through connector modes and try to create mode */
+ for (; i < disp->conn->conn->count_modes; i++)
+ {
+ dmode =
+ _ecore_drm2_display_mode_create(&disp->conn->conn->modes[i]);
+ if (!dmode) continue;
+
+ /* append mode to display mode list */
+ disp->modes = eina_list_append(disp->modes, dmode);
+ }
+
+ /* TODO: select current mode */
+}
+
static void
_ecore_drm2_display_state_fill(Ecore_Drm2_Display *disp)
{
@@ -265,10 +327,11 @@ _ecore_drm2_display_state_fill(Ecore_Drm2_Display *disp)
/* get backlight values */
_ecore_drm2_display_backlight_get(disp);
- /* TODO: create 'modes' */
+ /* get available display modes */
+ _ecore_drm2_display_modes_get(disp);
/* get gamma from crtc */
- disp->gamma = display->crtc->dcrtc->gamma_size;
+ disp->gamma = disp->crtc->dcrtc->gamma_size;
/* get connected state */
disp->connected = (disp->conn->conn->connection == DRM_MODE_CONNECTED);
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 9ab14f77b8..bd8d684dda 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -201,6 +201,8 @@ struct _Ecore_Drm2_Display
Ecore_Drm2_Crtc *crtc;
Ecore_Drm2_Connector *conn;
+ Eina_List *modes;
+
Ecore_Thread *thread;
Eina_Bool primary : 1;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.