summaryrefslogtreecommitdiff
path: root/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
diff options
context:
space:
mode:
authorChristopher Michael <cp.michael@samsung.com>2019-01-17 09:26:17 -0500
committerDerek Foreman <derek.foreman.samsung@gmail.com>2019-01-17 09:37:39 -0600
commit374373a370937d34a4587cc246750cfae20ad8ef (patch)
treed840e77bef46c68ee65a54bf0257471ea0960a67 /src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
parent8079d6d38a455dc548482353ff739cac82fdfc23 (diff)
ecore-evas-drm: Refactor _ecore_evas_new_internal
This patch does a small refactor of _ecore_evas_new_internal function to separate canvas setup for gl & software. This was done so that when we create a canvas on a per-output bases (multi-output support), the code inside _ecore_evas_new_internal will be cleaner and easier to follow. NB: No real functional changes here until muti-output lands Differential Revision: https://phab.enlightenment.org/D7679
Diffstat (limited to 'src/modules/ecore_evas/engines/drm/ecore_evas_drm.c')
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c96
1 files changed, 58 insertions, 38 deletions
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index 4e25542c39..1d70ba0a98 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -957,6 +957,51 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
957 _drm_last_tick_get, 957 _drm_last_tick_get,
958}; 958};
959 959
960#ifdef BUILD_ECORE_EVAS_GL_DRM
961static void *
962_drm_gl_canvas_setup(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata)
963{
964 Evas_Engine_Info_GL_Drm *einfo;
965 char *num;
966
967 einfo = (Evas_Engine_Info_GL_Drm *)evas_engine_info_get(ee->evas);
968 if (!einfo) return NULL;
969
970 einfo->info.vsync = EINA_TRUE;
971
972 num = getenv("EVAS_DRM_VSYNC");
973 if ((num) && (!atoi(num)))
974 einfo->info.vsync = EINA_FALSE;
975
976 einfo->info.dev = edata->dev;
977 einfo->info.bpp = edata->bpp;
978 einfo->info.depth = edata->depth;
979 einfo->info.format = edata->format;
980 einfo->info.rotation = ee->rotation;
981 einfo->info.output = edata->output;
982
983 return einfo;
984}
985#endif
986
987static void *
988_drm_canvas_setup(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata)
989{
990 Evas_Engine_Info_Drm *einfo;
991
992 einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(ee->evas);
993 if (!einfo) return NULL;
994
995 einfo->info.dev = edata->dev;
996 einfo->info.bpp = edata->bpp;
997 einfo->info.depth = edata->depth;
998 einfo->info.format = edata->format;
999 einfo->info.rotation = ee->rotation;
1000 einfo->info.output = edata->output;
1001
1002 return einfo;
1003}
1004
960static Ecore_Evas * 1005static Ecore_Evas *
961_ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bool gl) 1006_ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bool gl)
962{ 1007{
@@ -1044,48 +1089,23 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
1044 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, 1089 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
1045 _drm_render_updates, ee); 1090 _drm_render_updates, ee);
1046 1091
1047 tinfo = evas_engine_info_get(ee->evas);
1048#ifdef BUILD_ECORE_EVAS_GL_DRM 1092#ifdef BUILD_ECORE_EVAS_GL_DRM
1049 if (tinfo && gl) 1093 if (gl)
1050 { 1094 tinfo = _drm_gl_canvas_setup(ee, edata);
1051 char *num;
1052 Evas_Engine_Info_GL_Drm *einfo = tinfo;
1053
1054 einfo->info.vsync = EINA_TRUE;
1055
1056 num = getenv("EVAS_DRM_VSYNC");
1057 if ((num) && (!atoi(num)))
1058 einfo->info.vsync = EINA_FALSE;
1059
1060 einfo->info.dev = edata->dev;
1061 einfo->info.bpp = edata->bpp;
1062 einfo->info.depth = edata->depth;
1063 einfo->info.format = edata->format;
1064 einfo->info.rotation = ee->rotation;
1065 einfo->info.output = edata->output;
1066 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1067 {
1068 ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
1069 goto eng_err;
1070 }
1071 }
1072 else 1095 else
1073#endif 1096#endif
1074 if (tinfo) 1097 tinfo = _drm_canvas_setup(ee, edata);
1098
1099 if (!tinfo)
1075 { 1100 {
1076 Evas_Engine_Info_Drm *einfo = tinfo; 1101 ERR("evas_engine_info_get() for engine '%s' failed", ee->driver);
1077 1102 goto eng_err;
1078 einfo->info.dev = edata->dev; 1103 }
1079 einfo->info.bpp = edata->bpp; 1104
1080 einfo->info.depth = edata->depth; 1105 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)tinfo))
1081 einfo->info.format = edata->format; 1106 {
1082 einfo->info.rotation = ee->rotation; 1107 ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
1083 einfo->info.output = edata->output; 1108 goto eng_err;
1084 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1085 {
1086 ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
1087 goto eng_err;
1088 }
1089 } 1109 }
1090 1110
1091 ee->prop.window = ecore_drm2_output_crtc_get(edata->output); 1111 ee->prop.window = ecore_drm2_output_crtc_get(edata->output);