add ECORE_DRM event handler 08/42008/5 accepted/tizen/mobile/20150626.103633 accepted/tizen/tv/20150626.103731 submit/tizen/20150626.052837 submit/tizen/20150626.053322 submit/tizen_mobile/20150626.070626 submit/tizen_tv/20150626.070636
authorSooChan Lim <sc1.lim@samsung.com>
Sat, 20 Jun 2015 04:49:49 +0000 (13:49 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 23 Jun 2015 11:10:41 +0000 (20:10 +0900)
- add ECORE_DRM_EVENT_OUTPUT and ECRE_DRM_EVENT_ACTIVATE
- remove error at type and mode

Change-Id: If20f898eb0e62f7719f0faaadadf8be15299e912

protocol/eom-client-protocol.h
protocol/eom-protocol.c
protocol/eom-server-protocol.h
protocol/eom.xml
src/e_mod_main.c

index 404fe56..9f91c45 100644 (file)
@@ -157,25 +157,21 @@ struct wl_eom_listener {
         * @output: (none)
         * @type: (none)
         * @status: (none)
-        * @error: (none)
         */
        void (*output_type)(void *data,
                            struct wl_eom *wl_eom,
                            struct wl_output *output,
                            uint32_t type,
-                           uint32_t status,
-                           uint32_t error);
+                           uint32_t status);
        /**
         * output_mode - (none)
         * @output: (none)
         * @mode: (none)
-        * @error: (none)
         */
        void (*output_mode)(void *data,
                            struct wl_eom *wl_eom,
                            struct wl_output *output,
-                           uint32_t mode,
-                           uint32_t error);
+                           uint32_t mode);
        /**
         * output_attribute - (none)
         * @output: (none)
index 8eafa37..fc7ccc7 100644 (file)
@@ -10,10 +10,8 @@ static const struct wl_interface *types[] = {
        &wl_output_interface,
        NULL,
        NULL,
-       NULL,
        &wl_output_interface,
        NULL,
-       NULL,
        &wl_output_interface,
        NULL,
        NULL,
@@ -25,9 +23,9 @@ static const struct wl_message wl_eom_requests[] = {
 };
 
 static const struct wl_message wl_eom_events[] = {
-       { "output_type", "ouuu", types + 2 },
-       { "output_mode", "ouu", types + 6 },
-       { "output_attribute", "ouuu", types + 9 },
+       { "output_type", "ouu", types + 2 },
+       { "output_mode", "ou", types + 5 },
+       { "output_attribute", "ouuu", types + 7 },
 };
 
 WL_EXPORT const struct wl_interface wl_eom_interface = {
index 07becce..18801cb 100644 (file)
@@ -170,15 +170,15 @@ struct wl_eom_interface {
 #define WL_EOM_OUTPUT_ATTRIBUTE_SINCE_VERSION  1
 
 static inline void
-wl_eom_send_output_type(struct wl_resource *resource_, struct wl_resource *output, uint32_t type, uint32_t status, uint32_t error)
+wl_eom_send_output_type(struct wl_resource *resource_, struct wl_resource *output, uint32_t type, uint32_t status)
 {
-       wl_resource_post_event(resource_, WL_EOM_OUTPUT_TYPE, output, type, status, error);
+       wl_resource_post_event(resource_, WL_EOM_OUTPUT_TYPE, output, type, status);
 }
 
 static inline void
-wl_eom_send_output_mode(struct wl_resource *resource_, struct wl_resource *output, uint32_t mode, uint32_t error)
+wl_eom_send_output_mode(struct wl_resource *resource_, struct wl_resource *output, uint32_t mode)
 {
-       wl_resource_post_event(resource_, WL_EOM_OUTPUT_MODE, output, mode, error);
+       wl_resource_post_event(resource_, WL_EOM_OUTPUT_MODE, output, mode);
 }
 
 static inline void
index ed162a9..94d5ce6 100644 (file)
       <arg name="output" type="object" interface="wl_output"/>
       <arg name="type" type="uint"/>
       <arg name="status" type="uint"/>
-      <arg name="error" type="uint"/>
     </event>
 
     <event name="output_mode">
       <arg name="output" type="object" interface="wl_output"/>
       <arg name="mode" type="uint"/>
-      <arg name="error" type="uint"/>
     </event>
 
     <event name="output_attribute">
index dcf653f..30c4a98 100755 (executable)
@@ -2,6 +2,7 @@
 #include "e.h"
 #include "e_mod_main.h"
 #include "eom-server-protocol.h"
+#include "Ecore_Drm.h"
 
 typedef struct _E_Eom E_Eom, *E_EomPtr;
 
@@ -9,6 +10,7 @@ struct _E_Eom
 {
    E_Comp_Data *cdata;
    struct wl_global *global;
+   struct wl_resource *resource;
    Eina_List *handlers;
 };
 
@@ -16,6 +18,21 @@ E_EomPtr g_eom = NULL;
 
 EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" };
 
+static E_Comp_Wl_Output *
+_e_eom_e_comp_wl_output_get(Eina_List *outputs, const char *id)
+{
+   Eina_List *l;
+   E_Comp_Wl_Output *output;
+
+   EINA_LIST_FOREACH(outputs, l, output)
+     {
+       if (!strcmp(output->id, id))
+         return output;
+     }
+
+   return NULL;
+}
+
 static Eina_Bool
 _e_eom_e_client_remove_cb(void *data, int type, void *event)
 {
@@ -32,6 +49,83 @@ _e_eom_e_client_remove_cb(void *data, int type, void *event)
 }
 
 
+static Eina_Bool
+_e_eom_ecore_drm_output_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+   Ecore_Drm_Event_Output *e;
+   E_EomPtr eom = data;
+   E_Comp_Data *cdata;
+   E_Comp_Wl_Output *output;
+   Eina_List *l2;
+   struct wl_resource *output_resource;
+   enum wl_eom_type eom_type = WL_EOM_TYPE_NONE;
+   char buff[PATH_MAX];
+
+   if (!(e = event)) goto end;
+
+   if (!e->plug) goto end;
+
+   EOM_DBG("id:%d (x,y,w,h):(%d,%d,%d,%d) (w_mm,h_mm):(%d,%d) refresh:%d subpixel_order:%d transform:%d make:%s model:%s plug:%d\n",
+      e->id, e->x, e->y, e->w, e->h, e->phys_width, e->phys_height, e->refresh, e->subpixel_order, e->transform, e->make, e->model, e->plug);
+
+   if (!(cdata = e_comp->wl_comp_data)) goto end;
+
+   snprintf(buff, sizeof(buff), "%d", e->id);
+
+   /* get the e_comp_wl_output */
+   output = _e_eom_e_comp_wl_output_get(cdata->outputs, buff);
+   if (!output)
+     {
+        EOM_ERR("no e_comp_wl_outputs.\n");
+        goto end;
+     }
+
+   /* TODO: we need ecore_drm_output_connector_get()/ecore_drm_output_conn_name_get() function to get the connector type */
+
+
+   /* send notify in each outputs associated with e_comp_wl_output */
+   EINA_LIST_FOREACH(output->resources, l2, output_resource)
+     {
+        if (e->plug)
+           wl_eom_send_output_type(eom->resource,  output_resource, eom_type, WL_EOM_STATUS_CONNECTION);
+        else
+            wl_eom_send_output_type(eom->resource,  output_resource, eom_type, WL_EOM_STATUS_DISCONNECTION);
+     }
+
+#if 0
+   e_comp_wl_output_init(buff, e->make, e->model, e->x, e->y, e->w, e->h,
+                         e->phys_width, e->phys_height, e->refresh,
+                         e->subpixel_order, e->transform);
+#endif
+
+end:
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_eom_ecore_drm_activate_cb(void *data, int type EINA_UNUSED, void *event)
+{
+   Ecore_Drm_Event_Activate *e = NULL;
+   E_EomPtr eom = NULL;
+
+   if ((!event) || (!data)) goto end;
+   e = event;
+   data = eom;
+
+   if (e->active)
+     {
+        /* TODO: something do */
+     }
+   else
+     {
+        /* TODO: something do */
+     }
+
+end:
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+
 /* wl_eom_set_keygrab request handler */
 static void
 _e_eom_wl_request_set_attribute_cb(struct wl_client *client,
@@ -39,12 +133,12 @@ _e_eom_wl_request_set_attribute_cb(struct wl_client *client,
               struct wl_resource *output,
               uint32_t attribute)
 {
-    (void) client;
-    (void) resource;
-    (void) output;
-    (void) attribute;
+   (void) client;
+   (void) attribute;
 
-    EOM_DBG("attribute:%d\n", attribute);
+   EOM_DBG("attribute:%d\n", attribute);
+
+   wl_eom_send_output_attribute(resource, output, attribute, WL_EOM_ATTRIBUTE_STATE_ACTIVE, WL_EOM_ERROR_NONE);
 }
 
 static const struct wl_eom_interface _e_eom_wl_implementation = {
@@ -75,6 +169,8 @@ _e_eom_wl_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32
 
    wl_resource_set_implementation(resource, &_e_eom_wl_implementation, eom, _e_eom_wl_resource_destory_cb);
 
+   eom->resource = resource;
+
    EOM_DBG("create wl_eom global resource.\n");
 }
 
@@ -132,6 +228,8 @@ _e_eom_init()
      }
 
    /* add event hanlders */
+   E_LIST_HANDLER_APPEND(g_eom->handlers, ECORE_DRM_EVENT_ACTIVATE, _e_eom_ecore_drm_activate_cb, g_eom);
+   E_LIST_HANDLER_APPEND(g_eom->handlers, ECORE_DRM_EVENT_OUTPUT, _e_eom_ecore_drm_output_cb, g_eom);
    E_LIST_HANDLER_APPEND(g_eom->handlers, E_EVENT_CLIENT_REMOVE, _e_eom_e_client_remove_cb, g_eom);
 
    return EINA_TRUE;