From fab19660d89f8fe4556cc07b073a2ae66b29d0ae Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 13 Jun 2024 11:30:32 +0900 Subject: [PATCH] e_display: use e_display Use e_display instead of the initialization of display in e_comp_screen. Tdm display implementation should be resided in displaymgr directory. Change-Id: I82883391c6b001027ab8b7de959e9d79965216a0 --- src/bin/compmgr/e_comp.c | 107 +++++++++---- src/bin/compmgr/e_comp_canvas.c | 19 ++- src/bin/core/e_desk.c | 14 +- src/bin/core/e_intern.h | 3 + src/bin/core/e_zone_video.c | 80 +--------- src/bin/debug/e_info_server.c | 70 +++++++-- src/bin/debug/e_info_server_input.c | 17 ++- src/bin/displaymgr/e_hwc.c | 26 +++- src/bin/displaymgr/e_hwc_windows.c | 62 +++++--- src/bin/displaymgr/e_output.c | 288 ++++++++++++++++++++++++++++------- src/bin/displaymgr/e_output_intern.h | 14 +- src/bin/displaymgr/e_plane.c | 2 +- src/bin/e_comp_screen.c | 205 ++++++++++++++++++------- src/bin/e_comp_screen_intern.h | 15 +- src/bin/inputmgr/e_input_device.c | 29 +++- src/bin/inputmgr/e_input_evdev.c | 24 ++- src/bin/server/e_comp_wl.c | 8 +- src/bin/server/e_eom.c | 32 +++- src/bin/server/e_explicit_sync.c | 5 + src/include/e_comp_screen.h | 9 ++ src/include/e_output.h | 1 - 21 files changed, 754 insertions(+), 276 deletions(-) diff --git a/src/bin/compmgr/e_comp.c b/src/bin/compmgr/e_comp.c index 9bd9fe0..4310c98 100644 --- a/src/bin/compmgr/e_comp.c +++ b/src/bin/compmgr/e_comp.c @@ -15,6 +15,7 @@ #include "e_screensaver_intern.h" #include "e_hwc_planes_intern.h" #include "e_server_intern.h" +#include "e_display_intern.h" #include #include @@ -535,20 +536,28 @@ e_comp_ignore_win_find(Ecore_Window win) static void _e_comp_hwc_comp_override_set(Eina_Bool set) { - E_Output *output; + E_Output *primary_output; E_Hwc *hwc; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); + EINA_SAFETY_ON_NULL_RETURN(primary_output); +#else + E_Comp_Screen *e_comp_screen; + EINA_SAFETY_ON_NULL_RETURN(e_comp); EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen); - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN(output); + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); + EINA_SAFETY_ON_NULL_RETURN(primary_output); +#endif - hwc = output->hwc; + hwc = primary_output->hwc; EINA_SAFETY_ON_NULL_RETURN(hwc); if (hwc->hwc_policy == E_HWC_POLICY_WINDOWS) - e_hwc_windows_comp_override_set(output->hwc, set); + e_hwc_windows_comp_override_set(primary_output->hwc, set); } E_API void @@ -1267,82 +1276,118 @@ e_comp_socket_init(const char *name) EINTERN void e_comp_hwc_deactive_set(Eina_Bool set) { - E_Output *output = NULL; + E_Output *primary_output; + +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); + EINA_SAFETY_ON_NULL_RETURN(primary_output); +#else + E_Comp_Screen *e_comp_screen; EINA_SAFETY_ON_NULL_RETURN(e_comp); EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen); - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN(output); + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); + EINA_SAFETY_ON_NULL_RETURN(primary_output); +#endif - e_hwc_deactive_set(output->hwc, set); + e_hwc_deactive_set(primary_output->hwc, set); } /* get the deactive value to the only primary output */ EINTERN Eina_Bool e_comp_hwc_deactive_get(void) { - E_Output *output = NULL; + E_Output *primary_output = NULL; + +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, EINA_FALSE); - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); - return e_hwc_deactive_get(output->hwc); + return e_hwc_deactive_get(primary_output->hwc); } /* set the multi_plane value to the only primary output */ EINTERN void e_comp_hwc_multi_plane_set(Eina_Bool set) { - E_Output *output = NULL; + E_Output *primary_output = NULL; - EINA_SAFETY_ON_NULL_RETURN(e_comp); - EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN(output); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, EINA_FALSE); - e_hwc_planes_multi_plane_set(output->hwc, EINA_TRUE); + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN(primary_output); + + e_hwc_planes_multi_plane_set(primary_output->hwc, EINA_TRUE); } /* get the multi_plane value to the only primary output */ EINTERN Eina_Bool e_comp_hwc_multi_plane_get(void) { - E_Output *output = NULL; + E_Output *primary_output = NULL; + +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, EINA_FALSE); - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); - return e_hwc_planes_multi_plane_get(output->hwc); + return e_hwc_planes_multi_plane_get(primary_output->hwc); } /* end the hwc policy at the primary output */ EINTERN void e_comp_hwc_end(const char *location) { - E_Output *output = NULL; + E_Output *primary_output = NULL; E_Hwc *hwc = NULL; - EINA_SAFETY_ON_NULL_RETURN(e_comp); - EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN(output); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, EINA_FALSE); - hwc = output->hwc; + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN(primary_output); + + hwc = primary_output->hwc; EINA_SAFETY_ON_NULL_RETURN(hwc); if (hwc->hwc_policy == E_HWC_POLICY_PLANES) - e_hwc_planes_end(output->hwc, location); + e_hwc_planes_end(primary_output->hwc, location); else if (hwc->hwc_policy == E_HWC_POLICY_WINDOWS) - e_hwc_windows_client_type_override(output->hwc); + e_hwc_windows_client_type_override(primary_output->hwc); } EINTERN void diff --git a/src/bin/compmgr/e_comp_canvas.c b/src/bin/compmgr/e_comp_canvas.c index b7bffc1..7ccba5f 100644 --- a/src/bin/compmgr/e_comp_canvas.c +++ b/src/bin/compmgr/e_comp_canvas.c @@ -7,6 +7,7 @@ #include "e_theme_intern.h" #include "e_config_intern.h" #include "e_tizen_screen_manager_intern.h" +#include "e_display_intern.h" static Eina_List *handlers; static Eina_Bool _ev_freeze = EINA_FALSE; @@ -612,11 +613,15 @@ e_comp_canvas_feed_mouse_up(unsigned int activate_time) E_API void e_comp_canvas_norender_push(void) { - E_Comp_Screen *e_comp_screen; E_Output *primary_output; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; e_comp_screen = e_comp->e_comp_screen; primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif TRACE_DS_BEGIN(Canvas NoRenderPush:%d, e_comp->norender + 1); e_output_norender_push(primary_output); @@ -627,13 +632,17 @@ e_comp_canvas_norender_push(void) E_API void e_comp_canvas_norender_pop(void) { - E_Comp_Screen *e_comp_screen; E_Output *primary_output; if (e_comp->norender <= 0) return; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; e_comp_screen = e_comp->e_comp_screen; primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif TRACE_DS_BEGIN(Canvas NoRenderPop:%d, e_comp->norender - 1); e_output_norender_pop(primary_output); @@ -644,11 +653,15 @@ e_comp_canvas_norender_pop(void) EINTERN int e_comp_canvas_norender_get(void) { - E_Comp_Screen *e_comp_screen; E_Output *primary_output; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; e_comp_screen = e_comp->e_comp_screen; primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif return e_output_norender_get(primary_output); } diff --git a/src/bin/core/e_desk.c b/src/bin/core/e_desk.c index d25c33c..834ff3d 100644 --- a/src/bin/core/e_desk.c +++ b/src/bin/core/e_desk.c @@ -2,7 +2,6 @@ #include "e_desk_area_intern.h" #include "e_client_intern.h" #include "e_utils_intern.h" -#include "e_comp_screen_intern.h" #include "e_comp_wl_subsurface_intern.h" #include "e_output_intern.h" #include "e_comp_object_intern.h" @@ -10,6 +9,7 @@ #include "e_config_intern.h" #include "e_policy_wl_intern.h" #include "e_policy_intern.h" +#include "e_display_intern.h" #include @@ -1022,7 +1022,11 @@ e_desk_zoom_set(E_Desk *desk, double zoomx, double zoomy, int cx, int cy) if (e_config->use_pp_zoom) { +#ifdef E_DISPLAY + if (e_display_pp_support()) +#else if (e_comp_screen_pp_support()) +#endif { zone = desk->zone; eout = e_output_find(zone->output_id); @@ -1111,7 +1115,11 @@ e_desk_zoom_get(E_Desk *desk, double *zoomx, double *zoomy, int *cx, int *cy) if (e_config->use_pp_zoom) { +#ifdef E_DISPLAY + if (e_display_pp_support()) +#else if (e_comp_screen_pp_support()) +#endif { zone = desk->zone; eout = e_output_find(zone->output_id); @@ -1198,7 +1206,11 @@ e_desk_zoom_unset(E_Desk *desk) if (e_config->use_pp_zoom) { +#ifdef E_DISPLAY + if (e_display_pp_support()) +#else if (e_comp_screen_pp_support()) +#endif { zone = desk->zone; eout = e_output_find(zone->output_id); diff --git a/src/bin/core/e_intern.h b/src/bin/core/e_intern.h index 0f65154..4d6fd29 100644 --- a/src/bin/core/e_intern.h +++ b/src/bin/core/e_intern.h @@ -20,6 +20,9 @@ #include #include +//soolim +#define E_DISPLAY + #define CHECKING_PRIMARY_ZPOS #ifdef ENABLE_TTRACE diff --git a/src/bin/core/e_zone_video.c b/src/bin/core/e_zone_video.c index 7a19a73..48cc0d7 100644 --- a/src/bin/core/e_zone_video.c +++ b/src/bin/core/e_zone_video.c @@ -1,92 +1,18 @@ #include "e_zone_video_intern.h" #include "e_comp_screen_intern.h" - -static int -gcd(int a, int b) -{ - if (a % b == 0) - return b; - return gcd(b, a % b); -} - -static int -lcm(int a, int b) -{ - return a * b / gcd(a, b); -} +#include "e_display_intern.h" E_API Eina_Bool e_zone_video_available_size_get(E_Zone *zone, int *minw, int *minh, int *maxw, int *maxh, int *align) { E_Output *output; - int ominw = -1, ominh = -1, omaxw = -1, omaxh = -1, oalign = -1; - int pminw = -1, pminh = -1, pmaxw = -1, pmaxh = -1, palign = -1; - int rminw = -1, rminh = -1, rmaxw = -1, rmaxh = -1, ralign = -1; output = e_output_find(zone->output_id); if (!output) return EINA_FALSE; - tdm_output_get_available_size(output->toutput, &ominw, &ominh, &omaxw, &omaxh, &oalign); - if (!e_comp_screen_pp_support()) - { - rminw = ominw; - rminh = ominh; - rmaxw = omaxw; - rmaxh = omaxh; - ralign = oalign; - - goto end; - } - else - { - tdm_display_get_pp_available_size(e_comp->e_comp_screen->tdisplay, - &pminw, &pminh, &pmaxw, &pmaxh, - &palign); - - rminw = MAX(ominw, pminw); - rminh = MAX(ominh, pminh); - - if (omaxw != -1 && pmaxw == -1) - rmaxw = omaxw; - else if (omaxw == -1 && pmaxw != -1) - rmaxw = pmaxw; - else - rmaxw = MIN(omaxw, pmaxw); - - if (omaxh != -1 && pmaxh == -1) - rmaxh = omaxh; - else if (omaxh == -1 && pmaxh != -1) - rmaxh = pmaxh; - else - rmaxh = MIN(omaxh, pmaxh); - - if (oalign != -1 && palign == -1) - ralign = oalign; - else if (oalign == -1 && palign != -1) - ralign = palign; - else if (oalign == -1 && palign == -1) - ralign = palign; - else if (oalign > 0 && palign > 0) - ralign = lcm(oalign, palign); - else - { - // ERR("invalid align: %d, %d", video->output_align, video->pp_align); - return EINA_FALSE; - } - - /* - VIN("align width: output(%d) pp(%d) video(%d)", - video->output_align, video->pp_align, video->video_align); - */ - } - -end: - if (minw) *minw = rminw; - if (minh) *minh = rminh; - if (maxw) *maxw = rmaxw; - if (maxw) *maxh = rmaxh; - if (align) *align = ralign; + if (!e_output_available_size_get(output, minw, minh, maxw, maxh, align)) + return EINA_FALSE; return EINA_TRUE; } diff --git a/src/bin/debug/e_info_server.c b/src/bin/debug/e_info_server.c index 2134e7b..34faf11 100644 --- a/src/bin/debug/e_info_server.c +++ b/src/bin/debug/e_info_server.c @@ -38,6 +38,7 @@ #include "e_hints_intern.h" #include "e_comp_input_intern.h" #include "e_alpha_mask_rect_intern.h" +#include "e_display_intern.h" #include #include @@ -521,7 +522,17 @@ _e_info_server_is_hwc_windows() { E_Output *primary_output; - primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; + + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, EINA_FALSE); + + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif if (!primary_output) return 0; @@ -2891,17 +2902,20 @@ static void _e_info_server_cb_wins_dump_ns(const char *dir) static void _e_info_server_cb_wins_dump_hwc_wins(const char *dir) { - E_Comp_Screen *e_comp_screen = NULL; E_Output *output = NULL; E_Hwc_Window *hwc_window = NULL; E_Hwc *hwc = NULL; Eina_List *o = NULL, *oo = NULL; Eina_List *l = NULL, *ll = NULL; +#ifdef E_DISPLAY + EINA_LIST_FOREACH_SAFE(e_display_outputs_get(), o, oo, output) +#else + E_Comp_Screen *e_comp_screen = NULL; e_comp_screen = e_comp->e_comp_screen; if (!e_comp_screen) return; - EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, o, oo, output) +#endif { if (!output) continue; if (!output->config.enabled) continue; @@ -4371,7 +4385,11 @@ _output_mode_set(E_Comp_Screen *e_comp_screen, int output_idx, int mode_count) EINA_SAFETY_ON_TRUE_RETURN(output_idx > e_comp_screen->num_outputs); +#ifdef E_DISPLAY + output = eina_list_nth(e_display_outputs_get(), output_idx); +#else output = eina_list_nth(e_comp_screen->outputs, output_idx); +#endif EINA_SAFETY_ON_NULL_RETURN(output); mode_list = e_output_mode_list_get(output); @@ -4521,7 +4539,11 @@ e_info_server_cb_hwc_trace_message(const Eldbus_Service_Interface *iface EINA_UN } if (onoff == 2) +#ifdef E_DISPLAY + e_display_hwc_info_debug(); +#else e_comp_screen_hwc_info_debug(); +#endif return reply; } @@ -4588,19 +4610,31 @@ e_info_server_cb_hwc(const Eldbus_Service_Interface *iface EINA_UNUSED, const El switch (info) { case 0: +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output) +#endif e_hwc_deactive_set(output->hwc, EINA_TRUE); break; case 1: +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output) +#endif e_hwc_deactive_set(output->hwc, EINA_FALSE); break; default: case 2: - e_comp_screen_hwc_info_debug(); - break; +#ifdef E_DISPLAY + e_display_hwc_info_debug(); +#else + e_comp_screen_hwc_info_debug(); +#endif + break; } return reply; @@ -4628,14 +4662,17 @@ static Eldbus_Message * e_info_server_cb_show_plane_state(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) { Eina_List *output_l, *plane_l; - E_Comp_Screen *e_comp_screen = NULL; E_Output *output = NULL; E_Plane *plane = NULL; Eldbus_Message *reply = eldbus_message_method_return_new(msg); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), output_l, output) +#else + E_Comp_Screen *e_comp_screen = NULL; e_comp_screen = e_comp->e_comp_screen; - EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output) +#endif { if (!output) continue; @@ -4655,16 +4692,19 @@ _msg_show_pending_commit_append(Eldbus_Message_Iter *iter) { Eina_List *output_l, *plane_l, *data_l; Eldbus_Message_Iter *array_of_pending_commit; - E_Comp_Screen *e_comp_screen = NULL; E_Output *output = NULL; E_Plane *plane = NULL; E_Plane_Commit_Data *data = NULL; eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_PENDING_COMMIT")", &array_of_pending_commit); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), output_l, output) +#else + E_Comp_Screen *e_comp_screen = NULL; e_comp_screen = e_comp->e_comp_screen; - EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output) +#endif { if (!output) continue; @@ -4754,7 +4794,6 @@ _msg_output_fps_append(Eldbus_Message_Iter *iter) { Eina_List *output_l, *plane_l, *hwc_l; Eldbus_Message_Iter *array_of_fps; - E_Comp_Screen *e_comp_screen = NULL; E_Hwc_Window *hwc_window = NULL; E_Output *output = NULL; E_Plane *plane = NULL; @@ -4763,9 +4802,13 @@ _msg_output_fps_append(Eldbus_Message_Iter *iter) eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_FPS")", &array_of_fps); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), output_l, output) +#else + E_Comp_Screen *e_comp_screen = NULL; e_comp_screen = e_comp->e_comp_screen; - EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output) +#endif { if (!output) continue; @@ -6493,8 +6536,11 @@ _e_info_server_cb_screen_info_get(const Eldbus_Service_Interface *iface EINA_UNU } reply = eldbus_message_method_return_new(msg); +#ifdef E_DISPLAY + e_display_debug_info_get(eldbus_message_iter_get(reply)); +#else e_comp_screen_debug_info_get(eldbus_message_iter_get(reply)); - +#endif return reply; } diff --git a/src/bin/debug/e_info_server_input.c b/src/bin/debug/e_info_server_input.c index 2ab2521..db69ae8 100644 --- a/src/bin/debug/e_info_server_input.c +++ b/src/bin/debug/e_info_server_input.c @@ -55,12 +55,23 @@ _e_info_input_set_keyboard(struct uinput_user_dev *uinput_dev, int uinput_fd) static void _e_info_input_set_touch(struct uinput_user_dev *uinput_dev, int uinput_fd) { - E_Output *output; + E_Output *primary_output; int w = 0, h = 0; int max_mt_slot = 9;//set touch max count 10 by default - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - e_output_size_get(output, &w, &h); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen; + + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, EINA_FALSE); + + e_comp_screen = e_comp->e_comp_screen; + primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif + + e_output_size_get(primary_output, &w, &h); if ((w <= 0) || (h <= 0)) WRN("Failed to get output size for creating touch device in e_info. So set arbitrary output size [%d x %d]\n", w, h); diff --git a/src/bin/displaymgr/e_hwc.c b/src/bin/displaymgr/e_hwc.c index c68ea19..b6466d5 100644 --- a/src/bin/displaymgr/e_hwc.c +++ b/src/bin/displaymgr/e_hwc.c @@ -6,6 +6,7 @@ #include "e_comp_intern.h" #include "e_error_intern.h" #include "e_hwc_window_queue_intern.h" +#include "e_display_intern.h" #include #include @@ -180,7 +181,7 @@ _e_hwc_tbm_surface_queue_alloc(void *data, int w, int h) { E_Hwc *hwc = (E_Hwc *)data; E_Output *output = hwc->output; - E_Comp_Screen *e_comp_screen = output->e_comp_screen; + E_Comp_Screen *e_comp_screen = e_comp->e_comp_screen; tbm_surface_queue_h tqueue = NULL; tdm_error error; int queue_w, queue_h; @@ -238,8 +239,11 @@ _e_hwc_gbm_surface_alloc(void *data, int w, int h) if (output->tdm_hwc) { EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL); - +#ifdef E_DISPLAY + gdevice = e_display_gbm_device_get(); +#else gdevice = e_comp_screen_gbm_device_get(e_comp->e_comp_screen); +#endif EINA_SAFETY_ON_NULL_RETURN_VAL(gdevice, NULL); gsurface = gbm_surface_create(gdevice, w, h, @@ -307,7 +311,11 @@ _e_hwc_ecore_evas_gbm_alloc(E_Hwc *hwc, int src_w, int src_h) int gbm_formats[2] = {GBM_FORMAT_ABGR8888, GBM_FORMAT_ARGB8888}; int i, format_count; +#ifdef E_DISPLAY + gdevice = e_display_gbm_device_get(); +#else gdevice = e_comp_screen_gbm_device_get(e_comp->e_comp_screen); +#endif if (!gdevice) return NULL; format_count = sizeof(gbm_formats) / sizeof(int); @@ -344,7 +352,11 @@ e_hwc_ecore_evas_deinit(void) E_Output *primary_output = NULL; E_Hwc *hwc = NULL; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif if (!primary_output) return; hwc = primary_output->hwc; @@ -364,7 +376,11 @@ _e_hwc_prefer_gbm_check(void) if (e_comp->hwc_prefer_gbm) return EINA_TRUE; +#ifdef E_DISPLAY + gdevice = e_display_gbm_device_get(); +#else gdevice = e_comp_screen_gbm_device_get(e_comp->e_comp_screen); +#endif if (!gdevice) return EINA_FALSE; backend_name = gbm_device_get_backend_name(gdevice); @@ -384,7 +400,11 @@ e_hwc_ecore_evas_init(void) int screen_rotation; char buf[1024]; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); hwc = primary_output->hwc; @@ -393,7 +413,7 @@ e_hwc_ecore_evas_init(void) EHINF("ecore evase engine init.", hwc); // TODO: fix me. change the screen_rotation into output_rotation. - screen_rotation = primary_output->e_comp_screen->rotation; + screen_rotation = e_comp->e_comp_screen->rotation; /* set env for use tbm_surface_queue*/ setenv("USE_EVAS_SOFTWARE_TBM_ENGINE", "1", 1); diff --git a/src/bin/displaymgr/e_hwc_windows.c b/src/bin/displaymgr/e_hwc_windows.c index cfd5269..86d7831 100644 --- a/src/bin/displaymgr/e_hwc_windows.c +++ b/src/bin/displaymgr/e_hwc_windows.c @@ -16,6 +16,7 @@ #include "services/e_service_quickpanel_intern.h" #include "e_policy_private_data.h" #include "e_policy_intern.h" +#include "e_display_intern.h" # include # include @@ -146,10 +147,14 @@ _e_hwc_windows_root_target_hwc_window_get(E_Hwc *hwc) } else { +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, NULL); primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output->hwc, NULL); @@ -1096,7 +1101,11 @@ _e_hwc_windows_pending_update_data_dequeue(E_Hwc_Window_Target *root_target_hwc_ e_comp_wl_tizen_hwc_feedback_list_enqueue(&comp_info->feedback_list); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output) +#endif { if (!output->hwc) continue; @@ -1141,7 +1150,11 @@ _e_hwc_windows_pending_update_data_clear(E_Hwc_Window_Target *root_target_hwc_wi EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output) +#endif { if (!output->hwc) continue; @@ -1424,7 +1437,11 @@ _e_hwc_windows_presentation_callback_comp_take_over(E_Hwc_Window_Target *root_ta EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(comp_info, EINA_FALSE); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output) +#endif { if (!output->hwc) continue; @@ -2839,10 +2856,13 @@ _e_hwc_windows_root_target_window_state_update(E_Hwc_Window_Target *root_target_ E_Hwc_Window_State state; E_Hwc_Window_State root_state = E_HWC_WINDOW_STATE_NONE; +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_SAFETY_ON_NULL_RETURN(e_comp); EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen); - EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output) +#endif { if (!e_output_connected(output)) continue; if (!output->hwc) continue; @@ -3436,7 +3456,11 @@ e_hwc_windows_pp_set(E_Hwc *hwc, Eina_Rectangle *src_rect, Eina_Rectangle *dst_r (hwc->pp_dst_rect.w == dst_rect->w) && (hwc->pp_dst_rect.h == dst_rect->h)) return EINA_TRUE; +#ifdef E_DISPLAY + if (e_display_pp_support()) +#else if (e_comp_screen_pp_support()) +#endif { if (!hwc->tpp) { @@ -3464,7 +3488,11 @@ e_hwc_windows_pp_set(E_Hwc *hwc, Eina_Rectangle *src_rect, Eina_Rectangle *dst_r e_output_size_get(hwc->output, &w, &h); +#ifdef E_DISPLAY + if (e_display_pp_support()) +#else if (e_comp_screen_pp_support()) +#endif _e_hwc_windows_pp_aligned_value_get(hwc, &w, &h); //TODO: Does e20 get the buffer flags from the tdm backend? @@ -3726,7 +3754,6 @@ _e_hwc_windows_window_debug_info_get(Eldbus_Message_Iter *iter, E_Hwc_Wins_Debug { Eldbus_Message_Iter *line_array; E_Hwc_Window *hwc_window; - E_Comp_Screen *e_comp_screen; E_Output *output; E_Hwc *hwc; Eina_List *l, *l2, *l3; @@ -3738,19 +3765,16 @@ _e_hwc_windows_window_debug_info_get(Eldbus_Message_Iter *iter, E_Hwc_Wins_Debug E_Hwc_Window_Update_Data *update; int pending_idx; - e_comp_screen = e_comp->e_comp_screen; eldbus_message_iter_arguments_append(iter, "as", &line_array); - if (!e_comp_screen) - { - eldbus_message_iter_basic_append(line_array, - 's', - "e_comp_screen not initialized.."); - eldbus_message_iter_container_close(iter, line_array); - return; - } +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else + E_Comp_Screen *e_comp_screen; + e_comp_screen = e_comp->e_comp_screen; EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { if (!output) continue; if (!output->config.enabled) continue; @@ -3893,7 +3917,6 @@ static void _e_hwc_windows_window_debug_commit_info_get(Eldbus_Message_Iter *iter, E_Hwc_Wins_Debug_Cmd cmd) { Eldbus_Message_Iter *line_array; - E_Comp_Screen *e_comp_screen; E_Output *output; E_Hwc *hwc; Eina_List *l, *l2; @@ -3903,19 +3926,16 @@ _e_hwc_windows_window_debug_commit_info_get(Eldbus_Message_Iter *iter, E_Hwc_Win E_Hwc_Windows_Commit_Data *wins_commit_data; E_Hwc_Window_Commit_Data *commit_data; - e_comp_screen = e_comp->e_comp_screen; eldbus_message_iter_arguments_append(iter, "as", &line_array); - if (!e_comp_screen) - { - eldbus_message_iter_basic_append(line_array, - 's', - "e_comp_screen not initialized.."); - eldbus_message_iter_container_close(iter, line_array); - return; - } +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else + E_Comp_Screen *e_comp_screen; + e_comp_screen = e_comp->e_comp_screen; EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { if (!output) continue; if (!output->config.enabled) continue; diff --git a/src/bin/displaymgr/e_output.c b/src/bin/displaymgr/e_output.c index 3d09f8b..0789daf 100644 --- a/src/bin/displaymgr/e_output.c +++ b/src/bin/displaymgr/e_output.c @@ -14,6 +14,7 @@ #include "e_comp_wl_video_buffer_intern.h" #include "e_zone_intern.h" #include "e_video_debug_intern.h" +#include "e_display_intern.h" #include @@ -91,6 +92,20 @@ static Eina_Bool _e_output_capture(E_Output *output, tbm_surface_h tsurface, Ein static void _e_output_vblank_handler(tdm_output *output, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *data); +static int +gcd(int a, int b) +{ + if (a % b == 0) + return b; + return gcd(b, a % b); +} + +static int +lcm(int a, int b) +{ + return a * b / gcd(a, b); +} + static inline void _e_output_display_mode_set(E_Output *output, E_Output_Display_Mode display_mode) { @@ -343,7 +358,11 @@ _e_output_zoom_touch_transform(E_Output *output, Eina_Bool set) EINA_LIST_FOREACH(e_input_devices_get(), l, dev) { +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif if (primary_output != NULL) break; } @@ -684,7 +703,7 @@ _e_output_client_resize(int w, int h) } static void -_e_output_primary_update(E_Output *output) +_e_primary_output_update(E_Output *output) { Eina_Bool ret; char bootmode[32]; @@ -748,24 +767,29 @@ _e_output_primary_update(E_Output *output) static Eina_Bool _e_output_external_update(E_Output *output) { - E_Comp_Screen *e_comp_screen = NULL; E_Output_Mode *mode = NULL; - E_Output *output_pri = NULL; + E_Output *primary_output = NULL; Eina_Bool ret; EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen = NULL; + e_comp_screen = e_comp->e_comp_screen; EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE); - output_pri = e_comp_screen_primary_output_get(e_comp_screen); - if (!output_pri) + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + if (!primary_output) { e_error_message_show(_("Fail to get the primary output!\n")); return EINA_FALSE; } - if (output_pri == output) + if (primary_output == output) return EINA_FALSE; @@ -838,7 +862,7 @@ _e_output_cb_output_change(tdm_output *toutput, void *user_data) { E_Output *output = NULL; - E_Output *primary = NULL; + E_Output *primary_output = NULL; E_OUTPUT_DPMS edpms; tdm_output_dpms tdpms; tdm_output_conn_status status; @@ -849,6 +873,13 @@ _e_output_cb_output_change(tdm_output *toutput, output = (E_Output *)user_data; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN(primary_output); + switch (type) { case TDM_OUTPUT_CHANGE_CONNECTION: @@ -856,24 +887,20 @@ _e_output_cb_output_change(tdm_output *toutput, if (status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED || status == TDM_OUTPUT_CONN_STATUS_CONNECTED) { - primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN(primary); - if (primary == output) - _e_output_primary_update(output); + if (primary_output == output) + _e_primary_output_update(output); else _e_output_external_update(output); } break; case TDM_OUTPUT_CHANGE_DPMS: tdpms = (tdm_output_dpms)value.u32; - primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN(primary); if (tdpms == TDM_OUTPUT_DPMS_OFF) { edpms = E_OUTPUT_DPMS_OFF; - if (!override && (output == primary)) + if (!override && (output == primary_output)) { e_comp_override_add(); override = EINA_TRUE; @@ -882,7 +909,7 @@ _e_output_cb_output_change(tdm_output *toutput, else if (tdpms == TDM_OUTPUT_DPMS_ON) { edpms = E_OUTPUT_DPMS_ON; - if (override && (output == primary)) + if (override && (output == primary_output)) { e_comp_override_del(); override = EINA_FALSE; @@ -2375,8 +2402,13 @@ fail: return EINA_FALSE; } +#ifdef E_DISPLAY +EINTERN E_Output * +e_output_new1(int index) +#else EINTERN E_Output * e_output_new(E_Comp_Screen *e_comp_screen, int index) +#endif { E_Output *output = NULL; tdm_output *toutput = NULL; @@ -2388,13 +2420,20 @@ e_output_new(E_Comp_Screen *e_comp_screen, int index) int min_w, min_h, max_w, max_h, preferred_align; tdm_output_capability output_caps = 0; +#ifdef E_DISPLAY +#else EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL); +#endif output = E_NEW(E_Output, 1); EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL); output->index = index; +#ifdef E_DISPLAY + toutput = tdm_display_get_output(e_display_tdm_display_get(), index, NULL); +#else toutput = tdm_display_get_output(e_comp_screen->tdisplay, index, NULL); +#endif if (!toutput) goto fail; output->toutput = toutput; @@ -2434,8 +2473,6 @@ e_output_new(E_Comp_Screen *e_comp_screen, int index) output->id = id; EOINF("(%d) output_id = %s", output, index, output->id); - output->e_comp_screen = e_comp_screen; - _e_output_tdm_stream_capture_support(output); error = tdm_output_get_capabilities(toutput, &output_caps); @@ -2820,7 +2857,11 @@ e_output_hwc_setup(E_Output *output) return EINA_TRUE; } +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif if (output == primary_output) is_primary_output = EINA_TRUE; hwc = e_hwc_new(output, is_primary_output); @@ -2921,12 +2962,16 @@ e_output_dpms_set(E_Output *output, E_OUTPUT_DPMS val) tdm_error error; Eina_List *l; E_Zone *zone; - E_Output *output_primary = NULL; + E_Output *primary_output = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); - output_primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - if (output_primary == output) +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + if (primary_output == output) { /* FIXME: The zone controlling should be moved to e_zone */ EINA_LIST_FOREACH(e_comp->zones, l, zone) @@ -2998,6 +3043,24 @@ e_output_dpms_async_check(E_Output *output) return output->dpms_async; } +EINTERN void +e_output_position_set(E_Output *output, int x, int y) +{ + EINA_SAFETY_ON_NULL_RETURN(output); + + output->config.geom.x = x; + output->config.geom.y = y; +} + +EINTERN void +e_output_position_get(E_Output *output, int *x, int *y) +{ + EINA_SAFETY_ON_NULL_RETURN(output); + + *x = output->config.geom.x; + *y = output->config.geom.y; +} + E_API void e_output_size_get(E_Output *output, int *w, int *h) { @@ -3036,7 +3099,6 @@ e_output_fake_config_set(E_Output *output, int w, int h) return EINA_TRUE; } - EINTERN Eina_Bool e_output_render(E_Output *output) { @@ -3059,9 +3121,13 @@ e_output_render(E_Output *output) else { /* render the only primary output */ - if (output != e_comp_screen_primary_output_get(output->e_comp_screen)) +#ifdef E_DISPLAY + if (output != e_display_primary_output_get()) return EINA_TRUE; - +#else + if (output != e_comp_screen_primary_output_get(e_comp->e_comp_screen)) + return EINA_TRUE; +#endif if (!e_hwc_windows_render(output->hwc)) { EOERR("fail to e_hwc_windows_render.", output); @@ -3075,7 +3141,7 @@ e_output_render(E_Output *output) EINTERN Eina_Bool e_output_commit(E_Output *output) { - E_Output *output_primary = NULL; + E_Output *primary_output = NULL; E_Output_Display_Mode display_mode; EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); @@ -3086,14 +3152,18 @@ e_output_commit(E_Output *output) return EINA_FALSE; } - output_primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN_VAL(output_primary, EINA_FALSE); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); if (e_hwc_policy_get(output->hwc) == E_HWC_POLICY_PLANES) { e_hwc_planes_apply(output->hwc); - if (output == output_primary) + if (output == primary_output) { if (!_e_output_planes_commit(output)) { @@ -3120,7 +3190,7 @@ e_output_commit(E_Output *output) } else { - if (output == output_primary) + if (output == primary_output) { if (output->zoom_set) e_output_zoom_rotating_check(output); @@ -3156,16 +3226,19 @@ E_API E_Output * e_output_find(const char *id) { E_Output *output; - E_Comp_Screen *e_comp_screen; Eina_List *l; - 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(id, NULL); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else + E_Comp_Screen *e_comp_screen; + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, NULL); e_comp_screen = e_comp->e_comp_screen; - EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { if (!strcmp(output->id, id)) return output; } @@ -3186,14 +3259,16 @@ e_output_util_planes_print(void) { Eina_List *l, *ll, *p_l; E_Output * output = NULL; - E_Comp_Screen *e_comp_screen = NULL; +#ifdef E_DISPLAY + EINA_LIST_FOREACH_SAFE(e_display_outputs_get(), l, ll, output) +#else + E_Comp_Screen *e_comp_screen = NULL; EINA_SAFETY_ON_NULL_RETURN(e_comp); EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen); - e_comp_screen = e_comp->e_comp_screen; - EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output) +#endif { E_Plane *plane; E_Client *ec; @@ -3331,15 +3406,17 @@ E_API E_Output * e_output_find_by_index(int index) { E_Output *output; - E_Comp_Screen *e_comp_screen; Eina_List *l; +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else + E_Comp_Screen *e_comp_screen; EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, NULL); - e_comp_screen = e_comp->e_comp_screen; - EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { if (output->index == index) return output; @@ -3372,9 +3449,13 @@ e_output_zoom_set(E_Output *output, double zoomx, double zoomy, int cx, int cy) E_Plane *ep = NULL; int w, h; int angle = 0; - E_Output *output_primary = NULL; + E_Output *primary_output = NULL; +#ifdef E_DISPLAY + if (!e_display_pp_support()) +#else if (!e_comp_screen_pp_support()) +#endif { EOINF("Comp Screen does not support the Zoom.", output); return EINA_FALSE; @@ -3385,10 +3466,14 @@ e_output_zoom_set(E_Output *output, double zoomx, double zoomy, int cx, int cy) if (cx < 0 || cy < 0) return EINA_FALSE; if (zoomx <= 0 || zoomy <= 0) return EINA_FALSE; - output_primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN_VAL(output_primary, EINA_FALSE); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); - if (output != output_primary) + if (output != primary_output) { EOERR("Only Primary Output can support the Zoom.", output); return EINA_FALSE; @@ -3474,9 +3559,13 @@ e_output_zoom_set(E_Output *output, double zoomx, double zoomy, int cx, int cy) EINTERN Eina_Bool e_output_zoom_get(E_Output *output, double *zoomx, double *zoomy, int *cx, int *cy) { - E_Output *output_primary = NULL; + E_Output *primary_output = NULL; +#ifdef E_DISPLAY + if (!e_display_pp_support()) +#else if (!e_comp_screen_pp_support()) +#endif { EOINF("Comp Screen does not support the Zoom.", output); return EINA_FALSE; @@ -3484,10 +3573,14 @@ e_output_zoom_get(E_Output *output, double *zoomx, double *zoomy, int *cx, int * EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); - output_primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN_VAL(output_primary, EINA_FALSE); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); - if (output != output_primary) + if (output != primary_output) { EOERR("Only Primary Output can support the Zoom.", output); return EINA_FALSE; @@ -3846,7 +3939,7 @@ e_output_external_mode_change(E_Output *output, E_Output_Mode *mode) E_Output_Mode *emode = NULL, *current_emode = NULL; Eina_List *l; Eina_Bool found = EINA_FALSE; - E_Output *output_primary = NULL; + E_Output *primary_output = NULL; E_Plane *ep = NULL; int w, h, p_w, p_h; @@ -3872,12 +3965,16 @@ e_output_external_mode_change(E_Output *output, E_Output_Mode *mode) } EINA_SAFETY_ON_FALSE_RETURN_VAL(found == EINA_TRUE, EINA_FALSE); - output_primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - EINA_SAFETY_ON_NULL_RETURN_VAL(output_primary, EINA_FALSE); - EINA_SAFETY_ON_TRUE_RETURN_VAL(output_primary == output, EINA_FALSE); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(primary_output == output, EINA_FALSE); e_output_size_get(output, &w, &h); - e_output_size_get(output_primary, &p_w, &p_h); + e_output_size_get(primary_output, &p_w, &p_h); if (e_output_mode_apply(output, mode) == EINA_FALSE) { @@ -3885,7 +3982,7 @@ e_output_external_mode_change(E_Output *output, E_Output_Mode *mode) return EINA_FALSE; } - _e_output_external_rect_get(output_primary, p_w, p_h, w, h, &output->zoom_conf.rect); + _e_output_external_rect_get(primary_output, p_w, p_h, w, h, &output->zoom_conf.rect); EOINF("mode change output: (%dx%d)", output, w, h); @@ -3901,7 +3998,7 @@ e_output_external_mode_change(E_Output *output, E_Output_Mode *mode) /* TODO: HWC Windows */; } - _e_output_render_update(output_primary); + _e_output_render_update(primary_output); EOINF("e_output_external_reset done.(%dx%d)", output, mode->w, mode->h); @@ -4066,7 +4163,11 @@ e_output_presentation_unset(E_Output *output) { if (output->presentation_ec) { +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif EINA_SAFETY_ON_NULL_GOTO(primary_output, done); zone = e_comp_zone_find(e_output_output_id_get(primary_output)); @@ -4260,3 +4361,84 @@ e_output_hwc_get(E_Output *output) return output->hwc; } + +EINTERN Eina_Bool +e_output_available_size_get(E_Output *output, int *minw, int *minh, int *maxw, int *maxh, int *align) +{ + int ominw = -1, ominh = -1, omaxw = -1, omaxh = -1, oalign = -1; + int pminw = -1, pminh = -1, pmaxw = -1, pmaxh = -1, palign = -1; + int rminw = -1, rminh = -1, rmaxw = -1, rmaxh = -1, ralign = -1; + + EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); + + tdm_output_get_available_size(output, &ominw, &ominh, &omaxw, &omaxh, &oalign); + +#ifdef E_DISPLAY + if (!e_display_pp_support()) +#else + if (!e_comp_screen_pp_support()) +#endif + { + rminw = ominw; + rminh = ominh; + rmaxw = omaxw; + rmaxh = omaxh; + ralign = oalign; + + goto end; + } + else + { +#ifdef E_DISPLAY + e_display_pp_available_size_get(&pminw, &pminh, &pmaxw, &pmaxh, &palign); +#else + tdm_display_get_pp_available_size(e_comp->e_comp_screen->tdisplay, + &pminw, &pminh, &pmaxw, &pmaxh, + &palign); +#endif + rminw = MAX(ominw, pminw); + rminh = MAX(ominh, pminh); + + if (omaxw != -1 && pmaxw == -1) + rmaxw = omaxw; + else if (omaxw == -1 && pmaxw != -1) + rmaxw = pmaxw; + else + rmaxw = MIN(omaxw, pmaxw); + + if (omaxh != -1 && pmaxh == -1) + rmaxh = omaxh; + else if (omaxh == -1 && pmaxh != -1) + rmaxh = pmaxh; + else + rmaxh = MIN(omaxh, pmaxh); + + if (oalign != -1 && palign == -1) + ralign = oalign; + else if (oalign == -1 && palign != -1) + ralign = palign; + else if (oalign == -1 && palign == -1) + ralign = palign; + else if (oalign > 0 && palign > 0) + ralign = lcm(oalign, palign); + else + { + // ERR("invalid align: %d, %d", video->output_align, video->pp_align); + return EINA_FALSE; + } + + /* + VIN("align width: output(%d) pp(%d) video(%d)", + video->output_align, video->pp_align, video->video_align); + */ + } + +end: + if (minw) *minw = rminw; + if (minh) *minh = rminh; + if (maxw) *maxw = rmaxw; + if (maxw) *maxh = rmaxh; + if (align) *align = ralign; + + return EINA_TRUE; +} diff --git a/src/bin/displaymgr/e_output_intern.h b/src/bin/displaymgr/e_output_intern.h index 233d0e2..b2b13f6 100644 --- a/src/bin/displaymgr/e_output_intern.h +++ b/src/bin/displaymgr/e_output_intern.h @@ -3,6 +3,7 @@ #include "e_intern.h" #include "e_output.h" +#include "e_display_intern.h" #include @@ -53,7 +54,11 @@ struct _E_Output_Intercept_Hook EINTERN Eina_Bool e_output_init(void); EINTERN void e_output_shutdown(void); +//#ifdef E_DISPLAY +EINTERN E_Output * e_output_new1(int index); +//#else EINTERN E_Output * e_output_new(E_Comp_Screen *e_comp_screen, int index); +//#endif EINTERN void e_output_del(E_Output *output); EINTERN Eina_Bool e_output_rotate(E_Output *output, int rotate); EINTERN Eina_Bool e_output_update(E_Output *output); @@ -70,10 +75,15 @@ EINTERN E_OUTPUT_DPMS e_output_dpms_get(E_Output *output); EINTERN Eina_Bool e_output_dpms_async_check(E_Output *output); EINTERN void e_output_phys_size_get(E_Output *output, int *phys_w, int *phys_h); EINTERN E_Plane * e_output_default_fb_target_get(E_Output *output); -EINTERN Eina_Bool e_output_fake_config_set(E_Output *output, int w, int h); +EINTERN Eina_Bool e_output_fake_config_set(E_Output *output, int x, int y); +EINTERN void e_output_position_get(E_Output *output, int *x, int *y); +EINTERN void e_output_position_set(E_Output *output, int x, int y); +EINTERN Eina_Bool e_output_available_size_get(E_Output *output, int *minw, int *minh, int *maxw, int *maxh, int *align); + EINTERN Eina_Bool e_output_zoom_set(E_Output *output, double zoomx, double zoomy, int cx, int cy); EINTERN Eina_Bool e_output_zoom_get(E_Output *output, double *zoomx, double *zoomy, int *cx, int *cy); EINTERN void e_output_zoom_unset(E_Output *output); + EINTERN Eina_Bool e_output_stream_capture_queue(E_Output *output, tbm_surface_h surface, E_Output_Capture_Cb func, void *data); EINTERN Eina_Bool e_output_stream_capture_dequeue(E_Output *output, tbm_surface_h surface); EINTERN Eina_Bool e_output_stream_capture_start(E_Output *output); @@ -81,8 +91,10 @@ EINTERN void e_output_stream_capture_stop(E_Output *output); EINTERN void e_output_stream_capture_autorotate(E_Output *output, Eina_Bool auto_rotate); EINTERN Eina_Bool e_output_external_mode_change(E_Output *output, E_Output_Mode *mode); + EINTERN Eina_Bool e_output_mirror_set(E_Output *output, E_Output *src_output); EINTERN void e_output_mirror_unset(E_Output *output); + EINTERN Eina_Bool e_output_presentation_update(E_Output *output, E_Client *ec); EINTERN void e_output_presentation_unset(E_Output *output); EINTERN Eina_Bool e_output_presentation_ec_set(E_Output *output, E_Client *ec); diff --git a/src/bin/displaymgr/e_plane.c b/src/bin/displaymgr/e_plane.c index 5a7e5d6..585fd93 100644 --- a/src/bin/displaymgr/e_plane.c +++ b/src/bin/displaymgr/e_plane.c @@ -1786,7 +1786,7 @@ e_plane_new(E_Output *output, int index) EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL); - comp_screen = output->e_comp_screen; + comp_screen = e_comp->e_comp_screen; EINA_SAFETY_ON_NULL_RETURN_VAL(comp_screen, NULL); toutput = output->toutput; diff --git a/src/bin/e_comp_screen.c b/src/bin/e_comp_screen.c index 1c2c25a..20f2f54 100644 --- a/src/bin/e_comp_screen.c +++ b/src/bin/e_comp_screen.c @@ -1,8 +1,8 @@ +#include "e_comp_screen_intern.h" #include "e_client_intern.h" #include "e_utils_intern.h" #include "e_scale_intern.h" #include "e_comp_canvas_intern.h" -#include "e_comp_screen_intern.h" #include "e_comp_wl_input_intern.h" #include "e_comp_wl_intern.h" #include "e_explicit_sync_intern.h" @@ -24,11 +24,15 @@ #include "e_comp_input_intern.h" #include "e_screen_rotation_intern.h" #include "e_server_intern.h" +#include "e_display_intern.h" #include +#ifdef E_DISPLAY +#else #include #include #include +#endif #define PATH "/org/enlightenment/wm" #define IFACE "org.enlightenment.wm.screen_rotation" @@ -107,6 +111,8 @@ err: return; } +#ifdef E_DISPLAY +#else static char * _layer_cap_to_str(tdm_layer_capability caps, tdm_layer_capability cap) { @@ -124,33 +130,35 @@ _layer_cap_to_str(tdm_layer_capability caps, tdm_layer_capability cap) } return ""; } +#endif static Eina_Bool _e_comp_screen_commit_idle_cb(void *data EINA_UNUSED) { Eina_List *l, *ll; - E_Comp_Screen *e_comp_screen = NULL; E_Output *output = NULL; - if (!e_comp->e_comp_screen) goto end; - if (e_config->comp_canvas_norender.use) evas_norender(e_comp->evas); if (e_comp->canvas_render_delayed) goto end; +#ifdef E_DISPLAY + EINA_LIST_FOREACH_SAFE(e_display_outputs_get(), l, ll, output) +#else + E_Comp_Screen *e_comp_screen = NULL; e_comp_screen = e_comp->e_comp_screen; - EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output) +#endif { if (!output) continue; if (!output->config.enabled) continue; if (!e_output_commit(output)) - ERR("fail to commit e_comp_screen->outputs."); + ERR("fail to commit output."); if (!e_output_render(output)) - ERR("fail to render e_comp_screen->outputs."); + ERR("fail to render output."); } end: return ECORE_CALLBACK_RENEW; @@ -269,8 +277,8 @@ end: return ECORE_CALLBACK_PASS_ON; } -static Eina_Bool -_e_comp_screen_size_update(E_Comp_Screen *e_comp_screen) +EINTERN Eina_Bool +e_comp_screen_size_update(E_Comp_Screen *e_comp_screen) { E_Output *output; int sum_w = 0, max_h = 0, output_w, output_h; @@ -278,8 +286,12 @@ _e_comp_screen_size_update(E_Comp_Screen *e_comp_screen) EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE); +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else /* we place external output to the right of primary output */ EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { if (!e_output_connected(output)) continue; @@ -311,6 +323,8 @@ _e_comp_screen_size_update(E_Comp_Screen *e_comp_screen) return EINA_TRUE; } +#ifdef E_DISPLAY +#else static Eina_Bool _e_comp_screen_cb_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED) { @@ -325,22 +339,57 @@ _e_comp_screen_cb_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED) return ECORE_CALLBACK_RENEW; } +#endif static E_Comp_Screen * _e_comp_screen_new(E_Comp *comp) { E_Comp_Screen *e_comp_screen = NULL; + int screen_rotation; + +#ifdef E_DISPLAY +#else tdm_error error = TDM_ERROR_NONE; tdm_display_capability capabilities; const tbm_format *pp_formats; int count, i; int fd; +#endif e_comp_screen = E_NEW(E_Comp_Screen, 1); if (!e_comp_screen) return NULL; + e_comp->e_comp_screen = e_comp_screen; + + /* check the screen rotation */ + screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360; + + ELOGF("COMP_SCREEN","screen_rotation_pre %d and screen_rotation_setting %d", + NULL, e_config->screen_rotation_pre, e_config->screen_rotation_setting); + + e_comp_screen->rotation_pre = e_config->screen_rotation_pre; + e_comp_screen->rotation_setting = e_config->screen_rotation_setting; + e_comp_screen->rotation = screen_rotation; + +#ifdef E_DISPLAY + e_main_ts_begin("\te_display_init"); + + if (!e_display_init()) + { + e_main_ts_end("\te_display_init() failed."); + ERR("e_display_init failed"); + free(e_comp_screen); + return NULL; + } + + e_main_ts_end("\te_display_init Done"); + + e_comp_screen->num_outputs = e_display_num_outputs_get(); + e_comp_screen->outputs = e_display_outputs_get(); +#else /* tdm display init */ e_main_ts_begin("\tTDM Display Init"); + e_comp_screen->tdisplay = tdm_display_init(&error); if (!e_comp_screen->tdisplay) { @@ -349,6 +398,7 @@ _e_comp_screen_new(E_Comp *comp) free(e_comp_screen); return NULL; } + e_main_ts_end("\tTDM Display Init Done"); e_comp_screen->gdevice_fd = -1; @@ -365,7 +415,9 @@ _e_comp_screen_new(E_Comp *comp) e_comp_screen->hdlr = ecore_main_fd_handler_add(e_comp_screen->fd, ECORE_FD_READ, _e_comp_screen_cb_event, e_comp_screen, NULL, NULL); - /* tdm display init */ +#endif + + /* tbm bufmgr init */ e_main_ts_begin("\tTBM Bufmgr Server Init"); e_comp_screen->bufmgr = tbm_bufmgr_server_init(); if (!e_comp_screen->bufmgr) @@ -376,6 +428,8 @@ _e_comp_screen_new(E_Comp *comp) } e_main_ts_end("\tTBM Bufmgr Server Init Done"); +#ifdef E_DISPLAY +#else error = tdm_display_get_capabilities(e_comp_screen->tdisplay, &capabilities); if (error != TDM_ERROR_NONE) { @@ -401,14 +455,18 @@ _e_comp_screen_new(E_Comp *comp) if (e_comp_socket_init("tdm-socket")) PRCTL("[Winsys] change permission and create sym link for %s", "tdm-socket"); e_main_ts_end("\ttdm-socket Init Done"); +#endif return e_comp_screen; fail: if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr); +#ifdef E_DISPLAY +#else if (e_comp_screen->fd >= 0) close(e_comp_screen->fd); if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr); if (e_comp_screen->tdisplay) tdm_display_deinit(e_comp_screen->tdisplay); +#endif free(e_comp_screen); TRACE_DS_END(); @@ -419,6 +477,8 @@ fail: static void _e_comp_screen_del(E_Comp_Screen *e_comp_screen) { +#ifdef E_DISPLAY +#else Eina_List *l = NULL, *ll = NULL; tbm_format *formats; @@ -435,14 +495,22 @@ _e_comp_screen_del(E_Comp_Screen *e_comp_screen) if (e_comp_screen->gdevice) gbm_device_destroy(e_comp_screen->gdevice); if (e_comp_screen->gdevice_fd >= 0) close(e_comp_screen->gdevice_fd); +#endif + if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr); + +#ifdef E_DISPLAY +#else if (e_comp_screen->fd >= 0) close(e_comp_screen->fd); if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr); if (e_comp_screen->tdisplay) tdm_display_deinit(e_comp_screen->tdisplay); +#endif free(e_comp_screen); } +#ifdef E_DISPLAY +#else static void _e_comp_screen_output_mode_change_cb(tdm_output *toutput, unsigned int index, void *user_data) { @@ -764,7 +832,7 @@ _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen) goto fail; } - _e_comp_screen_size_update(e_comp_screen); + e_comp_screen_size_update(e_comp_screen); e_main_ts_begin("\tE_Hwc Ecore_Evas Init"); if (!e_hwc_ecore_evas_init()) @@ -783,6 +851,7 @@ fail: return EINA_FALSE; } +#endif static void _e_comp_screen_e_screen_free(E_Screen *scr) @@ -804,7 +873,10 @@ _e_comp_screen_engine_deinit(void) if (!e_comp) return; if (!e_comp->e_comp_screen) return; +#ifdef E_DISPLAY +#else _e_comp_screen_deinit_outputs(e_comp->e_comp_screen); +#endif _e_comp_screen_del(e_comp->e_comp_screen); e_comp->e_comp_screen = NULL; } @@ -813,13 +885,6 @@ static Eina_Bool _e_comp_screen_engine_init(void) { E_Comp_Screen *e_comp_screen = NULL; - int screen_rotation; - - /* check the screen rotation */ - screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360; - - ELOGF("COMP_SCREEN","screen_rotation_pre %d and screen_rotation_setting %d", - NULL, e_config->screen_rotation_pre, e_config->screen_rotation_setting); /* e_comp_screen new */ e_main_ts_begin("\tE_Comp_Screen New"); @@ -832,11 +897,8 @@ _e_comp_screen_engine_init(void) } e_main_ts_end("\tE_Comp_Screen New Done"); - e_comp->e_comp_screen = e_comp_screen; - e_comp_screen->rotation_pre = e_config->screen_rotation_pre; - e_comp_screen->rotation_setting = e_config->screen_rotation_setting; - e_comp_screen->rotation = screen_rotation; - +#ifdef E_DISPLAY +#else e_main_ts_begin("\tE_Comp_Screen Outputs Init"); if (!_e_comp_screen_init_outputs(e_comp_screen)) { @@ -846,7 +908,7 @@ _e_comp_screen_engine_init(void) return EINA_FALSE; } e_main_ts_end("\tE_Comp_Screen Outputs Init Done"); - +#endif if (!E_EVENT_SCREEN_CHANGE) E_EVENT_SCREEN_CHANGE = ecore_event_type_new(); ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL); @@ -882,45 +944,56 @@ EINTERN void e_comp_screen_e_screens_setup(E_Comp_Screen *e_comp_screen, int rw, int rh) { E_Screen *screen; - E_Output *output; + E_Output *primary_output, *output; Eina_List *e_screens = NULL; Eina_List *l; int i = 0, right_x = 0; + int x, y, w, h; - output = e_comp_screen_primary_output_get(e_comp_screen); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp_screen); +#endif /* No pirmary output means that there is no output at the system */ - if (!output) goto out; + if (!primary_output) goto out; +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { screen = E_NEW(E_Screen, 1); if (!screen) return; screen->escreen = screen->screen = i; + e_output_position_get(output, &x, &y); + e_output_size_get(output, &w, &h); if (output->config.rotation % 180) { - screen->w = output->config.geom.h; - screen->h = output->config.geom.w; + screen->w = h; + screen->h = w; } else { - screen->w = output->config.geom.w; - screen->h = output->config.geom.h; + screen->w = w; + screen->h = h; } if (e_output_connected(output)) { - output->config.geom.x = right_x; - right_x += output->config.geom.w; + e_output_position_set(output, right_x, y); + right_x += w; } else { - output->config.geom.x = 0; + e_output_position_set(output, 0, y); } - screen->x = output->config.geom.x; - screen->y = output->config.geom.y; + screen->x = x; + screen->y = y; if (output->id) screen->id = strdup(output->id); @@ -971,13 +1044,13 @@ e_comp_screen_e_screens_get(E_Comp_Screen *e_comp_screen) 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->e_comp_screen); } 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->e_comp_screen); } EINTERN Eina_Bool @@ -1107,7 +1180,10 @@ e_comp_screen_shutdown() e_dbus_conn_shutdown(); +#ifdef E_DISPLAY +#else _e_comp_screen_deinit_outputs(e_comp->e_comp_screen); +#endif E_FREE_LIST(output_hooks, e_output_hook_del); @@ -1118,6 +1194,8 @@ e_comp_screen_shutdown() e_comp->e_comp_screen = NULL; } +#ifdef E_DISPLAY +#else static E_Output * _e_comp_screen_output_find_primary(E_Comp_Screen *e_comp_screen) { @@ -1145,21 +1223,28 @@ _e_comp_screen_output_find_primary(E_Comp_Screen *e_comp_screen) return output; } +#endif static Eina_Bool _e_comp_screen_rotation_set(E_Comp_Screen *e_comp_screen, int screen_rotation, void (*setter)(E_Comp_Screen *e_comp_screen, int data), int data) { - E_Output *output = NULL; + E_Output *primary_output = NULL; E_Input_Device *dev; const Eina_List *l; int w, h; - output = _e_comp_screen_output_find_primary(e_comp_screen); - if (!output) +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); + if (!primary_output) return EINA_FALSE; +#else + primary_output = _e_comp_screen_output_find_primary(e_comp_screen); + if (!primary_output) + return EINA_FALSE; +#endif - if (!e_output_rotate(output, screen_rotation)) + if (!e_output_rotate(primary_output, screen_rotation)) return EINA_FALSE; e_comp_screen->rotation = screen_rotation; @@ -1265,6 +1350,8 @@ e_comp_screen_rotation_ignore_output_transform_send(E_Client *ec, Eina_Bool igno e_screen_rotation_ignore_output_transform_send(ec, ignore); } +#ifdef E_DISPLAY +#else EINTERN E_Output * e_comp_screen_primary_output_get(E_Comp_Screen *e_comp_screen) { @@ -1475,10 +1562,14 @@ _e_comp_screen_eoutput_get_by_toutput(tdm_output *output) return NULL; } +#endif E_API Eina_Bool e_comp_screen_available_video_formats_get(const tbm_format **formats, int *count) { +#ifdef E_DISPLAY + return e_display_available_video_formats_get(formats, count); +#else E_Output *output; tdm_output *toutput; tdm_layer *layer; @@ -1527,8 +1618,11 @@ e_comp_screen_available_video_formats_get(const tbm_format **formats, int *count } return EINA_TRUE; +#endif } +#ifdef E_DISPLAY +#else EINTERN void * e_comp_screen_gbm_device_get(E_Comp_Screen *e_comp_screen) { @@ -1553,6 +1647,7 @@ e_comp_screen_gbm_device_get(E_Comp_Screen *e_comp_screen) return e_comp_screen->gdevice; } +#endif EINTERN Eina_Bool e_comp_screen_size_get(E_Comp_Screen *e_comp_screen, int *w, int *h) @@ -1564,6 +1659,9 @@ e_comp_screen_size_get(E_Comp_Screen *e_comp_screen, int *w, int *h) return EINA_TRUE; } + +#ifdef E_DISPLAY +#else static char * _e_comp_screen_dpms_to_string(E_OUTPUT_DPMS dpms) { @@ -1590,23 +1688,12 @@ EINTERN void e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter) { Eldbus_Message_Iter *line_array; - E_Comp_Screen *e_comp_screen = NULL; E_Output *output = NULL; E_Hwc *hwc = NULL; Eina_List *l; char info_str[1024]; - e_comp_screen = e_comp->e_comp_screen; - eldbus_message_iter_arguments_append(iter, "as", &line_array); - if (!e_comp_screen) - { - eldbus_message_iter_basic_append(line_array, - 's', - "e_comp_screen not initialized.."); - eldbus_message_iter_container_close(iter, line_array); - return; - } eldbus_message_iter_basic_append(line_array, 's', "==========================================================================================="); @@ -1615,7 +1702,14 @@ e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter) eldbus_message_iter_basic_append(line_array, 's', "==========================================================================================="); + +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else + E_Comp_Screen *e_comp_screen = NULL; + e_comp_screen = e_comp->e_comp_screen; EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { if (!output) continue; hwc = output->hwc; @@ -1637,11 +1731,16 @@ e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter) eldbus_message_iter_container_close(iter, line_array); } +#endif E_API Eina_List * e_comp_screen_outputs_get(E_Comp_Screen *e_comp_screen) { EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL); +#ifdef E_DISPLAY + return e_display_outputs_get(); +#else return e_comp_screen->outputs; +#endif } diff --git a/src/bin/e_comp_screen_intern.h b/src/bin/e_comp_screen_intern.h index 8d1f274..106e99c 100644 --- a/src/bin/e_comp_screen_intern.h +++ b/src/bin/e_comp_screen_intern.h @@ -5,7 +5,10 @@ #include "e_comp_screen.h" #include +//#ifdef E_DISPLAY +//#else #include +//#endif typedef struct _E_Screen E_Screen; @@ -21,15 +24,19 @@ extern EINTERN int E_EVENT_SCREEN_CHANGE; EINTERN Eina_Bool e_comp_screen_init(void); EINTERN void e_comp_screen_shutdown(void); +//#ifdef E_DISPLAY +//#else EINTERN void e_comp_screen_hwc_info_debug(void); -EINTERN void e_comp_screen_e_screens_setup(E_Comp_Screen *e_comp_screen, int rw, int rh); -EINTERN const Eina_List *e_comp_screen_e_screens_get(E_Comp_Screen *e_comp_screen); -EINTERN Eina_Bool e_comp_screen_rotation_pre_set(E_Comp_Screen *e_comp_screen, int rotation_pre); EINTERN E_Output *e_comp_screen_primary_output_get(E_Comp_Screen *e_comp_screen); EINTERN Eina_Bool e_comp_screen_pp_support(void); EINTERN Eina_List *e_comp_screen_pp_available_formats_get(void); EINTERN void *e_comp_screen_gbm_device_get(E_Comp_Screen *e_comp_screen); -EINTERN Eina_Bool e_comp_screen_size_get(E_Comp_Screen *e_comp_screen, int *w, int *h); EINTERN void e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter); +//#endif +EINTERN void e_comp_screen_e_screens_setup(E_Comp_Screen *e_comp_screen, int rw, int rh); +EINTERN const Eina_List *e_comp_screen_e_screens_get(E_Comp_Screen *e_comp_screen); +EINTERN Eina_Bool e_comp_screen_rotation_pre_set(E_Comp_Screen *e_comp_screen, int rotation_pre); +EINTERN Eina_Bool e_comp_screen_size_get(E_Comp_Screen *e_comp_screen, int *w, int *h); +EINTERN Eina_Bool e_comp_screen_size_update(E_Comp_Screen *e_comp_screen); #endif diff --git a/src/bin/inputmgr/e_input_device.c b/src/bin/inputmgr/e_input_device.c index 71b9078..562dc75 100644 --- a/src/bin/inputmgr/e_input_device.c +++ b/src/bin/inputmgr/e_input_device.c @@ -5,6 +5,7 @@ #include "e_comp_screen_intern.h" #include "e_output_intern.h" #include "e_utils_intern.h" +#include "e_display_intern.h" #include #include @@ -478,11 +479,19 @@ e_input_device_rotation_set(E_Input_Device *dev, unsigned int rotation) E_Input_Seat *seat = NULL; E_Input_Evdev *edev = NULL; Eina_List *l = NULL, *l2 = NULL; + E_Output *primary_output = NULL; int temp; EINA_SAFETY_ON_NULL_RETURN(dev); EINA_SAFETY_ON_NULL_RETURN(dev->seats); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + EINA_SAFETY_ON_NULL_RETURN(primary_output); + EINA_LIST_FOREACH(dev->seats, l, seat) { EINA_LIST_FOREACH(e_input_seat_evdev_list_get(seat), l2, edev) @@ -490,8 +499,8 @@ e_input_device_rotation_set(E_Input_Device *dev, unsigned int rotation) if (edev->caps & E_INPUT_SEAT_POINTER) { edev->mouse.minx = edev->mouse.miny = 0; - e_output_size_get(e_comp_screen_primary_output_get(e_comp->e_comp_screen), - &edev->mouse.maxw, &edev->mouse.maxh); + e_output_size_get(primary_output, + &edev->mouse.maxw, &edev->mouse.maxh); if (rotation == 90 || rotation == 270) { @@ -592,11 +601,17 @@ e_input_device_touch_rotation_set(E_Input_Device *dev, unsigned int rotation) float default_w = 0.0, default_h = 0.0; Eina_Bool res = EINA_TRUE; int output_w = 0, output_h = 0; + E_Output *primary_output = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(dev->seats, EINA_FALSE); - e_output_size_get(e_comp_screen_primary_output_get(e_comp->e_comp_screen), &output_w, &output_h); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + e_output_size_get(primary_output, &output_w, &output_h); default_w = (float)output_w; default_h = (float)output_h; @@ -652,12 +667,18 @@ e_input_device_touch_transformation_set(E_Input_Device *dev, int offset_x, int o float default_w = 0.0, default_h = 0.0; Eina_Bool res = EINA_TRUE; int output_w = 0, output_h = 0; + E_Output *primary_output = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(dev->seats, EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL((w == 0) || (h == 0), EINA_FALSE); - e_output_size_get(e_comp_screen_primary_output_get(e_comp->e_comp_screen), &output_w, &output_h); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + e_output_size_get(primary_output, &output_w, &output_h); default_w = (float)output_w; default_h = (float)output_h; diff --git a/src/bin/inputmgr/e_input_evdev.c b/src/bin/inputmgr/e_input_evdev.c index f262e32..8567428 100644 --- a/src/bin/inputmgr/e_input_evdev.c +++ b/src/bin/inputmgr/e_input_evdev.c @@ -8,6 +8,7 @@ #include "e_comp_screen_intern.h" #include "e_output_intern.h" #include "e_utils_intern.h" +#include "e_display_intern.h" #include #include @@ -25,7 +26,7 @@ static Eina_Bool _touch_blocked_by_palm, _touch_up_blocked_by_palm; void e_input_evdev_device_calibration_set(E_Input_Evdev *edev) { - E_Output *output; + E_Output *primary_output; int w = 0, h = 0; int temp; E_Comp_Config *comp_conf; @@ -40,10 +41,14 @@ e_input_evdev_device_calibration_set(E_Input_Evdev *edev) } } - output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); - e_output_size_get(output, &w, &h); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + e_output_size_get(primary_output, &w, &h); - if (output) + if (primary_output) { edev->mouse.minx = edev->mouse.miny = 0; edev->mouse.maxw = w; @@ -58,7 +63,7 @@ e_input_evdev_device_calibration_set(E_Input_Evdev *edev) edev->mouse.dx = edev->seat->ptr.dx; edev->mouse.dy = edev->seat->ptr.dy; - if (output->config.rotation == 90 || output->config.rotation == 270) + if (primary_output->config.rotation == 90 || primary_output->config.rotation == 270) { temp = edev->mouse.minx; edev->mouse.minx = edev->mouse.miny; @@ -1097,13 +1102,20 @@ _device_handle_pointer_motion_absolute(struct libinput_device *device, struct li { E_Input_Evdev *edev; int w = 0, h = 0; + E_Output *primary_output; if (!(edev = libinput_device_get_user_data(device))) { return; } - e_output_size_get(e_comp_screen_primary_output_get(e_comp->e_comp_screen), &w, &h); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif + + e_output_size_get(primary_output, &w, &h); edev->mouse.dx = edev->seat->ptr.dx = libinput_event_pointer_get_absolute_x_transformed(event, w); diff --git a/src/bin/server/e_comp_wl.c b/src/bin/server/e_comp_wl.c index eda49e8..0d5ed2e 100644 --- a/src/bin/server/e_comp_wl.c +++ b/src/bin/server/e_comp_wl.c @@ -40,6 +40,7 @@ #include "e_comp_input_intern.h" #include "e_blur_intern.h" #include "e_input_thread_client_intern.h" +#include "e_display_intern.h" #include #include @@ -2269,14 +2270,19 @@ _e_comp_wl_cb_randr_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *e { Eina_List *l; E_Output *eout; - E_Comp_Screen *e_comp_screen; unsigned int transform = WL_OUTPUT_TRANSFORM_NORMAL; +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, eout) +#else + E_Comp_Screen *e_comp_screen; + if (!e_comp) return ECORE_CALLBACK_RENEW; if (!e_comp->e_comp_screen) return ECORE_CALLBACK_RENEW; e_comp_screen = e_comp->e_comp_screen; EINA_LIST_FOREACH(e_comp_screen->outputs, l, eout) +#endif { if (!eout->config.enabled) { diff --git a/src/bin/server/e_eom.c b/src/bin/server/e_eom.c index a1f65e8..fbb7ef4 100644 --- a/src/bin/server/e_eom.c +++ b/src/bin/server/e_eom.c @@ -4,6 +4,7 @@ #include "e_comp_screen_intern.h" #include "e_comp_wl_subsurface_intern.h" #include "e_output_intern.h" +#include "e_display_intern.h" #include #include @@ -584,7 +585,11 @@ _e_eom_presentation_check(void *data) { if (eom_trace_debug) EOMINF("_e_eom_presentation_check wait expired set to mirror", NULL, eom_output->output); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif e_output_mirror_set(eom_output->output, primary_output); eom_output->wait_presentation = EINA_FALSE; } @@ -662,7 +667,11 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource if (e_output_presentation_ec_get(eom_output->output) == eom_client->ec) e_output_presentation_unset(eom_output->output); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif if (!e_output_mirror_set(eom_output->output, primary_output)) { EOMERR("e_output_mirror_set fail", eom_output->output); @@ -815,7 +824,11 @@ _e_eom_cb_wl_eom_client_destroy(struct wl_resource *resource) _e_eom_output_attribute_set(eom_output, EOM_OUTPUT_ATTRIBUTE_NONE); e_output_presentation_unset(eom_output->output); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif if (!e_output_mirror_set(eom_output->output, primary_output)) EOMERR("e_output_mirror_set fail", eom_output->output); } @@ -919,7 +932,11 @@ _e_eom_connect(E_EomOutputPtr eom_output) { EOMINF("Start Mirroring", NULL, eom_output->output); +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif if (!e_output_mirror_set(eom_output->output, primary_output)) { EOMERR("e_output_mirror_set fail", eom_output->output); @@ -1068,25 +1085,38 @@ _e_eom_output_deinit(void) static Eina_Bool _e_eom_output_init(void) { - E_Comp_Screen *e_comp_screen = NULL; E_Output *output = NULL; E_Output *primary_output = NULL; E_EomOutputPtr eom_output; Eina_List *l; +#ifdef E_DISPLAY + primary_output = e_display_primary_output_get(); +#else + E_Comp_Screen *e_comp_screen = NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE); e_comp_screen = e_comp->e_comp_screen; EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE); primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen); +#endif EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE); +#ifdef E_DISPLAY + g_eom->eom_output_count = e_display_num_outputs_get() - 1; +#else g_eom->eom_output_count = e_comp_screen->num_outputs - 1; +#endif EOMINF("external output count : %d", NULL, NULL, g_eom->eom_output_count); /* create the eom_output except for the primary output */ +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) +#endif { if (!output) continue; if (output == primary_output) continue; diff --git a/src/bin/server/e_explicit_sync.c b/src/bin/server/e_explicit_sync.c index 2fe0f5f..a255cad 100644 --- a/src/bin/server/e_explicit_sync.c +++ b/src/bin/server/e_explicit_sync.c @@ -3,6 +3,7 @@ #include "e_comp_intern.h" #include "e_egl_sync_intern.h" #include "e_client_intern.h" +#include "e_display_intern.h" #include #include @@ -485,7 +486,11 @@ e_explicit_sync_init(void) if (!e_comp_gl_get()) return EINA_FALSE; if (!e_egl_sync_enabled_get()) return EINA_FALSE; +#ifdef E_DISPLAY + EINA_LIST_FOREACH(e_display_outputs_get(), l, output) +#else EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output) +#endif { if (!output) continue; if (!output->hwc) continue; diff --git a/src/include/e_comp_screen.h b/src/include/e_comp_screen.h index 1cd7f6e..2b32410 100644 --- a/src/include/e_comp_screen.h +++ b/src/include/e_comp_screen.h @@ -18,10 +18,13 @@ struct _E_Comp_Screen Eina_List *e_screens; int num_outputs; +//#ifdef E_DISPLAY +//#else tdm_display *tdisplay; tbm_bufmgr bufmgr; void *gdevice; int gdevice_fd; +//#endif /* for sw compositing */ const Eina_List *devices; @@ -31,14 +34,20 @@ struct _E_Comp_Screen int rotation_setting; int rotation; +//#ifdef E_DISPLAY +//#else /* pp support */ Eina_Bool pp_enabled; Eina_List *available_pp_formats; +//#endif tbm_surface_queue_h tqueue; +//#ifdef E_DISPLAY +//#else int fd; Ecore_Fd_Handler *hdlr; +//#endif }; E_API Eina_Bool e_comp_screen_rotation_setting_set(E_Comp_Screen *e_comp_screen, int rotation); diff --git a/src/include/e_output.h b/src/include/e_output.h index b78d66d..08b1a5e 100644 --- a/src/include/e_output.h +++ b/src/include/e_output.h @@ -64,7 +64,6 @@ struct _E_Output tdm_output *toutput; tdm_output_type toutput_type; - E_Comp_Screen *e_comp_screen; E_OUTPUT_DPMS dpms; E_OUTPUT_DPMS set_dpms; Eina_Bool dpms_async; -- 2.7.4