#include <tdm.h>
#define NUM_MAIN_BUF 2
-#define NUM_PP_BUF 3
-
-/*
- * TODO: remove "flag"
- * TODO: add correct PP conversion of src to dst
- * TODO !!!: remove flickering
- * TODO : deinitialization, free memory
- * TODO !!!: change mechanism of PP and output to external output
- * TODO !!!: remove magic numbers on return and set current buffer and pp buffer
- * TODO : remove EOM_DBG("1\n") etc.
- */
-
+#define NUM_ATTR 3
typedef struct _E_Eom E_Eom, *E_EomPtr;
typedef struct _E_Eom_Out_Mode E_EomOutMode, *E_EomOutModePtr;
tbm_bufmgr bufmgr;
int fd;
+ enum wl_eom_mode eom_mode;
+ enum wl_eom_attribute eom_attribute;
+ enum wl_eom_attribute_state eom_attribute_state;
+ enum wl_eom_status eom_status;
+
/* external output data */
char *ext_output_name;
int is_external_init;
tdm_pp *pp;
tbm_surface_h dst_buffers[NUM_MAIN_BUF];
- tbm_surface_h pp_buffers[NUM_PP_BUF];
int current_buffer;
int pp_buffer;
};
E_EomPtr g_eom = NULL;
static E_Client_Hook *fullscreen_pre_hook = NULL;
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" };
+static int eom_output_attributes[NUM_ATTR][NUM_ATTR] =
+ {
+ {1, 1, 1},
+ {0, 1, 1},
+ {0, 0, 0},
+ };
/* handle external output */
static E_Comp_Wl_Output *_e_eom_e_comp_wl_output_get(const Eina_List *outputs, const char *id);
unsigned int tv_sec EINA_UNUSED, unsigned int tv_usec EINA_UNUSED,
void *user_data);
+static inline enum wl_eom_mode
+_e_eom_get_eom_mode()
+{
+ return g_eom->eom_mode;
+}
+
+static inline void
+_e_eom_set_eom_mode(enum wl_eom_mode mode)
+{
+ g_eom->eom_mode = mode;
+}
+
+static inline enum wl_eom_attribute_state
+_e_eom_get_eom_attribute_state()
+{
+ return g_eom->eom_attribute_state;
+}
+
+static inline void
+_e_eom_set_eom_attribute_state(enum wl_eom_attribute_state attribute_state)
+{
+ g_eom->eom_attribute_state = attribute_state;
+}
+
+static inline enum wl_eom_attribute
+_e_eom_get_eom_attribute()
+{
+ return g_eom->eom_attribute;
+}
+
+static inline int
+_e_eom_set_eom_attribute(enum wl_eom_attribute attribute)
+{
+ if (attribute == WL_EOM_ATTRIBUTE_NONE)
+ {
+ g_eom->eom_attribute = attribute;
+ return 1;
+ }
+
+ if (eom_output_attributes[g_eom->eom_attribute - 1][attribute - 1] == 1)
+ {
+ g_eom->eom_attribute = attribute;
+ return 1;
+ }
+
+ return 0;
+}
+
+static inline enum wl_eom_status
+_e_eom_get_eom_status()
+{
+ return g_eom->eom_status;
+}
+
+static inline void
+_e_eom_set_eom_status(enum wl_eom_status status)
+{
+ g_eom->eom_status = status;
+}
+
static void
_e_eom_pp_cb(tbm_surface_h surface, void *user_data)
{
EOM_DBG("Event 1\n");
if (!user_data)
- {
- EOM_ERR("ERROR: EVENT: user_data is NULL\n");
- return;
- }
+ {
+ EOM_ERR("ERROR: EVENT: user_data is NULL\n");
+ return;
+ }
eom_data = (E_EomDataPtr)user_data;
if (err != TDM_ERROR_NONE)
EOM_DBG("EXT OUTPUT DEINIT: fail unset buffer:%d\n", err);
else
- EOM_DBG("EXT OUTPUT DEINIT: ok unset buffer:%d\n", err);
+ EOM_DBG("EXT OUTPUT DEINIT: ok unset buffer:%d\n", err);
err = tdm_output_commit(g_eom_data.output, 0, NULL, &g_eom_data);
if (err != TDM_ERROR_NONE)
_e_eom_pp_cb, &g_eom_data);
if (g_eom_data.dst_buffers[i])
tbm_surface_destroy(g_eom_data.dst_buffers[i]);
- }
+ }
}
if (g_eom->wl_output)
big_mode = &modes[i];
}
+ /*TODO: fix it*/
if (!big_mode)
{
EOM_ERR("no Big mode\n");
return NULL;
}
- err = tdm_layer_get_capabilities(layer, &capa);
- if (err != TDM_ERROR_NONE)
- {
- EOM_DBG ("tdm_layer_get_capabilities fail(%d)\n", err);
- return NULL;
- }
-
- if (capa & TDM_LAYER_CAPABILITY_PRIMARY)
- {
- EOM_DBG("TDM_LAYER_CAPABILITY_PRIMARY layer found : %d\n", i);
- break;
- }
+ err = tdm_layer_get_capabilities(layer, &capa);
+ if (err != TDM_ERROR_NONE)
+ {
+ EOM_DBG ("tdm_layer_get_capabilities fail(%d)\n", err);
+ return NULL;
+ }
+
+ if (capa & TDM_LAYER_CAPABILITY_PRIMARY)
+ {
+ EOM_DBG("TDM_LAYER_CAPABILITY_PRIMARY layer found : %d\n", i);
+ break;
+ }
}
memset(&layer_info, 0x0, sizeof(tdm_info_layer));
memset(buffer_info.planes[0].ptr, 0xFF, buffer_info.planes[0].size);
tbm_surface_unmap(buffer);
-
eom_data->dst_buffers[0] = buffer;
/*
return NULL;
}
- EOM_DBG("FRAMEBUFFER ECORE_DRM: is_client:%d mode%dx%d\n", fb->from_client, fb->w, fb->h);
+ //EOM_DBG("FRAMEBUFFER ECORE_DRM: is_client:%d mode%dx%d\n", fb->from_client, fb->w, fb->h);
return (tbm_surface_h)fb->hal_buffer;
}
}
g_eom->is_external_init = 1;
+
+ _e_eom_set_eom_attribute_state(WL_EOM_ATTRIBUTE_STATE_ACTIVE);
+ _e_eom_set_eom_status(WL_EOM_STATUS_CONNECTION);
+ _e_eom_set_eom_attribute(WL_EOM_ATTRIBUTE_NONE);
+ _e_eom_set_eom_mode(WL_EOM_MODE_MIRROR);
}
else
{
- _e_eom_deinit_external_output();
g_eom->is_external_init = 0;
g_eom->is_internal_grab = 0;
+
+ _e_eom_set_eom_attribute_state(WL_EOM_ATTRIBUTE_STATE_INACTIVE);
+ _e_eom_set_eom_status(WL_EOM_STATUS_DISCONNECTION);
+ _e_eom_set_eom_attribute(WL_EOM_ATTRIBUTE_NONE);
+ _e_eom_set_eom_mode(WL_EOM_MODE_NONE);
+
+ _e_eom_deinit_external_output();
}
eom_type = _e_eom_output_name_to_eom_type(buff);
/*
EINA_LIST_FOREACH(wl_output->resources, l, output_resource)
{
- if (e->plug)
- {
- EOM_DBG("e->plug:%d\n", e->plug);
- wl_eom_send_output_type(eom->resource,
- output_resource,
- eom_type,
- WL_EOM_STATUS_CONNECTION);
- }
- else
- {
- EOM_DBG("e->plug:%d\n", e->plug);
-
- wl_eom_send_output_type(eom->resource,
+ EOM_DBG("e->plug:%d\n", e->plug);
+
+ wl_eom_send_output_type(eom->resource,
+ output_resource,
+ eom_type,
+ _e_eom_get_eom_status());
+
+ wl_eom_send_output_attribute(eom->resource,
output_resource,
- eom_type,
- WL_EOM_STATUS_DISCONNECTION);
- }
- }
- */
+ _e_eom_get_eom_attribute(),
+ _e_eom_get_eom_attribute_state(),
+ WL_EOM_ERROR_NONE);
+ wl_eom_send_output_mode(eom->resource,
+ output_resource,
+ _e_eom_get_eom_mode());
+ }
+ */
}
else if (strcmp(e->name, "DSI-0") == 0 && g_eom->is_external_init && flag == 2)
{
++flag;
-
end:
return ECORE_CALLBACK_PASS_ON;
}
-
void
_e_eom_set_output(Ecore_Drm_Output * drm_output, tbm_surface_h surface)
{
if (drm_output)
return drm_output;
}
+
return NULL;
}
static void
_e_eom_fullscreen_pre_cb_hook(void *data, E_Client *ec)
{
-
/*
const Eina_List *l;
E_Comp_Wl_Output *ext_output = NULL;
{
EINA_LIST_FOREACH(ext_output->clients, l, o)
{
-
+ ;
}
}
-
-
-
-
drm_output = _e_eom_get_drm_output_for_client(ec);
EINA_SAFETY_ON_NULL_RETURN(drm_output != NULL);
_e_eom_set_output(drm_output, surface);
evas_event_callback_add(ec->frame, EVAS_CALLBACK_RENDER_POST, _e_eom_canvas_render_post, ec);
-
*/
}
static void
_e_eom_wl_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
- E_EomPtr eom = data;
+ enum wl_eom_type eom_type = WL_EOM_TYPE_NONE;
+ struct wl_resource *output_resource;
+ E_Comp_Wl_Output *wl_output = NULL;
struct wl_resource *resource;
+ E_EomPtr eom = data;
+ const Eina_List *l;
resource = wl_resource_create(client,
&wl_eom_interface,
eom->resource = resource;
- if (g_eom->is_external_init && g_eom->is_internal_grab)
+ wl_output = _e_eom_e_comp_wl_output_get(e_comp_wl->outputs, g_eom->ext_output_name);
+ if (!wl_output)
{
- E_Comp_Wl_Output *wl_output = NULL;
- struct wl_resource *output_resource;
- const Eina_List *l;
- enum wl_eom_type eom_type = WL_EOM_TYPE_NONE;
-
- EOM_DBG("send info of external output\n");
-
- wl_output = _e_eom_e_comp_wl_output_get(e_comp_wl->outputs, g_eom->ext_output_name);
- if (!wl_output)
- {
- EOM_DBG("failed to get wl_output\n");
- return;
- }
+ EOM_DBG("failed to get wl_output\n");
+ return;
+ }
- eom_type = _e_eom_output_name_to_eom_type(g_eom->ext_output_name);
- if (eom_type == WL_EOM_TYPE_NONE)
- {
- EOM_DBG("create wl_eom global resource.\n");
- return;
- }
+ eom_type = _e_eom_output_name_to_eom_type(g_eom->ext_output_name);
+ if (eom_type == WL_EOM_TYPE_NONE)
+ {
+ EOM_DBG("create wl_eom global resource.\n");
+ return;
+ }
- EINA_LIST_FOREACH(wl_output->resources, l, output_resource)
- {
- wl_eom_send_output_type(eom->resource,
- output_resource,
- eom_type,
- WL_EOM_STATUS_CONNECTION);
+ EINA_LIST_FOREACH(wl_output->resources, l, output_resource)
+ {
+ wl_eom_send_output_type(eom->resource,
+ output_resource,
+ eom_type,
+ _e_eom_get_eom_status());
- wl_eom_send_output_attribute(eom->resource,
- output_resource,
- WL_EOM_ATTRIBUTE_NORMAL,
- WL_EOM_ATTRIBUTE_STATE_ACTIVE,
- WL_EOM_ERROR_NONE);
- wl_eom_send_output_mode(eom->resource,
+ wl_eom_send_output_attribute(eom->resource,
output_resource,
- WL_EOM_MODE_MIRROR);
- }
+ _e_eom_get_eom_attribute(),
+ _e_eom_get_eom_attribute_state(),
+ WL_EOM_ERROR_NONE);
+
+ wl_eom_send_output_mode(eom->resource,
+ output_resource,
+ _e_eom_get_eom_mode());
}
EOM_DBG("create wl_eom global resource.\n");
EINA_SAFETY_ON_NULL_GOTO(e_comp_wl, err);
-
g_eom = E_NEW(E_Eom, 1);
EINA_SAFETY_ON_NULL_RETURN_VAL(g_eom, EINA_FALSE);
1,
g_eom,
_e_eom_wl_bind_cb);
+
EINA_SAFETY_ON_NULL_GOTO(g_eom->global, err);
ret = _e_eom_init_internal();
g_eom->is_external_init = 0;
g_eom->is_internal_grab = 0;
+ _e_eom_set_eom_attribute_state(WL_EOM_ATTRIBUTE_STATE_NONE);
+ _e_eom_set_eom_attribute(WL_EOM_ATTRIBUTE_NONE);
+ _e_eom_set_eom_status(WL_EOM_STATUS_NONE);
+ _e_eom_set_eom_mode(WL_EOM_MODE_NONE);
+
return EINA_TRUE;
err: