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 1b368c342872b6c1d9954a39c83275e483b40fc9
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Mon Jan 9 11:40:53 2023 -0500
ecore_drm2: Ensure display rotation value is filled in during
display_create
---
src/lib/ecore_drm2/ecore_drm2_displays.c | 66 +++++++++++++++++++++++++-------
src/lib/ecore_drm2/ecore_drm2_planes.c | 59 ++++++++++++++++++++++++++++
src/lib/ecore_drm2/ecore_drm2_private.h | 4 ++
3 files changed, 116 insertions(+), 13 deletions(-)
diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index 47568ea87b..89576bf459 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -454,6 +454,7 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
/* go through list of connectors and create displays */
EINA_LIST_FOREACH(dev->conns, l, c)
{
+ Ecore_Drm2_Plane *plane;
drmModeEncoder *encoder;
drmModeCrtc *dcrtc;
@@ -484,6 +485,46 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
}
}
+ /* try to find primary plane for this display */
+ plane = _ecore_drm2_planes_primary_find(dev, disp->crtc->id);
+ if (plane)
+ {
+ if (plane->state)
+ disp->rotation = plane->state->rotation.value;
+ else
+ {
+ drmModeObjectPropertiesPtr oprops;
+
+ /* NB: Sadly we cannot rely on plane->state being already filled
+ * by the time we reach this (due to threading), so we will query
+ * the plane properties we want directly */
+
+ /* query plane for rotations */
+ oprops =
+ sym_drmModeObjectGetProperties(plane->fd,
+ plane->drmPlane->plane_id,
+ DRM_MODE_OBJECT_PLANE);
+ if (oprops)
+ {
+ unsigned int i = 0;
+
+ for (; i < oprops->count_props; i++)
+ {
+ drmModePropertyPtr prop;
+
+ prop = sym_drmModeGetProperty(plane->fd, oprops->props[i]);
+ if (!prop) continue;
+
+ if (!strcmp(prop->name, "rotation"))
+ disp->rotation = oprops->prop_values[i];
+
+ sym_drmModeFreeProperty(prop);
+ }
+ sym_drmModeFreeObjectProperties(oprops);
+ }
+ }
+ }
+
sym_drmModeFreeCrtc(dcrtc);
disp->fd = dev->fd;
@@ -709,21 +750,20 @@ ecore_drm2_display_info_get(Ecore_Drm2_Display *disp, int *x, int *y, int *w, in
if (x) *x = disp->x;
if (y) *y = disp->y;
- /* FIXME !! */
- /* switch (disp->rotation) */
- /* { */
- /* case ECORE_DRM2_ROTATION_90: */
- /* case ECORE_DRM2_ROTATION_270: */
- /* if (w) *w = disp->current_mode->height; */
- /* if (h) *h = disp->current_mode->width; */
- /* break; */
- /* case ECORE_DRM2_ROTATION_NORMAL: */
- /* case ECORE_DRM2_ROTATION_180: */
- /* default: */
+ switch (disp->rotation)
+ {
+ case ECORE_DRM2_ROTATION_90:
+ case ECORE_DRM2_ROTATION_270:
+ if (w) *w = disp->current_mode->height;
+ if (h) *h = disp->current_mode->width;
+ break;
+ case ECORE_DRM2_ROTATION_NORMAL:
+ case ECORE_DRM2_ROTATION_180:
+ default:
if (w) *w = disp->current_mode->width;
if (h) *h = disp->current_mode->height;
- /* break; */
- /* } */
+ break;
+ }
if (refresh) *refresh = disp->current_mode->refresh;
}
diff --git a/src/lib/ecore_drm2/ecore_drm2_planes.c b/src/lib/ecore_drm2/ecore_drm2_planes.c
index 2dbb03be60..cf26f0b4e4 100644
--- a/src/lib/ecore_drm2/ecore_drm2_planes.c
+++ b/src/lib/ecore_drm2/ecore_drm2_planes.c
@@ -330,3 +330,62 @@ _ecore_drm2_planes_destroy(Ecore_Drm2_Device *dev)
thq = NULL;
}
}
+
+Ecore_Drm2_Plane *
+_ecore_drm2_planes_primary_find(Ecore_Drm2_Device *dev, unsigned int crtc_id)
+{
+ drmModeObjectPropertiesPtr oprops;
+ Ecore_Drm2_Plane *plane;
+ Eina_List *l;
+ unsigned int i = 0;
+
+ if (!dev) return NULL;
+
+ EINA_LIST_FOREACH(dev->planes, l, plane)
+ {
+ Ecore_Drm2_Plane_State *pstate;
+
+ pstate = plane->state;
+ if (pstate)
+ {
+ if (pstate->type.value != DRM_PLANE_TYPE_PRIMARY) continue;
+ if (pstate->cid.value != crtc_id) continue;
+ return plane;
+ }
+ else
+ {
+ uint64_t cid = 0, type = 0;
+
+ /* We need to manually query plane properties here */
+ oprops =
+ sym_drmModeObjectGetProperties(plane->fd,
+ plane->drmPlane->plane_id,
+ DRM_MODE_OBJECT_PLANE);
+ if (!oprops) continue;
+
+ for (i = 0; i < oprops->count_props; i++)
+ {
+ drmModePropertyPtr prop;
+
+ prop = sym_drmModeGetProperty(plane->fd, oprops->props[i]);
+ if (!prop) continue;
+
+ if (!strcmp(prop->name, "CRTC_ID"))
+ cid = oprops->prop_values[i];
+ else if (!strcmp(prop->name, "type"))
+ type = oprops->prop_values[i];
+
+ sym_drmModeFreeProperty(prop);
+ }
+
+ sym_drmModeFreeObjectProperties(oprops);
+
+ if (type != DRM_PLANE_TYPE_PRIMARY) continue;
+ if (cid != crtc_id) continue;
+
+ return plane;
+ }
+ }
+
+ return NULL;
+}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 553dd2db1b..f5eaac376f 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -196,6 +196,9 @@ struct _Ecore_Drm2_Display
uint32_t subpixel;
uint16_t gamma;
+ uint32_t supported_rotations;
+ uint64_t rotation;
+
struct
{
char eisa[13];
@@ -290,6 +293,7 @@ void _ecore_drm2_displays_destroy(Ecore_Drm2_Device *dev);
Eina_Bool _ecore_drm2_planes_create(Ecore_Drm2_Device *dev);
void _ecore_drm2_planes_destroy(Ecore_Drm2_Device *dev);
+Ecore_Drm2_Plane *_ecore_drm2_planes_primary_find(Ecore_Drm2_Device *dev, unsigned int crtc_id);
/* external drm function prototypes (for dlopen) */
extern void *(*sym_drmModeGetResources)(int fd);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.