1 #include "e_client_intern.h"
2 #include "e_utils_intern.h"
3 #include "e_scale_intern.h"
4 #include "e_comp_canvas_intern.h"
5 #include "e_comp_screen_intern.h"
6 #include "e_comp_wl_input_intern.h"
7 #include "e_comp_wl_intern.h"
8 #include "e_explicit_sync_intern.h"
9 #include "e_comp_wl_tizen_hwc_intern.h"
10 #include "e_comp_intern.h"
11 #include "e_input_intern.h"
12 #include "e_input_device_intern.h"
13 #include "e_error_intern.h"
14 #include "e_pointer_intern.h"
15 #include "e_output_intern.h"
16 #include "e_hwc_intern.h"
17 #include "e_hwc_window_intern.h"
18 #include "e_hwc_windows_intern.h"
19 #include "e_egl_sync_intern.h"
20 #include "e_config_intern.h"
21 #include "e_dbus_conn_intern.h"
22 #include "e_main_intern.h"
23 #include "e_hwc_planes_intern.h"
24 #include "e_linux_dmabuf_intern.h"
25 #include "e_comp_input_intern.h"
26 #include "e_screen_rotation_intern.h"
28 #include <tizen-extension-server-protocol.h>
29 #include <device/board-internal.h>
30 #include <tbm_drm_helper.h>
33 #define PATH "/org/enlightenment/wm"
34 #define IFACE "org.enlightenment.wm.screen_rotation"
36 static Ecore_Event_Handler *dbus_init_done_handler;
37 static Eldbus_Connection *edbus_conn = NULL;
38 static Eldbus_Connection_Type edbus_conn_type = ELDBUS_CONNECTION_TYPE_SYSTEM;
39 static Eldbus_Service_Interface *e_comp_screen_iface;
41 static Eina_List *event_handlers = NULL;
42 static Eina_List *output_hooks = NULL;
44 EINTERN int E_EVENT_SCREEN_CHANGE = 0;
48 E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED = 0
51 static Eldbus_Message *
52 _e_comp_screen_dbus_get_cb(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
54 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
57 if (e_comp && e_comp->e_comp_screen)
58 rotation = e_comp->e_comp_screen->rotation;
60 ELOGF("COMP_SCREEN","got screen-rotation 'get' request: %d", NULL, rotation);
62 eldbus_message_arguments_append(reply, "i", rotation);
67 static const Eldbus_Method methods[] =
69 {"get", NULL, ELDBUS_ARGS({"i", "int32"}), _e_comp_screen_dbus_get_cb, 0},
73 static const Eldbus_Signal signals[] = {
74 [E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED] = {"changed", ELDBUS_ARGS({ "i", "rotation" }), 0},
78 static const Eldbus_Service_Interface_Desc iface_desc = {
79 IFACE, methods, signals, NULL, NULL, NULL
83 _e_comp_screen_dbus_init()
85 E_Comp_Screen *e_comp_screen = e_comp->e_comp_screen;
87 e_comp_screen_iface = eldbus_service_interface_register(edbus_conn,
90 EINA_SAFETY_ON_NULL_GOTO(e_comp_screen_iface, err);
92 if (e_comp_screen->rotation)
94 eldbus_service_signal_emit(e_comp_screen_iface, E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED, e_comp_screen->rotation);
95 ELOGF("TRANSFORM", "screen-rotation sends signal: %d", NULL, e_comp_screen->rotation);
103 e_dbus_conn_connection_unref(edbus_conn);
111 _layer_cap_to_str(tdm_layer_capability caps, tdm_layer_capability cap)
115 if (cap == TDM_LAYER_CAPABILITY_CURSOR) return "cursor ";
116 else if (cap == TDM_LAYER_CAPABILITY_PRIMARY) return "primary ";
117 else if (cap == TDM_LAYER_CAPABILITY_OVERLAY) return "overlay ";
118 else if (cap == TDM_LAYER_CAPABILITY_GRAPHIC) return "graphics ";
119 else if (cap == TDM_LAYER_CAPABILITY_VIDEO) return "video ";
120 else if (cap == TDM_LAYER_CAPABILITY_TRANSFORM) return "transform ";
121 else if (cap == TDM_LAYER_CAPABILITY_RESEVED_MEMORY) return "reserved_memory ";
122 else if (cap == TDM_LAYER_CAPABILITY_NO_CROP) return "no_crop ";
123 else return "unkown";
129 _e_comp_screen_commit_idle_cb(void *data EINA_UNUSED)
132 E_Comp_Screen *e_comp_screen = NULL;
133 E_Output *output = NULL;
135 if (!e_comp->e_comp_screen) goto end;
137 if (e_config->comp_canvas_norender.use)
138 evas_norender(e_comp->evas);
140 if (e_comp->canvas_render_delayed) goto end;
142 e_comp_screen = e_comp->e_comp_screen;
144 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
146 if (!output) continue;
147 if (!output->config.enabled) continue;
149 if (!e_output_commit(output))
150 ERR("fail to commit e_comp_screen->outputs.");
152 if (!e_output_render(output))
153 ERR("fail to render e_comp_screen->outputs.");
156 return ECORE_CALLBACK_RENEW;
160 _e_comp_screen_input_rotation_set(int rotation)
167 EINA_LIST_FOREACH(e_input_devices_get(), l, dev)
169 e_input_device_touch_rotation_set(dev, rotation);
170 e_input_device_rotation_set(dev, rotation);
172 ELOGF("COMP_SCREEN","EE Input Device Rotate: %d", NULL, rotation);
178 _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
180 Ecore_Event_Device_Info *e;
183 if (!(e = event)) goto end;
185 if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
187 if (comp->wl_comp_data->ptr.num_devices == 0)
189 e_pointer_object_set(comp->pointer, NULL, 0, 0);
190 e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
192 comp->wl_comp_data->ptr.num_devices++;
194 else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
196 e_comp_wl_input_touch_enabled_set(EINA_TRUE);
197 _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
198 comp->wl_comp_data->touch.num_devices++;
202 return ECORE_CALLBACK_PASS_ON;
206 _e_comp_screen_pointer_renew(void)
208 if ((e_comp_wl->ptr.num_devices == 0) && e_comp_wl->ptr.ec && e_comp_wl->ptr.ec->pointer_enter_sent)
210 if (e_devicemgr->last_device_ptr)
212 Evas_Device *last_ptr = NULL, *dev;
215 const char *description;
217 list = (Eina_List *)evas_device_list(evas_object_evas_get(e_comp_wl->ptr.ec->frame), NULL);
218 EINA_LIST_FOREACH(list, l, dev)
220 name = evas_device_name_get(dev);
221 description = evas_device_description_get(dev);
223 if (!name || !description) continue;
224 if ((!strncmp(name, e_devicemgr->last_device_ptr->name, strlen(e_devicemgr->last_device_ptr->name))) &&
225 (!strncmp(description, e_devicemgr->last_device_ptr->identifier, strlen(e_devicemgr->last_device_ptr->identifier))) &&
226 (evas_device_class_get(dev) == (Evas_Device_Class)e_devicemgr->last_device_ptr->clas))
233 e_comp_wl_mouse_out_renew(e_comp_wl->ptr.ec, 0, wl_fixed_to_int(e_comp_wl->ptr.x), wl_fixed_to_int(e_comp_wl->ptr.y), NULL, NULL, NULL, ecore_time_get(), EVAS_EVENT_FLAG_NONE, last_ptr, NULL);
239 _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
241 Ecore_Event_Device_Info *e;
244 if (!(e = event)) goto end;
246 if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
248 comp->wl_comp_data->ptr.num_devices--;
249 if (comp->wl_comp_data->ptr.num_devices == 0)
251 e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
252 e_pointer_object_set(comp->pointer, NULL, 0, 0);
253 e_pointer_hide(e_comp->pointer);
255 _e_comp_screen_pointer_renew();
258 else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
260 comp->wl_comp_data->touch.num_devices--;
261 if (comp->wl_comp_data->touch.num_devices == 0)
263 e_comp_wl_input_touch_enabled_set(EINA_FALSE);
269 return ECORE_CALLBACK_PASS_ON;
273 _e_comp_screen_size_update(E_Comp_Screen *e_comp_screen)
276 int sum_w = 0, max_h = 0, output_w, output_h;
279 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
281 /* we place external output to the right of primary output */
282 EINA_LIST_FOREACH(e_comp_screen->outputs, l, output)
284 if (!e_output_connected(output)) continue;
286 e_output_size_get(output, &output_w, &output_h);
289 if (max_h < output_h)
293 e_comp_screen->w = sum_w;
294 e_comp_screen->h = max_h;
298 /* rotation should be reset because tbm_surface_queue or gbm_surface of
299 * ecore_evas is created without rotation
300 * and rotation of ecore_evas is reset after it is resized
302 if (e_comp_screen->rotation)
303 ecore_evas_rotation_with_resize_set(e_comp->ee, 0);
305 ecore_evas_resize(e_comp->ee, e_comp_screen->w, e_comp_screen->h);
307 if (e_comp_screen->rotation)
308 ecore_evas_rotation_with_resize_set(e_comp->ee, e_comp_screen->rotation);
315 _e_comp_screen_cb_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
317 E_Comp_Screen *e_comp_screen;
320 if (!(e_comp_screen = data)) return ECORE_CALLBACK_RENEW;
322 ret = tdm_display_handle_events(e_comp_screen->tdisplay);
323 if (ret != TDM_ERROR_NONE)
324 ERR("tdm_display_handle_events failed");
326 return ECORE_CALLBACK_RENEW;
329 static E_Comp_Screen *
330 _e_comp_screen_new(E_Comp *comp)
332 E_Comp_Screen *e_comp_screen = NULL;
333 tdm_error error = TDM_ERROR_NONE;
334 tdm_display_capability capabilities;
335 const tbm_format *pp_formats;
339 e_comp_screen = E_NEW(E_Comp_Screen, 1);
340 if (!e_comp_screen) return NULL;
342 /* tdm display init */
343 e_main_ts_begin("\tTDM Display Init");
344 e_comp_screen->tdisplay = tdm_display_init(&error);
345 if (!e_comp_screen->tdisplay)
347 e_main_ts_end("\tTDM Display Init Failed");
348 ERR("fail to get tdm_display\n");
352 e_main_ts_end("\tTDM Display Init Done");
354 e_comp_screen->gdevice_fd = -1;
355 e_comp_screen->fd = -1;
356 tdm_display_get_fd(e_comp_screen->tdisplay, &fd);
359 ERR("fail to get tdm_display fd\n");
363 e_comp_screen->fd = dup(fd);
365 e_comp_screen->hdlr =
366 ecore_main_fd_handler_add(e_comp_screen->fd, ECORE_FD_READ,
367 _e_comp_screen_cb_event, e_comp_screen, NULL, NULL);
368 /* tdm display init */
369 e_main_ts_begin("\tTBM Bufmgr Server Init");
370 e_comp_screen->bufmgr = tbm_bufmgr_server_init();
371 if (!e_comp_screen->bufmgr)
373 e_main_ts_end("\tTBM Bufmgr Server Init Failed");
374 ERR("tbm_bufmgr_init failed\n");
377 e_main_ts_end("\tTBM Bufmgr Server Init Done");
379 error = tdm_display_get_capabilities(e_comp_screen->tdisplay, &capabilities);
380 if (error != TDM_ERROR_NONE)
382 ERR("tdm get_capabilities failed");
386 /* check the pp_support */
387 if (capabilities & TDM_DISPLAY_CAPABILITY_PP)
389 error = tdm_display_get_pp_available_formats(e_comp_screen->tdisplay, &pp_formats, &count);
390 if (error != TDM_ERROR_NONE)
391 ERR("fail to get available pp formats");
394 e_comp_screen->pp_enabled = EINA_TRUE;
395 for (i = 0 ; i < count ; i++)
396 e_comp_screen->available_pp_formats = eina_list_append(e_comp_screen->available_pp_formats, &pp_formats[i]);
400 e_main_ts_begin("\ttdm-socket Init");
401 if (e_comp_socket_init("tdm-socket"))
402 PRCTL("[Winsys] change permission and create sym link for %s", "tdm-socket");
403 e_main_ts_end("\ttdm-socket Init Done");
405 return e_comp_screen;
408 if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
409 if (e_comp_screen->fd >= 0) close(e_comp_screen->fd);
410 if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr);
411 if (e_comp_screen->tdisplay) tdm_display_deinit(e_comp_screen->tdisplay);
420 _e_comp_screen_del(E_Comp_Screen *e_comp_screen)
422 Eina_List *l = NULL, *ll = NULL;
425 if (!e_comp_screen) return;
427 if (e_comp_screen->pp_enabled)
429 EINA_LIST_FOREACH_SAFE(e_comp_screen->available_pp_formats, l, ll, formats)
431 if (!formats) continue;
432 e_comp_screen->available_pp_formats = eina_list_remove(e_comp_screen->available_pp_formats, l);
436 if (e_comp_screen->gdevice) gbm_device_destroy(e_comp_screen->gdevice);
437 if (e_comp_screen->gdevice_fd >= 0) close(e_comp_screen->gdevice_fd);
438 if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
439 if (e_comp_screen->fd >= 0) close(e_comp_screen->fd);
440 if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr);
441 if (e_comp_screen->tdisplay) tdm_display_deinit(e_comp_screen->tdisplay);
447 _e_comp_screen_output_mode_change_cb(tdm_output *toutput, unsigned int index, void *user_data)
449 E_Comp_Screen *e_comp_screen = user_data;
450 E_Output *output = NULL;
451 Eina_Bool find = EINA_FALSE;
453 E_Output_Mode *set_emode = NULL, *current_emode = NULL;
454 E_Output_Mode *emode = NULL;
455 Eina_List *modelist = NULL, *l, *ll;
457 EINA_SAFETY_ON_NULL_RETURN(e_comp_screen);
459 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
461 if (output->toutput == toutput)
467 EINA_SAFETY_ON_FALSE_RETURN(find == EINA_TRUE);
469 current_emode = e_output_current_mode_get(output);
470 EINA_SAFETY_ON_NULL_RETURN(current_emode);
472 modelist = e_output_mode_list_get(output);
475 num = eina_list_count(modelist);
476 EINA_SAFETY_ON_FALSE_RETURN(index < num);
479 EINA_LIST_FOREACH(modelist, l, emode)
491 EINA_SAFETY_ON_TRUE_RETURN(current_emode == set_emode);
493 ELOGF("COMP_SCREEN","request mode change(%d) (%dx%d, %lf) -> (%dx%d, %lf)\n",
494 NULL, index, current_emode->w, current_emode->h, current_emode->refresh,
495 set_emode->w, set_emode->h, set_emode->refresh);
497 e_output_external_mode_change(output, set_emode);
503 _e_comp_screen_output_destroy_cb(tdm_output *toutput, void *user_data)
505 E_Comp_Screen *e_comp_screen = user_data;
506 E_Output *output = NULL;
509 EINA_SAFETY_ON_NULL_RETURN(e_comp_screen);
511 tdm_output_remove_destroy_handler(toutput, _e_comp_screen_output_destroy_cb, e_comp_screen);
513 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
515 if (output->toutput == toutput)
517 e_comp_screen->num_outputs--;
518 e_comp_screen->outputs = eina_list_remove_list(e_comp_screen->outputs, l);
519 e_output_del(output);
525 _e_comp_screen_output_create_cb(tdm_display *dpy, tdm_output *toutput, void *user_data)
527 E_Comp_Screen *e_comp_screen = user_data;
528 E_Output *output = NULL;
529 tdm_error ret = TDM_ERROR_NONE;
531 EINA_SAFETY_ON_NULL_RETURN(e_comp_screen);
533 TRACE_DS_BEGIN(OUTPUT:NEW);
534 output = e_output_new(e_comp_screen, e_comp_screen->num_outputs);
535 EINA_SAFETY_ON_NULL_GOTO(output, fail);
536 if (output->toutput != toutput) goto fail;
539 TRACE_DS_BEGIN(OUTPUT:UPDATE);
540 if (!e_output_update(output))
542 ERR("fail to e_output_update.");
543 e_output_del(output);
548 /* todo : add tdm_output_add_mode_change_request_handler()*/
549 ret = tdm_output_add_mode_change_request_handler(toutput, _e_comp_screen_output_mode_change_cb, e_comp_screen);
550 if (ret != TDM_ERROR_NONE)
552 ERR("fail to add output mode change handler.");
553 e_output_del(output);
557 ret = tdm_output_add_destroy_handler(toutput, _e_comp_screen_output_destroy_cb, e_comp_screen);
558 if (ret != TDM_ERROR_NONE)
560 ERR("fail to add output destroy handler.");
561 e_output_del(output);
565 e_comp_screen->outputs = eina_list_append(e_comp_screen->outputs, output);
566 e_comp_screen->num_outputs++;
575 _e_comp_screen_deinit_outputs(E_Comp_Screen *e_comp_screen)
580 tdm_display_remove_output_create_handler(e_comp_screen->tdisplay, _e_comp_screen_output_create_cb, e_comp_screen);
582 e_hwc_ecore_evas_deinit();
585 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
587 e_comp_screen->outputs = eina_list_remove_list(e_comp_screen->outputs, l);
588 e_output_del(output);
591 e_explicit_sync_deinit();
594 e_hwc_windows_deinit();
595 e_hwc_planes_deinit();
600 _e_comp_screen_fake_output_set(E_Comp_Screen *e_comp_screen)
602 E_Output *primary_output = NULL;
604 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
606 primary_output = e_comp_screen_primary_output_get(e_comp_screen);
607 EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE);
609 if (!e_output_hwc_setup(primary_output))
611 ERR("fail to e_output_hwc_setup.");
615 if (!e_output_fake_config_set(primary_output, 2, 1))
617 e_error_message_show(_("Fail to set the fake output config!\n"));
618 e_hwc_ecore_evas_deinit();
626 _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen)
628 E_Output *output = NULL;
629 E_Output_Mode *mode = NULL;
630 tdm_display *tdisplay = e_comp_screen->tdisplay;
633 Eina_Bool scale_updated = EINA_FALSE;
634 Eina_Bool connection_check = EINA_FALSE;
635 tdm_error err = TDM_ERROR_NONE;
640 if (!e_output_init())
642 ERR("fail to e_output_init.");
646 /* get the num of outputs */
647 err = tdm_display_get_output_count(tdisplay, &num_outputs);
648 if ((err != TDM_ERROR_NONE) ||
651 ERR("fail to get tdm_display_get_output_count\n");
654 e_comp_screen->num_outputs = num_outputs;
656 ELOGF("COMP_SCREEN","num_outputs = %i", NULL, e_comp_screen->num_outputs);
660 ERR("e_hwc_init failed");
664 if (!e_hwc_planes_init())
666 ERR("e_hwc_planes_init failed");
670 if (!e_hwc_windows_init())
672 ERR("e_hwc_windows_init failed");
676 for (i = 0; i < num_outputs; i++)
678 e_main_ts_begin("\tE_Output New");
679 output = e_output_new(e_comp_screen, i);
682 e_main_ts_end("\tE_Output New Failed");
686 e_main_ts_begin("\tE_Output Update");
687 if (!e_output_update(output))
689 e_main_ts_end("\tE_Output Update Failed");
690 ERR("fail to e_output_update.");
693 e_main_ts_end("\tE_Output Update Done");
695 e_comp_screen->outputs = eina_list_append(e_comp_screen->outputs, output);
697 if (!e_output_connected(output)) continue;
699 connection_check = EINA_TRUE;
701 /* setting with the best mode and enable the output */
702 e_main_ts_begin("\tE_Output Find Best Mode");
703 mode = e_output_best_mode_find(output);
706 e_main_ts_end("\tE_Output Find Best Mode Failed");
707 ERR("fail to get best mode.");
710 e_main_ts_end("\tE_Output Find Best Mode Done");
712 e_main_ts_begin("\tE_Output Mode Apply");
713 if (!e_output_mode_apply(output, mode))
715 e_main_ts_end("\tE_Output Mode Apply Failed");
716 ERR("fail to e_output_mode_apply.");
719 e_main_ts_end("\tE_Output Mode Apply Done");
721 e_main_ts_begin("\tE_Output Set DPMS ON");
722 ret = device_board_get_boot_mode(bootmode, sizeof(bootmode));
723 if (!ret && !e_util_strcmp(bootmode, "silent"))
725 INF("silent reboot. do not set dpms");
729 if (!e_output_dpms_set(output, E_OUTPUT_DPMS_ON))
731 e_main_ts_end("\tE_Output Set DPMS ON Failed");
732 ERR("fail to e_output_dpms.");
737 e_main_ts_end("\tE_Output Set DPMS ON Done");
739 e_main_ts_begin("\tE_Output Hwc Setup");
740 if (!e_output_hwc_setup(output))
742 e_main_ts_end("\tE_Output Hwc Setup Failed");
743 ERR("fail to e_output_hwc_setup.");
746 e_main_ts_end("\tE_Output Hwc Setup Done");
748 /* update e_scale with first available output size */
749 if ((e_config->scale.for_tdm) && (!scale_updated))
754 target_inch = (round((sqrt(output->info.size.w * output->info.size.w + output->info.size.h * output->info.size.h) / 25.4) * 10) / 10);
755 dpi = (round((sqrt(mode->w * mode->w + mode->h * mode->h) / target_inch) * 10) / 10);
757 e_scale_manual_update(dpi);
758 scale_updated = EINA_TRUE;
762 //TODO: if there is no output connected, make the fake output which is connected.
763 if (!connection_check)
765 if (!_e_comp_screen_fake_output_set(e_comp_screen))
769 _e_comp_screen_size_update(e_comp_screen);
771 e_main_ts_begin("\tE_Hwc Ecore_Evas Init");
772 if (!e_hwc_ecore_evas_init())
774 e_main_ts_end("\ttE_Hwc Ecore_Evas Init Failed");
775 ERR("fail to e_hwc_ecore_evas_init");
778 e_main_ts_end("\tE_Hwc Ecore_Evas Init Done");
780 if (tdm_display_add_output_create_handler(tdisplay, _e_comp_screen_output_create_cb, e_comp_screen)) goto fail;
784 _e_comp_screen_deinit_outputs(e_comp_screen);
790 _e_comp_screen_e_screen_free(E_Screen *scr)
797 _e_comp_screen_e_screens_set(E_Comp_Screen *e_comp_screen, Eina_List *screens)
799 E_FREE_LIST(e_comp_screen->e_screens, _e_comp_screen_e_screen_free);
800 e_comp_screen->e_screens = screens;
804 _e_comp_screen_engine_deinit(void)
807 if (!e_comp->e_comp_screen) return;
809 _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
810 _e_comp_screen_del(e_comp->e_comp_screen);
811 e_comp->e_comp_screen = NULL;
815 _e_comp_screen_engine_init(void)
817 E_Comp_Screen *e_comp_screen = NULL;
820 /* check the screen rotation */
821 screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
823 ELOGF("COMP_SCREEN","screen_rotation_pre %d and screen_rotation_setting %d",
824 NULL, e_config->screen_rotation_pre, e_config->screen_rotation_setting);
826 /* e_comp_screen new */
827 e_main_ts_begin("\tE_Comp_Screen New");
828 e_comp_screen = _e_comp_screen_new(e_comp);
831 e_main_ts_end("\tE_Comp_Screen New Failed");
832 e_error_message_show(_("Enlightenment cannot create e_comp_screen!\n"));
835 e_main_ts_end("\tE_Comp_Screen New Done");
837 e_comp->e_comp_screen = e_comp_screen;
838 e_comp_screen->rotation_pre = e_config->screen_rotation_pre;
839 e_comp_screen->rotation_setting = e_config->screen_rotation_setting;
840 e_comp_screen->rotation = screen_rotation;
842 e_main_ts_begin("\tE_Comp_Screen Outputs Init");
843 if (!_e_comp_screen_init_outputs(e_comp_screen))
845 e_main_ts_end("\tE_Comp_Screen Outputs Init Failed");
846 e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
847 _e_comp_screen_engine_deinit();
850 e_main_ts_end("\tE_Comp_Screen Outputs Init Done");
852 if (!E_EVENT_SCREEN_CHANGE) E_EVENT_SCREEN_CHANGE = ecore_event_type_new();
854 ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
856 e_comp_screen_e_screens_setup(e_comp_screen, -1, -1);
858 /* update the screen, outputs and planes at the idle enterer of the ecore_loop */
859 ecore_idle_enterer_add(_e_comp_screen_commit_idle_cb, e_comp);
865 _e_comp_screen_cb_dbus_init_done(void *data, int type, void *event)
867 E_DBus_Conn_Init_Done_Event *e = event;
869 if (e->status == E_DBUS_CONN_INIT_SUCCESS && e->conn_type == edbus_conn_type)
871 edbus_conn = e_dbus_conn_connection_ref(edbus_conn_type);
874 _e_comp_screen_dbus_init();
877 ecore_event_handler_del(dbus_init_done_handler);
878 dbus_init_done_handler = NULL;
880 return ECORE_CALLBACK_PASS_ON;
884 e_comp_screen_e_screens_setup(E_Comp_Screen *e_comp_screen, int rw, int rh)
888 Eina_List *e_screens = NULL;
890 int i = 0, right_x = 0;
892 output = e_comp_screen_primary_output_get(e_comp_screen);
893 /* No pirmary output means that there is no output at the system */
894 if (!output) goto out;
896 EINA_LIST_FOREACH(e_comp_screen->outputs, l, output)
898 screen = E_NEW(E_Screen, 1);
901 screen->escreen = screen->screen = i;
903 if (output->config.rotation % 180)
905 screen->w = output->config.geom.h;
906 screen->h = output->config.geom.w;
910 screen->w = output->config.geom.w;
911 screen->h = output->config.geom.h;
914 if (e_output_connected(output))
916 output->config.geom.x = right_x;
917 right_x += output->config.geom.w;
921 output->config.geom.x = 0;
924 screen->x = output->config.geom.x;
925 screen->y = output->config.geom.y;
927 if (output->id) screen->id = strdup(output->id);
929 e_screens = eina_list_append(e_screens, screen);
930 ELOGF("COMP_SCREEN","E INIT: SCREEN: [%i][%i], %ix%i+%i+%i",
931 NULL, i, i, screen->w, screen->h, screen->x, screen->y);
935 ELOGF("COMP_SCREEN","e_comp_screen_e_screens_setup............... %i %p\n", NULL, i, e_comp_screen->e_screens);
937 ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
939 _e_comp_screen_e_screens_set(e_comp_screen, e_screens);
943 screen = E_NEW(E_Screen, 1);
945 screen->escreen = screen->screen = 0;
948 if ((rw > 0) && (rh > 0))
949 screen->w = rw, screen->h = rh;
952 if (e_comp_screen->rotation % 180)
953 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &screen->h, &screen->w);
955 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &screen->w, &screen->h);
957 e_screens = eina_list_append(e_screens, screen);
959 ELOGF("COMP_SCREEN","E INIT: SCREEN: No Physical Screen : [%i][%i], %ix%i+%i+%i",
960 NULL, i, i, screen->w, screen->h, screen->x, screen->y);
962 _e_comp_screen_e_screens_set(e_comp_screen, e_screens);
965 EINTERN const Eina_List *
966 e_comp_screen_e_screens_get(E_Comp_Screen *e_comp_screen)
968 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
970 return e_comp_screen->e_screens;
974 _e_comp_screen_cb_output_connect_status_change(void *data, E_Output *output)
976 _e_comp_screen_size_update(e_comp->e_comp_screen);
980 _e_comp_screen_cb_output_mode_change(void *data, E_Output *output)
982 _e_comp_screen_size_update(e_comp->e_comp_screen);
989 int w, h, ptr_x = 0, ptr_y = 0;
991 if (!(comp = e_comp))
992 EINA_SAFETY_ON_NULL_RETURN_VAL(comp, EINA_FALSE);
994 e_main_ts_begin("\tE_Comp_Screen_Engine Init");
995 if (!_e_comp_screen_engine_init())
997 e_main_ts_end("\tE_Comp_Screen_Engine Init Failed");
998 ERR("Could not initialize the ecore_evas engine.");
999 goto failed_comp_screen;
1001 e_main_ts_end("\tE_Comp_Screen_Engine Init Done");
1003 e_main_ts_begin("\tE_Input Init");
1004 if (!e_input_init(e_comp->ee))
1006 e_main_ts_end("\tE_Input Init Failed");
1007 ERR("Could not initialize the e_input.");
1008 goto failed_comp_screen;
1010 e_main_ts_end("\tE_Input Init Done");
1012 e_main_ts_begin("\tE_Comp_Wl Init");
1013 if (!e_comp_wl_init())
1015 e_main_ts_begin("\tE_Comp_Wl Init Failed");
1016 goto failed_comp_screen;
1018 e_main_ts_end("\tE_Comp_Wl Init Done");
1020 /* get the current screen geometry */
1021 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
1024 e_main_ts_begin("\tE_Comp_Canvas Init");
1025 if (!e_comp_canvas_init(w, h))
1027 e_main_ts_end("\tE_Comp_Canvas Init Failed");
1028 e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
1029 goto failed_comp_screen;
1031 e_main_ts_end("\tE_Comp_Canvas Init Done");
1033 e_main_ts_begin("\tE_Egl_Sync Init");
1034 if (e_egl_sync_init())
1035 ELOGF("E_EGL_SYNC", "Enabled the E_Egl_Sync", NULL);
1036 e_main_ts_end("\tE_Egl_Sync Init Done");
1038 e_main_ts_begin("\tE_Explicit_Sync Init");
1039 if (e_explicit_sync_init())
1040 ELOGF("EX-SYNC", "Enabled the E_Explicit_Sync", NULL);
1041 e_main_ts_end("\tE_Explicit_Sync Init Done");
1043 e_main_ts_begin("\tE_Linux_Dmabuf Init");
1044 e_linux_dmabuf_init(e_comp_wl->wl.disp);
1045 e_main_ts_end("\tE_Linux_Dmabuf Init Done");
1048 e_input_device_pointer_xy_get(NULL, &ptr_x, &ptr_y);
1049 e_comp_wl->ptr.x = wl_fixed_from_int(ptr_x);
1050 e_comp_wl->ptr.y = wl_fixed_from_int(ptr_y);
1052 evas_event_feed_mouse_in(e_comp->evas, 0, NULL);
1054 e_main_ts_begin("\tE_Pointer New");
1055 if ((comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE)))
1057 e_pointer_hide(comp->pointer);
1059 e_main_ts_end("\tE_Pointer New Done");
1061 /* FIXME: We need a way to trap for user changing the keymap inside of E
1062 * without the event coming from X11 */
1064 /* FIXME: We should make a decision here ...
1066 * Fetch the keymap from drm, OR set this to what the E config is....
1069 /* FIXME: This is just for testing at the moment....
1070 * happens to jive with what drm does */
1072 if (!e_input_thread_mode_get())
1074 e_main_ts_begin("\tE_Comp_WL Keymap Init");
1075 e_comp_wl_input_keymap_init();
1076 e_main_ts_begin("\tE_Comp_WL Keymap Init Done");
1079 if (!e_screen_rotation_init())
1081 e_main_ts_end("\e_screen_rotation_init Init Failed");
1082 goto failed_comp_screen;
1085 if (!e_comp_wl_tizen_hwc_init())
1087 e_main_ts_end("\e_comp_wl_tizen_hwc_init Init Failed");
1088 e_error_message_show(_("Enlightenment cannot initialize tizen_hwc!\n"));
1089 goto failed_comp_screen;
1092 e_main_ts_begin("\tDBUS Init");
1093 dbus_init_done_handler = NULL;
1094 if (e_dbus_conn_init() > 0)
1096 dbus_init_done_handler = ecore_event_handler_add(E_EVENT_DBUS_CONN_INIT_DONE, _e_comp_screen_cb_dbus_init_done, NULL);
1097 e_dbus_conn_dbus_init(edbus_conn_type);
1099 e_main_ts_end("\tDBUS Init Done");
1101 E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_ADD, _e_comp_screen_cb_input_device_add, comp);
1102 E_LIST_HANDLER_PREPEND(event_handlers, ECORE_EVENT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
1104 E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_CONNECT_STATUS_CHANGE, _e_comp_screen_cb_output_connect_status_change, comp);
1105 E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_MODE_CHANGE, _e_comp_screen_cb_output_mode_change, comp);
1107 _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
1113 e_screen_rotation_shutdown();
1114 e_comp_wl_tizen_hwc_shutdown();
1116 _e_comp_screen_engine_deinit();
1122 e_comp_screen_shutdown()
1124 if (!e_comp) return;
1125 if (!e_comp->e_comp_screen) return;
1127 e_screen_rotation_shutdown();
1128 e_comp_wl_tizen_hwc_shutdown();
1130 if (e_comp_screen_iface)
1132 eldbus_service_interface_unregister(e_comp_screen_iface);
1133 e_comp_screen_iface = NULL;
1138 e_dbus_conn_connection_unref(edbus_conn);
1142 e_dbus_conn_shutdown();
1144 _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
1146 E_FREE_LIST(output_hooks, e_output_hook_del);
1148 E_FREE_LIST(event_handlers, ecore_event_handler_del);
1150 /* delete e_comp_sreen */
1151 _e_comp_screen_del(e_comp->e_comp_screen);
1152 e_comp->e_comp_screen = NULL;
1156 _e_comp_screen_output_find_primary(E_Comp_Screen *e_comp_screen)
1158 E_Output *output = NULL, *o;
1161 EINA_LIST_FOREACH(e_comp_screen->outputs, l, o)
1163 unsigned int pipe = 0;
1166 error = tdm_output_get_pipe(o->toutput, &pipe);
1167 if (error != TDM_ERROR_NONE || pipe != 0)
1176 ERR("couldn't find the primary output");
1184 _e_comp_screen_rotation_set(E_Comp_Screen *e_comp_screen, int screen_rotation,
1185 void (*setter)(E_Comp_Screen *e_comp_screen, int data), int data)
1187 E_Output *output = NULL;
1188 E_Input_Device *dev;
1192 output = _e_comp_screen_output_find_primary(e_comp_screen);
1196 if (!e_output_rotate(output, screen_rotation))
1199 e_comp_screen->rotation = screen_rotation;
1201 setter(e_comp_screen, data);
1203 ecore_evas_rotation_with_resize_set(e_comp->ee, e_comp_screen->rotation);
1204 ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
1206 /* rendering forcely to prepare HWC */
1207 e_comp_render_queue();
1208 e_comp_hwc_end(__FUNCTION__);
1210 EINA_LIST_FOREACH(e_input_devices_get(), l, dev)
1212 e_input_device_touch_rotation_set(dev, e_comp_screen->rotation);
1213 e_input_device_rotation_set(dev, e_comp_screen->rotation);
1215 ELOGF("COMP_SCREEN","EE Input Device Rotate: %d", NULL, e_comp_screen->rotation);
1218 if (e_comp_screen_iface)
1220 eldbus_service_signal_emit(e_comp_screen_iface, E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED, e_comp_screen->rotation);
1221 ELOGF("COMP_SCREEN", "screen-rotation sends signal: %d", NULL, e_comp_screen->rotation);
1224 ELOGF("COMP_SCREEN","EE Rotated and Resized: %d, %dx%d", NULL, e_comp_screen->rotation, w, h);
1230 _e_comp_screen_rotation_pre_setter(E_Comp_Screen *e_comp_screen, int rotation_pre)
1232 e_comp_screen->rotation_pre = rotation_pre;
1233 ELOGF("COMP_SCREEN","EE RotationPre: %d", NULL, rotation_pre);
1237 e_comp_screen_rotation_pre_set(E_Comp_Screen *e_comp_screen, int rotation_pre)
1239 int screen_rotation;
1241 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1242 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre % 90, EINA_FALSE);
1243 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre < 0, EINA_FALSE);
1244 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre > 270, EINA_FALSE);
1246 if (e_comp_screen->rotation_pre == rotation_pre) return EINA_TRUE;
1248 screen_rotation = (rotation_pre + e_comp_screen->rotation_setting) % 360;
1250 return _e_comp_screen_rotation_set(e_comp_screen, screen_rotation,
1251 _e_comp_screen_rotation_pre_setter, rotation_pre);
1255 _e_comp_screen_rotation_setting_setter(E_Comp_Screen *e_comp_screen, int rotation)
1257 e_comp_screen->rotation_setting = rotation;
1258 ELOGF("COMP_SCREEN","EE RotationSetting: %d", NULL, rotation);
1262 e_comp_screen_rotation_setting_set(E_Comp_Screen *e_comp_screen, int rotation)
1264 int screen_rotation;
1266 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1267 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation % 90, EINA_FALSE);
1268 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation < 0, EINA_FALSE);
1269 EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation > 270, EINA_FALSE);
1271 if (e_comp_screen->rotation_setting == rotation) return EINA_TRUE;
1273 screen_rotation = (e_comp_screen->rotation_pre + rotation) % 360;
1275 return _e_comp_screen_rotation_set(e_comp_screen, screen_rotation,
1276 _e_comp_screen_rotation_setting_setter, rotation);
1280 e_comp_screen_rotation_ignore_output_transform_send(E_Client *ec, Eina_Bool ignore)
1282 /* if client have to considers the output transform */
1286 if (e_config->screen_rotation_client_ignore)
1288 ELOGF("TRANSFORM", "|ignore_output_transform: client_ignore", ec);
1292 if (e_policy_client_is_quickpanel(ec))
1294 ELOGF("TRANSFORM", "|ignore_output_transform: quickpanel", ec);
1299 e_screen_rotation_ignore_output_transform_send(ec, ignore);
1303 e_comp_screen_primary_output_get(E_Comp_Screen *e_comp_screen)
1305 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
1307 E_Output *output = NULL, *o = NULL;
1308 Eina_List *l = NULL;
1309 int highest_priority = 0;
1311 /* find the highest priority of the e_output */
1312 EINA_LIST_FOREACH(e_comp_screen->outputs, l, o)
1314 if (highest_priority < o->config.priority)
1316 highest_priority = o->config.priority;
1325 e_comp_screen_pp_support(void)
1327 E_Comp_Screen *e_comp_screen = NULL;
1328 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE);
1330 e_comp_screen = e_comp->e_comp_screen;
1331 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1332 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->tdisplay, EINA_FALSE);
1334 return e_comp_screen->pp_enabled;
1339 e_comp_screen_pp_available_formats_get(void)
1341 E_Comp_Screen *e_comp_screen = NULL;
1342 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE);
1344 e_comp_screen = e_comp->e_comp_screen;
1345 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1346 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->tdisplay, EINA_FALSE);
1348 if (!e_comp_screen->pp_enabled)
1350 ERR("pp does not support.");
1354 return e_comp_screen->available_pp_formats;
1358 e_comp_screen_hwc_info_debug(void)
1360 EINA_SAFETY_ON_NULL_RETURN(e_comp);
1361 EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen);
1363 E_Comp_Screen *e_comp_screen = e_comp->e_comp_screen;
1364 E_Output *output = NULL;
1365 E_Plane *plane = NULL;
1366 Eina_List *l_o, *ll_o;
1367 Eina_List *l_l, *ll_l;
1368 tdm_output_conn_status conn_status;
1370 tdm_layer_capability layer_capabilities;
1371 char layer_cap[4096] = {0, };
1373 const tdm_prop *tprops;
1376 INF("HWC: HWC Information ==========================================================");
1377 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l_o, ll_o, output)
1379 tdm_error err = TDM_ERROR_NONE;
1381 if (!output) continue;
1383 if (e_hwc_policy_get(output->hwc) == E_HWC_POLICY_PLANES)
1385 err = tdm_output_get_conn_status(output->toutput, &conn_status);
1386 if (err != TDM_ERROR_NONE) continue;
1387 if (conn_status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) continue;
1389 INF("HWC: HWC Output(%d):(x, y, w, h)=(%d, %d, %d, %d) Information.",
1391 output->config.geom.x, output->config.geom.y, output->config.geom.w, output->config.geom.h);
1392 INF("HWC: num_layers=%d", output->plane_count);
1393 EINA_LIST_FOREACH_SAFE(output->planes, l_l, ll_l, plane)
1395 if (!plane) continue;
1396 /* FIXME: hwc extension doesn't provide thing like layer */
1397 tdm_layer_get_capabilities(plane->tlayer, &layer_capabilities);
1398 snprintf(layer_cap, sizeof(layer_cap), "%s%s%s%s%s%s%s%s",
1399 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_CURSOR),
1400 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_PRIMARY),
1401 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_OVERLAY),
1402 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_GRAPHIC),
1403 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_VIDEO),
1404 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_TRANSFORM),
1405 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_RESEVED_MEMORY),
1406 _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_NO_CROP));
1407 INF("HWC: index=%d zpos=%d ec=%p %s",
1408 plane->index, plane->zpos,
1409 plane->ec?plane->ec:NULL,
1415 /* TODO: construct debug info for outputs managed by the hwc-wins */
1416 INF("HWC: HWC Output(%d) managed by hwc-wins.", ++output_idx);
1418 if (!e_hwc_windows_get_available_properties(output->hwc, &tprops, &count))
1420 ERR("e_hwc_windows_get_video_available_properties failed");
1423 INF(">>>>>>>> Available UI props : count = %d", count);
1424 for (i = 0; i < count; i++)
1425 INF(" [%d] %s, %u", i, tprops[i].name, tprops[i].id);
1427 if (!e_hwc_windows_get_video_available_properties(output->hwc, &tprops, &count))
1429 ERR("e_hwc_windows_get_video_available_properties failed");
1432 INF(">>>>>>>> Available VIDEO props : count = %d", count);
1433 for (i = 0; i < count; i++)
1434 INF(" [%d] %s, %u", i, tprops[i].name, tprops[i].id);
1437 INF("HWC: =========================================================================");
1440 #define NUM_SW_FORMAT (sizeof(sw_formats) / sizeof(sw_formats[0]))
1442 static tbm_format sw_formats[] = {
1443 TBM_FORMAT_ARGB8888,
1444 TBM_FORMAT_XRGB8888,
1450 _e_comp_screen_video_tdm_layer_get(tdm_output *output)
1453 #ifdef CHECKING_PRIMARY_ZPOS
1454 int primary_idx = 0, primary_zpos = 0;
1455 tdm_layer *primary_layer;
1458 EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
1460 tdm_output_get_layer_count(output, &count);
1461 for (i = 0; i < count; i++)
1463 tdm_layer *layer = tdm_output_get_layer(output, i, NULL);
1464 tdm_layer_capability capabilities = 0;
1465 EINA_SAFETY_ON_NULL_RETURN_VAL(layer, NULL);
1467 tdm_layer_get_capabilities(layer, &capabilities);
1468 if (capabilities & TDM_LAYER_CAPABILITY_VIDEO)
1472 #ifdef CHECKING_PRIMARY_ZPOS
1473 tdm_output_get_primary_index(output, &primary_idx);
1474 primary_layer = tdm_output_get_layer(output, primary_idx, NULL);
1475 EINA_SAFETY_ON_NULL_RETURN_VAL(primary_layer, NULL);
1476 tdm_layer_get_zpos(primary_layer, &primary_zpos);
1479 for (i = 0; i < count; i++)
1481 tdm_layer *layer = tdm_output_get_layer(output, i, NULL);
1482 tdm_layer_capability capabilities = 0;
1483 EINA_SAFETY_ON_NULL_RETURN_VAL(layer, NULL);
1485 tdm_layer_get_capabilities(layer, &capabilities);
1486 if (capabilities & TDM_LAYER_CAPABILITY_OVERLAY)
1488 #ifdef CHECKING_PRIMARY_ZPOS
1490 tdm_layer_get_zpos(layer, &zpos);
1491 if (zpos >= primary_zpos) continue;
1501 _e_comp_screen_eoutput_get_by_toutput(tdm_output *output)
1506 EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, eo)
1507 if (eo->toutput == output)
1514 e_comp_screen_available_video_formats_get(const tbm_format **formats, int *count)
1517 tdm_output *toutput;
1523 if (e_comp_screen_pp_support())
1525 error = tdm_display_get_pp_available_formats(e_comp->e_comp_screen->tdisplay, formats, count);
1526 if (error == TDM_ERROR_NONE)
1530 /* get the first output */
1531 toutput = tdm_display_get_output(e_comp->e_comp_screen->tdisplay, 0, NULL);
1535 output = _e_comp_screen_eoutput_get_by_toutput(toutput);
1539 if (e_hwc_policy_get(output->hwc) != E_HWC_POLICY_WINDOWS)
1541 /* get the first suitable layer */
1542 layer = _e_comp_screen_video_tdm_layer_get(toutput);
1545 tdm_layer_get_available_formats(layer, formats, count);
1549 *formats = sw_formats;
1550 *count = NUM_SW_FORMAT;
1555 error = tdm_hwc_get_video_supported_formats(output->hwc->thwc, formats, count);
1556 if (error != TDM_ERROR_NONE)
1558 *formats = sw_formats;
1559 *count = NUM_SW_FORMAT;
1567 e_comp_screen_gbm_device_get(E_Comp_Screen *e_comp_screen)
1571 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
1573 if (e_comp_screen->gdevice) return e_comp_screen->gdevice;
1575 fd = tbm_drm_helper_get_master_fd();
1576 EINA_SAFETY_ON_FALSE_RETURN_VAL(fd >= 0, NULL);
1578 e_comp_screen->gdevice = gbm_create_device(fd);
1579 if (!e_comp_screen->gdevice)
1581 ERR("fail to create gbm device");
1586 e_comp_screen->gdevice_fd = fd;
1588 return e_comp_screen->gdevice;
1592 e_comp_screen_size_get(E_Comp_Screen *e_comp_screen, int *w, int *h)
1594 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
1596 if (w) *w = e_comp_screen->w;
1597 if (h) *h = e_comp_screen->h;
1602 _e_comp_screen_dpms_to_string(E_OUTPUT_DPMS dpms)
1606 case E_OUTPUT_DPMS_ON:
1609 case E_OUTPUT_DPMS_STANDBY:
1610 return "DPMS_STANDBY";
1612 case E_OUTPUT_DPMS_SUSPEND:
1613 return "DPMS_SUSPEND";
1615 case E_OUTPUT_DPMS_OFF:
1624 e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter)
1626 Eldbus_Message_Iter *line_array;
1627 E_Comp_Screen *e_comp_screen = NULL;
1628 E_Output *output = NULL;
1631 char info_str[1024];
1633 e_comp_screen = e_comp->e_comp_screen;
1635 eldbus_message_iter_arguments_append(iter, "as", &line_array);
1638 eldbus_message_iter_basic_append(line_array,
1640 "e_comp_screen not initialized..");
1641 eldbus_message_iter_container_close(iter, line_array);
1645 eldbus_message_iter_basic_append(line_array, 's',
1646 "===========================================================================================");
1647 eldbus_message_iter_basic_append(line_array, 's',
1648 " idx id status dpms ( x , y ) ( w x h ) ");
1649 eldbus_message_iter_basic_append(line_array, 's',
1650 "===========================================================================================");
1652 EINA_LIST_FOREACH(e_comp_screen->outputs, l, output)
1654 if (!output) continue;
1656 if (!output->hwc) continue;
1657 if (e_hwc_policy_get(hwc) == E_HWC_POLICY_NONE) continue;
1659 snprintf(info_str, sizeof(info_str), "%2d %12s %15s %10s (%5d , %5d) (%5d x %5d)",
1660 output->index, output->id,
1661 output->info.connected ? "connected" : "disconnected",
1662 _e_comp_screen_dpms_to_string(output->dpms),
1663 output->config.geom.x, output->config.geom.y,
1664 output->config.geom.w, output->config.geom.h);
1666 eldbus_message_iter_basic_append(line_array, 's', info_str);
1669 eldbus_message_iter_basic_append(line_array, 's',
1670 "===========================================================================================");
1672 eldbus_message_iter_container_close(iter, line_array);
1676 e_comp_screen_outputs_get(E_Comp_Screen *e_comp_screen)
1678 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
1680 return e_comp_screen->outputs;