return gl_avail;
}
+EINTERN void
+e_comp_screen_set(E_Comp_Screen *screen)
+{
+ EINA_SAFETY_ON_NULL_RETURN(e_comp);
+
+ e_comp->e_comp_screen = screen;
+}
+
EINTERN void
e_comp_button_bindings_ungrab_all(void)
{
_e_comp_canvas_resize(Ecore_Evas *ee EINA_UNUSED)
{
ecore_evas_geometry_get(ee, NULL, NULL, &e_comp->w, &e_comp->h);
- e_comp_screen_e_screens_setup(e_comp->e_comp_screen, e_comp->w, e_comp->h);
+ e_comp_screen_e_screens_setup(e_comp_screen_get(), e_comp->w, e_comp->h);
e_comp_canvas_update();
}
e_comp->ee_win = ecore_evas_window_get(e_comp->ee);
- screens = (Eina_List *)e_comp_screen_e_screens_get(e_comp->e_comp_screen);
+ screens = (Eina_List *)e_comp_screen_e_screens_get(e_comp_screen_get());
if (screens)
{
E_Screen *scr;
E_Screen *scr;
Eina_Bool changed = EINA_FALSE;
- screens = (Eina_List *)e_comp_screen_e_screens_get(e_comp->e_comp_screen);
+ screens = (Eina_List *)e_comp_screen_e_screens_get(e_comp_screen_get());
if (screens)
{
EINTERN void e_comp_override_timed_pop(void);
EINTERN void e_comp_gl_set(Eina_Bool set);
EINTERN Eina_Bool e_comp_gl_get(void);
+EINTERN void e_comp_screen_set(E_Comp_Screen *screen);
EINTERN void e_comp_button_bindings_grab_all(void);
EINTERN void e_comp_button_bindings_ungrab_all(void);
_e_info_server_cb_output_mode(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
{
Eldbus_Message *reply = eldbus_message_method_return_new(msg);
- E_Comp_Screen *e_comp_screen = NULL;
tdm_display *tdpy = NULL;
int mode = 0, count = 0, output_idx = 0;
if ((mode == E_INFO_CMD_OUTPUT_MODE_GET) ||
(mode == E_INFO_CMD_OUTPUT_MODE_SET))
{
- e_comp_screen = e_comp->e_comp_screen;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
tdpy = e_comp_screen->tdisplay;
if (tdpy != NULL)
}
EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, reply);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, reply);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen_get(), reply);
switch (info)
{
_e_info_server_cb_screen_rotation_pre(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
{
Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
int rotation_pre;
if (!eldbus_message_arguments_get(msg, "i", &rotation_pre))
return reply;
}
- if (!e_comp || !e_comp->e_comp_screen)
+ if (!e_comp_screen)
{
ERR("Error no screen.");
return reply;
}
- e_comp_screen_rotation_pre_set(e_comp->e_comp_screen, rotation_pre);
+ e_comp_screen_rotation_pre_set(e_comp_screen, rotation_pre);
if (e_config->screen_rotation_pre != rotation_pre)
{
_e_info_server_cb_screen_rotation(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
{
Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
int rotation;
if (!eldbus_message_arguments_get(msg, "i", &rotation))
return reply;
}
- if (!e_comp || !e_comp->e_comp_screen)
+ if (!e_comp_screen)
{
ERR("Error no screen.");
return reply;
}
- e_comp_screen_rotation_setting_set(e_comp->e_comp_screen, rotation);
+ e_comp_screen_rotation_setting_set(e_comp_screen, rotation);
return reply;
}
if (!th_data) goto fin;
- e_comp_screen_size_get(e_comp->e_comp_screen, &width, &height);
+ e_comp_screen_size_get(e_comp_screen_get(), &width, &height);
fin:
eldbus_message_arguments_append(reply, "ii", width, height);
}
// FIXME: donot call e_comp_screen function at e_display. move this function to other plane, need refactoring
- e_comp_screen_size_update(e_comp->e_comp_screen);
+ e_comp_screen_size_update(e_comp_screen_get());
e_main_ts_begin("\tE_Hwc Ecore_Evas Init");
if (!e_hwc_ecore_evas_init())
e_display_init(void)
{
E_Display *display;
+ E_Comp_Screen *e_comp_screen;
tdm_display_capability capabilities;
const tbm_format *pp_formats;
tdm_error error = TDM_ERROR_NONE;
if (g_display) return EINA_TRUE;
+ e_comp_screen = e_comp_screen_get();
+ if (!e_comp_screen) return EINA_FALSE;
+
display = E_NEW(E_Display, 1);
EINA_SAFETY_ON_NULL_RETURN_VAL(display, EINA_FALSE);
goto fail;
}
- e_comp->e_comp_screen->tdisplay = display->tdisplay;
+ e_comp_screen->tdisplay = display->tdisplay;
return EINA_TRUE;
{
E_Hwc *hwc = (E_Hwc *)data;
E_Output *output = hwc->output;
- E_Comp_Screen *e_comp_screen = e_comp->e_comp_screen;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
tbm_surface_queue_h tqueue = NULL;
tdm_error error;
int queue_w, queue_h;
E_Output *primary_output = NULL;
Ecore_Evas *ee = NULL;
int w = 0, h = 0, scr_w = 1, scr_h = 1;
+ E_Comp_Screen *e_comp_screen;
E_Hwc *hwc;
int screen_rotation;
char buf[1024];
EHINF("ecore evase engine init.", hwc);
// TODO: fix me. change the screen_rotation into output_rotation.
- screen_rotation = e_comp->e_comp_screen->rotation;
+ e_comp_screen = e_comp_screen_get();
+ if (!e_comp_screen) return EINA_FALSE;
+
+ screen_rotation = e_comp_screen->rotation;
/* set env for use tbm_surface_queue*/
setenv("USE_EVAS_SOFTWARE_TBM_ENGINE", "1", 1);
ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_TBM))
e_comp_gl_set(EINA_TRUE);
- e_comp_screen_size_get(e_comp->e_comp_screen, &scr_w, &scr_h);
+ e_comp_screen_size_get(e_comp_screen, &scr_w, &scr_h);
EHINF("GL available:%d config engine:%d screen size:%dx%d", hwc,
e_comp_gl_get(), e_comp_config_get()->engine, scr_w, scr_h);
/* we apply the screen rotation only for the primary output */
error = tdm_output_get_pipe(output->toutput, &pipe);
if (error == TDM_ERROR_NONE && pipe == 0)
- output->config.rotation = e_comp->e_comp_screen->rotation;
+ {
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
+ if (e_comp_screen)
+ output->config.rotation = e_comp_screen->rotation;
+ }
if (maker)
{
static tbm_surface_queue_h
_get_tbm_surface_queue(E_Comp *e_comp)
{
- return e_comp->e_comp_screen->tqueue;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
+ if (!e_comp_screen) return NULL;
+
+ return e_comp_screen->tqueue;
}
static Eina_Bool
EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
- comp_screen = e_comp->e_comp_screen;
+ comp_screen = e_comp_screen_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_screen, NULL);
toutput = output->toutput;
(plane->pp_rect.h == rect->h))
return EINA_TRUE;
- e_comp_screen = e_comp->e_comp_screen;
+ e_comp_screen = e_comp_screen_get();
e_output_size_get(plane->output, &w, &h);
if (!plane->tpp)
static tbm_surface_queue_h
_get_tbm_surface_queue(Ecore_Evas *ee)
{
- return e_comp->e_comp_screen->tqueue;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
+ if (!e_comp_screen) return NULL;
+
+ return e_comp_screen->tqueue;
}
static void
E_Plane_Renderer_Buffer *renderer_buffer = NULL;
EINA_SAFETY_ON_NULL_RETURN(e_comp);
- EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen);
+ EINA_SAFETY_ON_NULL_RETURN(e_comp_screen_get());
EINA_SAFETY_ON_NULL_RETURN(tsurface);
EINA_SAFETY_ON_NULL_RETURN(data);
E_Plane_Renderer_Buffer *renderer_buffer = NULL;
EINA_SAFETY_ON_NULL_RETURN(e_comp);
- EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen);
+ EINA_SAFETY_ON_NULL_RETURN(e_comp_screen_get());
EINA_SAFETY_ON_NULL_RETURN(tsurface);
EINA_SAFETY_ON_NULL_RETURN(data);
if (!evh->pp)
{
- evh->pp = _e_video_hwc_pp_create(e_comp->e_comp_screen->tdisplay, evh);
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
+ if (e_comp_screen)
+ evh->pp = _e_video_hwc_pp_create(e_comp_screen->tdisplay, evh);
if (!evh->pp)
return EINA_FALSE;
}
_e_video_hwc_planes_iface_check_if_pp_needed(E_Video_Hwc *evh)
{
E_Video_Hwc_Planes *evhp;
+ E_Comp_Screen *e_comp_screen;
int i, count = 0;
const tbm_format *formats;
Eina_Bool found = EINA_FALSE;
goto need_pp;
/* check rotate */
- if (evhp->base.geo.transform || e_comp->e_comp_screen->rotation > 0)
+ e_comp_screen = e_comp_screen_get();
+ if (evhp->base.geo.transform || (e_comp_screen && e_comp_screen->rotation > 0))
if (!(capabilities & TDM_LAYER_CAPABILITY_TRANSFORM))
goto need_pp;
_e_video_hwc_windows_iface_check_if_pp_needed(E_Video_Hwc *evh)
{
E_Video_Hwc_Windows *evhw;
+ E_Comp_Screen *e_comp_screen;
int i, count = 0;
const tbm_format *formats;
Eina_Bool found = EINA_FALSE;
goto need_pp;
/* check rotate */
- if (evhw->base.geo.transform || e_comp->e_comp_screen->rotation > 0)
+ e_comp_screen = e_comp_screen_get();
+ if (evhw->base.geo.transform || (e_comp_screen && e_comp_screen->rotation > 0))
if (!hwc->tdm_hwc_video_transform)
goto need_pp;
_e_comp_screen_dbus_get_cb(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
int rotation = 0;
- if (e_comp && e_comp->e_comp_screen)
- rotation = e_comp->e_comp_screen->rotation;
+ if (e_comp_screen)
+ rotation = e_comp_screen->rotation;
ELOGF("COMP_SCREEN","got screen-rotation 'get' request: %d", NULL, rotation);
static void
_e_comp_screen_dbus_init()
{
- E_Comp_Screen *e_comp_screen = e_comp->e_comp_screen;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
e_comp_screen_iface = eldbus_service_interface_register(edbus_conn,
PATH,
}
else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
{
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
e_comp_wl_input_touch_enabled_set(EINA_TRUE);
- _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
+ if (e_comp_screen)
+ _e_comp_screen_input_rotation_set(e_comp_screen->rotation);
comp->wl_comp_data->touch.num_devices++;
}
e_comp_screen = E_NEW(E_Comp_Screen, 1);
if (!e_comp_screen) return NULL;
- e_comp->e_comp_screen = e_comp_screen;
+ e_comp_screen_set(e_comp_screen);
/* check the screen rotation */
screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
e_main_ts_end("\te_display_init() failed.");
ERR("e_display_init failed");
free(e_comp_screen);
- e_comp->e_comp_screen = NULL;
+ e_comp_screen_set(NULL);
return NULL;
}
if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
free(e_comp_screen);
- e_comp->e_comp_screen = NULL;
+ e_comp_screen_set(NULL);
TRACE_DS_END();
return NULL;
static void
_e_comp_screen_engine_deinit(void)
{
- if (!e_comp) return;
- if (!e_comp->e_comp_screen) return;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
+ if (!e_comp_screen) return;
- _e_comp_screen_del(e_comp->e_comp_screen);
- e_comp->e_comp_screen = NULL;
+ _e_comp_screen_del(e_comp_screen);
+ e_comp_screen_set(NULL);
}
static Eina_Bool
static void
_e_comp_screen_cb_output_connect_status_change(void *data, E_Output *output)
{
- e_comp_screen_size_update(e_comp->e_comp_screen);
+ e_comp_screen_size_update(e_comp_screen_get());
}
static void
_e_comp_screen_cb_output_mode_change(void *data, E_Output *output)
{
- e_comp_screen_size_update(e_comp->e_comp_screen);
+ e_comp_screen_size_update(e_comp_screen_get());
}
EINTERN Eina_Bool
e_comp_screen_init()
{
E_Comp *comp;
+ E_Comp_Screen *e_comp_screen;
int w, h, ptr_x = 0, ptr_y = 0;
if (!(comp = e_comp))
E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_CONNECT_STATUS_CHANGE, _e_comp_screen_cb_output_connect_status_change, comp);
E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_MODE_CHANGE, _e_comp_screen_cb_output_mode_change, comp);
- _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
+ e_comp_screen = e_comp_screen_get();
+ if (e_comp_screen)
+ _e_comp_screen_input_rotation_set(e_comp_screen->rotation);
return EINA_TRUE;
EINTERN void
e_comp_screen_shutdown()
{
- if (!e_comp) return;
- if (!e_comp->e_comp_screen) return;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
+ if (!e_comp_screen) return;
if (e_comp_screen_iface)
{
e_input_shutdown();
/* delete e_comp_sreen */
- _e_comp_screen_del(e_comp->e_comp_screen);
- e_comp->e_comp_screen = NULL;
+ _e_comp_screen_del(e_comp_screen);
+ e_comp_screen_set(NULL);
}
static Eina_Bool
int w = 0, h = 0;
int temp;
E_Comp_Config *comp_conf;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
- if (e_comp->e_comp_screen->num_outputs > 1) //multiple outputs
+ if (e_comp_screen && e_comp_screen->num_outputs > 1) //multiple outputs
{
comp_conf = e_comp_config_get();
if (comp_conf && (comp_conf->input_output_assign_policy == 1)) //use output-assignment policy
Eina_Bool need_assign_output = EINA_FALSE;
const char *output_name;
E_Output *output;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
if (!(evdev->caps & cap)) return;
if (evdev->output_name) return; //already assigned
- if (e_comp->e_comp_screen->num_outputs <= 1) return;
+ if (!e_comp_screen || e_comp_screen->num_outputs <= 1) return;
- last_output_idx = e_comp->e_comp_screen->num_outputs - 1;
+ last_output_idx = e_comp_screen->num_outputs - 1;
EINA_LIST_FOREACH(evdev->seat->devices, l, ed)
{
if (!(ed->caps & cap)) continue;
tbm_bo tbo = NULL;
int fd = -1;
Eina_Bool need_close = EINA_FALSE;
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
int i;
EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, NULL);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen->bufmgr, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->bufmgr, NULL);
info.width = gbm_bo_get_width(gbo);
info.height = gbm_bo_get_height(gbo);
fd = _e_comp_wl_tbm_gbm_bo_fd_get(gbo, &need_close);
EINA_SAFETY_ON_FALSE_GOTO(fd >= 0, end);
- tbo = tbm_bo_import_fd(e_comp->e_comp_screen->bufmgr, fd);
+ tbo = tbm_bo_import_fd(e_comp_screen->bufmgr, fd);
EINA_SAFETY_ON_NULL_GOTO(tbo, end);
tsurface = tbm_surface_internal_create_with_bos(&info, &tbo, 1);
EINTERN Eina_Bool
e_eom_init(void)
{
+ E_Comp_Screen *e_comp_screen;
EINA_SAFETY_ON_NULL_GOTO(e_comp_wl, err);
- if (e_comp->e_comp_screen->num_outputs < 1)
- return EINA_TRUE;
+ e_comp_screen = e_comp_screen_get();
+ if (!e_comp || e_comp_screen->num_outputs < 1)
+ return EINA_FALSE;
g_eom = E_NEW(E_Eom, 1);
EINA_SAFETY_ON_NULL_RETURN_VAL(g_eom, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl->wl.disp, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen_get(), EINA_FALSE);
if (_explicit_sync) return EINA_TRUE;
if (!e_comp_gl_get()) return EINA_FALSE;
tbm_surface_info_s info = {0, };
tbm_bo bos[LINUX_DMABUF_MAX_PLANES] = {0, };
off_t bos_size[LINUX_DMABUF_MAX_PLANES] = {0, };
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
int i = 0;
EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, NULL);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen->bufmgr, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->bufmgr, NULL);
if (!_dmabuf) return NULL;
for (i = 0; i < info.num_planes; i++)
{
+ E_Comp_Screen *e_comp_screen = e_comp_screen_get();
info.planes[i].stride = ds_attributes->stride[i];
info.planes[i].offset = ds_attributes->offset[i];
- bos[i] = tbm_bo_import_fd(e_comp->e_comp_screen->bufmgr, ds_attributes->fd[i]);
+ if (e_comp_screen)
+ bos[i] = tbm_bo_import_fd(e_comp_screen->bufmgr, ds_attributes->fd[i]);
EINA_SAFETY_ON_NULL_GOTO(bos[i], failed);
bos_size[i] = lseek(ds_attributes->fd[i], 0, SEEK_END);