From 5e36b1c7c19649f189899ddd2027a63d031fa0db Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 4 Oct 2017 11:41:59 -0400 Subject: [PATCH] ecore-evas-drm: Implement support for hardware output rotations This patch adds support for doing output rotations via hardware. This is implemented inside the Ecore_Evas engine so that it is transparent to the caller of ecore_evas_rotation_set. ref T5999 Signed-off-by: Chris Michael --- .../ecore_evas/engines/drm/ecore_evas_drm.c | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) 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 bd569ddbd5..521e05bd42 100644 --- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c +++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c @@ -221,13 +221,64 @@ static void _drm_rotation_do(Ecore_Evas *ee, int rotation, int resize) { Evas_Engine_Info_Drm *einfo; - int diff; + Ecore_Evas_Engine_Drm_Data *edata; + Eina_Bool use_hw = EINA_FALSE; + int diff, rotations = 0, orient = 0; if (ee->rotation == rotation) return; einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(ee->evas); if (!einfo) return; + edata = ee->engine.data; + + rotations = ecore_drm2_output_supported_rotations_get(edata->output); + if (rotations >= 0) + { + if (rotations & ECORE_DRM2_ROTATION_NORMAL) + { + if (rotation == 0) + { + use_hw = EINA_TRUE; + orient = ECORE_DRM2_ROTATION_NORMAL; + } + } + + if (rotations & ECORE_DRM2_ROTATION_90) + { + if (rotation == 90) + { + use_hw = EINA_TRUE; + orient = ECORE_DRM2_ROTATION_90; + } + } + + if (rotations & ECORE_DRM2_ROTATION_180) + { + if (rotation == 180) + { + use_hw = EINA_TRUE; + orient = ECORE_DRM2_ROTATION_180; + } + } + + if (rotations & ECORE_DRM2_ROTATION_270) + { + if (rotation == 270) + { + use_hw = EINA_TRUE; + orient = ECORE_DRM2_ROTATION_270; + } + } + } + + if (use_hw) + { + ecore_drm2_output_rotation_set(edata->output, orient); + ee->rotation = rotation; + return; + } + einfo->info.rotation = rotation; if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);