src/bin/e_path.h \
src/bin/e_pixmap.h \
src/bin/e_place.h \
+src/bin/e_plane.h \
src/bin/e_pointer.h \
src/bin/e_prefix.h \
src/bin/e_randr2.h \
src/bin/e_path.c \
src/bin/e_pixmap.c \
src/bin/e_place.c \
+src/bin/e_plane.c \
src/bin/e_pointer.c \
src/bin/e_prefix.c \
src/bin/e_randr2.c \
e_comp->hwc = e_comp_hwc_init();
if (!e_comp->hwc)
WRN("fail to init hwc.");
+
+ E_LIST_FOREACH(e_comp->zones, e_comp_hwc_plane_init);
}
#endif
INF("HWC: hwc trace_debug is %s", onoff?"ON":"OFF");
}
+EINTERN Eina_Bool
+e_comp_hwc_plane_init(E_Zone *zone)
+{
+ E_Comp_Hwc_Output *hwc_output = NULL;
+ E_Comp_Hwc_Layer *hwc_layer;
+ Ecore_Drm_Device *dev;
+ Ecore_Drm_Output *drm_output;
+ E_Randr2_Screen *s;
+ const Eina_List *l, *ll;
+ tdm_layer_capability capa;
+
+ EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev)
+ {
+ EINA_LIST_FOREACH(e_randr2->screens, ll, s)
+ {
+ int len;
+
+ if (!s->config.enabled) continue;
+
+ drm_output = ecore_drm_device_output_name_find(dev, s->info.name);
+ if (!drm_output) continue;
+
+ len = strlen(zone->randr2_id);
+ if (strncmp(s->info.name, zone->randr2_id, len -1) != 0) continue;
+ // DSI-0/(randr2_id) DSI-0(s->info.name)
+
+ hwc_output = _e_comp_hwc_output_find(drm_output);
+ if (hwc_output) break;
+ }
+ }
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_output, EINA_FALSE);
+
+ EINA_LIST_FOREACH_SAFE(hwc_output->hwc_layers, l, ll, hwc_layer)
+ {
+ E_Plane *ep;
+ if (!hwc_layer) continue;
+
+ ep = e_plane_new(zone);
+
+ tdm_layer_get_capabilities(hwc_layer->tlayer, &capa);
+
+ if (capa & (TDM_LAYER_CAPABILITY_PRIMARY))
+ {
+ zone->primary_plane = ep;
+ }
+ }
+
+ return EINA_TRUE;
+}
EINTERN Eina_Bool e_comp_hwc_mode_nocomp(E_Client *ec);
EINTERN void e_comp_hwc_display_client(E_Client *ec);
EINTERN void e_comp_hwc_trace_debug(Eina_Bool onoff);
+EINTERN Eina_Bool e_comp_hwc_plane_init(E_Zone *zone);
# endif
#endif
#include "e_comp_canvas.h"
#include "e_utils.h"
#include "e_hints.h"
+#include "e_plane.h"
#ifdef HAVE_WAYLAND
# include "e_comp_wl.h"
*/
e_zone_init();
e_desk_init();
+ e_plane_init();
TS("E_Screensaver Init");
if (!e_screensaver_init())
e_comp_shutdown();
e_client_shutdown();
+ e_plane_shutdown();
e_desk_shutdown();
e_zone_shutdown();
return 1;
--- /dev/null
+#include "e.h"
+
+/* E_Plane is a child object of E_Zone. There is one zone per screen
+ * in a xinerama setup. Each zone has one or more planes.
+ */
+
+E_API int E_EVENT_PLANE_ADD = 0;
+E_API int E_EVENT_PLANE_DEL = 0;
+
+///////////////////////////////////////////
+
+/* local subsystem functions */
+static void
+_e_plane_free(E_Plane *plane)
+{
+ //printf("@@@@@@@@@@ e_plane_free: %i %i | %i %i %ix%i = %p\n", zone->num, zone->id, zone->x, zone->y, zone->w, zone->h, zone);
+
+ /* Delete the object event callbacks */
+
+ /* remove clients list */
+ eina_list_free(plane->clist);
+
+ /* remove handlers */
+ E_FREE_LIST(plane->handlers, ecore_event_handler_del);
+
+ if (plane->name) eina_stringshare_del(plane->name);
+
+ free(plane);
+}
+
+static void
+_e_plane_reconfigure_clients(E_Plane *plane, int dx, int dy, int dw, int dh)
+{
+ E_Client *ec;
+
+ Eina_List *l, *ll;
+ EINA_LIST_FOREACH_SAFE(plane->clist, l, ll, ec)
+ {
+ if (!ec) break;
+ /* TODO: config ec refer to resolution */
+ }
+}
+
+///////////////////////////////////////////
+
+EINTERN int
+e_plane_init(void)
+{
+ E_EVENT_PLANE_ADD = ecore_event_type_new();
+ E_EVENT_PLANE_DEL = ecore_event_type_new();
+
+ return 1;
+}
+
+EINTERN int
+e_plane_shutdown(void)
+{
+ return 1;
+}
+
+E_API E_Plane *
+e_plane_new(E_Zone *zone)
+{
+ E_Plane *plane;
+
+ char name[40];
+
+ if (!zone) return NULL;
+
+ plane = E_OBJECT_ALLOC(E_Plane, E_PLANE_TYPE, _e_plane_free);
+ if (!plane) return NULL;
+
+ snprintf(name, sizeof(name), "Plane %d", zone->num);
+ plane->name = eina_stringshare_add(name);
+
+ plane->type = E_PLANE_TYPE_INVALID;
+ plane->zone = zone;
+
+ /* config default resolution with zone size*/
+ plane->resolution.x = zone->x;
+ plane->resolution.y = zone->y;
+ plane->resolution.w = zone->w;
+ plane->resolution.h = zone->h;
+
+ zone->planes = eina_list_append(zone->planes, plane);
+
+ printf("@@@@@@@@@@ e_plane_new: %s | %i %i %ix%i = %p\n", zone->randr2_id, plane->resolution.x , plane->resolution.y, plane->resolution.w, plane->resolution.h, zone);
+
+ return plane;
+}
+
+E_API void
+e_plane_name_set(E_Zone *zone,
+ const char *name)
+{
+ E_OBJECT_CHECK(zone);
+ E_OBJECT_TYPE_CHECK(zone, E_PLANE_TYPE);
+
+ if (zone->name) eina_stringshare_del(zone->name);
+ zone->name = eina_stringshare_add(name);
+}
+
+
+E_API Eina_Bool
+e_plane_resolution_set(E_Plane *plane,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+ int dx, dy, dw, dh;
+
+ E_OBJECT_CHECK_RETURN(plane, EINA_FALSE);
+ E_OBJECT_TYPE_CHECK_RETURN(plane, E_PLANE_TYPE, EINA_FALSE);
+
+ if ((x == plane->resolution.x) && (plane->resolution.y) && (w == plane->resolution.w) && (h == plane->resolution.h))
+ return EINA_FALSE;
+
+ plane->resolution.x = x;
+ plane->resolution.y = y;
+ plane->resolution.w = w;
+ plane->resolution.h = h;
+
+ /* TODO: config clist refer to resolution */
+ _e_plane_reconfigure_clients(plane, dx, dy, dw, dh);
+ return EINA_TRUE;
+}
+
+E_API void
+e_plane_type_set(E_Plane *plane, E_Plane_Type_State type)
+{
+ E_OBJECT_CHECK(plane);
+ E_OBJECT_TYPE_CHECK(plane, E_PLANE_TYPE);
+
+ plane->type = type;
+}
+
+E_API E_Plane_Type_State
+e_plane_type_get(E_Plane *plane)
+{
+ E_OBJECT_CHECK_RETURN(plane, E_ZONE_DISPLAY_STATE_OFF);
+ E_OBJECT_TYPE_CHECK_RETURN(plane, E_PLANE_TYPE, E_ZONE_DISPLAY_STATE_OFF);
+
+ return plane->type;
+}
--- /dev/null
+#ifdef E_TYPEDEFS
+
+typedef struct _E_Plane E_Plane;
+
+#else
+#ifndef E_PLANE_H
+#define E_PLANE_H
+
+#define E_PLANE_TYPE (int)0xE0b11001
+
+typedef enum _E_Plane_Type_State
+{
+ E_PLANE_TYPE_INVALID,
+ E_PLANE_TYPE_PRIMARY,
+ E_PLANE_TYPE_SELECTIVE,
+ E_PLANE_TYPE_CURSOR
+} E_Plane_Type_State;
+
+struct _E_Plane
+{
+ E_Object e_obj_inherit;
+
+ struct
+ {
+ int x, y, w, h; // FIXME
+ } resolution;
+
+ const char *name;
+ E_Plane_Type_State type;
+ E_Zone *zone;
+ Eina_List *clist;
+ Eina_List *handlers;
+};
+
+extern E_API int E_EVENT_PLANE_ADD;
+extern E_API int E_EVENT_PLANE_DEL;
+
+EINTERN int e_plane_init(void);
+EINTERN int e_plane_shutdown(void);
+E_API E_Plane * e_plane_new(E_Zone *zone);
+E_API void e_plane_name_set(E_Zone *zone, const char *name);
+E_API Eina_Bool e_plane_resolution_set(E_Plane *plane, int x, int y, int w, int h);
+E_API void e_plane_type_set(E_Plane *plane, E_Plane_Type_State type);
+E_API E_Plane_Type_State e_plane_type_get(E_Plane *plane);
+
+
+#endif
+#endif
_e_zone_free(E_Zone *zone)
{
int x, y;
-
+ E_Plane *ep;
//printf("@@@@@@@@@@ e_zone_free: %i %i | %i %i %ix%i = %p\n", zone->num, zone->id, zone->x, zone->y, zone->w, zone->h, zone);
/* Delete the edge windows if they exist */
E_FREE_FUNC(zone->edge.top, evas_object_del);
/* remove handlers */
E_FREE_LIST(zone->handlers, ecore_event_handler_del);
+ /* remove planes */
+ EINA_LIST_FREE(zone->planes, ep)
+ {
+ if (!e_object_is_del(E_OBJECT(ep)))
+ e_object_free(E_OBJECT(ep));
+ }
+
if (zone->name) eina_stringshare_del(zone->name);
e_comp->zones = eina_list_remove(e_comp->zones, zone);
evas_object_del(zone->bg_event_object);
E_Zone_Display_State display_state;
char *randr2_id; // same id we get from randr2 so look it up there
+
+ Eina_List *planes;
+ E_Plane *primary_plane;
};
struct _E_Event_Zone_Generic