Compare commits

...

3 Commits

Author SHA1 Message Date
Christopher Michael 4a8b57192a ecore_drm2: Ensure display rotation value is filled in during
display_create
2023-01-09 11:45:37 -05:00
Carsten Haitzler 00a44b4169 elm - install elm_widget_item_container_eo.h - fix bug
elm_widget_item_container_eo.h seemingly was not installed. odd. added
to list.

@fix
2023-01-09 11:45:37 -05:00
Carsten Haitzler 3468ca129a elm config tool - fix string mis-use of stale string ptrs from efreet
if efreet updates its in memory db of themes/icons etc. the ptrs you
get from it will be invalid. always dup them out if you keep them
around after going back to main loop control. in this case a tiny
possible leak in stringshare won't ever matter... sot his fixes it

@fix
2023-01-09 11:45:37 -05:00
5 changed files with 119 additions and 14 deletions

View File

@ -2455,7 +2455,8 @@ _status_config_icons(Evas_Object *win,
ic = elm_icon_add(li);
elm_image_file_set(ic, efreet_icon_path_find(th->name.internal, "folder", 48), NULL);
list_it = elm_list_item_append(li, th->name.name, ic, NULL,
_icon_theme_sel, th->name.internal);
_icon_theme_sel,
eina_stringshare_add(th->name.internal));
if (!strcmp(th->name.internal, "hicolor"))
def_it = list_it;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -702,6 +702,7 @@ elementary_pub_headers = [
'elm_view_form_eo.h',
'elm_view_list_eo.h',
'elm_web_eo.legacy.h',
'elm_widget_item_container_eo.h',
'elm_widget_item_container_eo.legacy.h',
'elm_widget_item_eo.legacy.h',
'elm_widget_item_static_focus_eo.legacy.h',