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-03-22 12:41:28 -0400
committerChristopher Michael <cp.michael@samsung.com>2019-03-22 12:41:29 -0400
commit8011277dfcb80305887015a56e0027027411f9a9 (patch)
treefceaa014f7265a969b4d00a84a756f5a89b632e4 /src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
parente63c36056e90c8fa1f07ec8c7a168e4a09832313 (diff)
ecore-evas-drm: Enable rotation to work again
Summary: This patch removes the ability to do hardware rotation (it's broken anyway), and refactors the _drm_rotation_do function to just use software (ecore_evas & evas) rotation. ref T7690 Depends on D8115 Reviewers: raster, cedric, zmike Subscribers: cedric Tags: #efl, #do_not_merge Maniphest Tasks: T7690 Differential Revision: https://phab.enlightenment.org/D8116
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.c120
1 files changed, 44 insertions, 76 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 5668b416d1..c60293cb40 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -231,92 +231,52 @@ static void
231_drm_rotation_do(Ecore_Evas *ee, int rotation, int resize) 231_drm_rotation_do(Ecore_Evas *ee, int rotation, int resize)
232{ 232{
233 Evas_Engine_Info_Drm *einfo; 233 Evas_Engine_Info_Drm *einfo;
234 Ecore_Evas_Engine_Drm_Data *edata; 234 int diff;
235 Eina_Bool use_hw = EINA_FALSE;
236 int diff, rotations = 0, orient = 0;
237
238 if (ee->rotation == rotation) return;
239 235
240 einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(ee->evas); 236 einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(ee->evas);
241 if (!einfo) return; 237 if (!einfo) return;
242 238
243 edata = ee->engine.data; 239 diff = ee->rotation - rotation;
240 if (diff < 0) diff = -diff;
244 241
245 rotations = ecore_drm2_output_supported_rotations_get(edata->output); 242 einfo->info.rotation = rotation;
246 if (rotations >= 0)
247 {
248 if (rotations & ECORE_DRM2_ROTATION_NORMAL)
249 {
250 if (rotation == 0)
251 {
252 use_hw = EINA_TRUE;
253 orient = ECORE_DRM2_ROTATION_NORMAL;
254 }
255 }
256 243
257 if (rotations & ECORE_DRM2_ROTATION_90) 244 if (diff != 180)
258 { 245 {
259 if (rotation == 90) 246 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
260 { 247 ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
261 use_hw = EINA_TRUE;
262 orient = ECORE_DRM2_ROTATION_90;
263 }
264 }
265 248
266 if (rotations & ECORE_DRM2_ROTATION_180) 249 if (!resize)
267 { 250 {
268 if (rotation == 180) 251 if (!ee->prop.fullscreen)
269 { 252 {
270 use_hw = EINA_TRUE; 253 ee->expecting_resize.w = ee->h;
271 orient = ECORE_DRM2_ROTATION_180; 254 ee->expecting_resize.h = ee->w;
255 evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
256 evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w);
272 } 257 }
273 } 258 else
274
275 if (rotations & ECORE_DRM2_ROTATION_270)
276 {
277 if (rotation == 270)
278 { 259 {
279 use_hw = EINA_TRUE; 260 if (PORTRAIT_CHECK(rotation))
280 orient = ECORE_DRM2_ROTATION_270; 261 {
262 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
263 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
264 }
265 else
266 {
267 evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
268 evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w);
269 }
270 if (ee->func.fn_resize) ee->func.fn_resize(ee);
281 } 271 }
282 } 272 if (PORTRAIT_CHECK(rotation))
283 }
284
285 if (use_hw)
286 {
287 ecore_drm2_output_rotation_set(edata->output, orient);
288 ee->rotation = rotation;
289 return;
290 }
291
292 einfo->info.rotation = rotation;
293 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
294 ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
295
296 diff = ee->rotation - rotation;
297 if (diff < 0) diff = -diff;
298
299 if (diff != 180)
300 {
301 if (!resize)
302 {
303 int ww, hh;
304
305 if (ECORE_EVAS_PORTRAIT(ee))
306 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); 273 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
307 else 274 else
308 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w); 275 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
309
310 ww = ee->h;
311 hh = ee->w;
312 ee->w = ww;
313 ee->h = hh;
314 ee->req.w = ww;
315 ee->req.h = hh;
316 } 276 }
317 else 277 else
318 { 278 {
319 if ((rotation == 0) || (rotation == 180)) 279 if (PORTRAIT_CHECK(rotation))
320 { 280 {
321 evas_output_size_set(ee->evas, ee->w, ee->h); 281 evas_output_size_set(ee->evas, ee->w, ee->h);
322 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 282 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
@@ -326,17 +286,25 @@ _drm_rotation_do(Ecore_Evas *ee, int rotation, int resize)
326 evas_output_size_set(ee->evas, ee->h, ee->w); 286 evas_output_size_set(ee->evas, ee->h, ee->w);
327 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); 287 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
328 } 288 }
289 if (ee->func.fn_resize) ee->func.fn_resize(ee);
290 if (PORTRAIT_CHECK(rotation))
291 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
292 else
293 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
329 } 294 }
295 ee->rotation = rotation;
330 } 296 }
331
332 ee->rotation = rotation;
333
334 if (ee->func.fn_resize) ee->func.fn_resize(ee);
335
336 if (ECORE_EVAS_PORTRAIT(ee))
337 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
338 else 297 else
339 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); 298 {
299 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
300 ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
301 ee->rotation = rotation;
302 if (ee->func.fn_resize) ee->func.fn_resize(ee);
303 if (PORTRAIT_CHECK(rotation))
304 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
305 else
306 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
307 }
340} 308}
341 309
342static void 310static void