summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_fb.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-04-28 11:27:10 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-05-05 12:53:23 -0500
commit89630ddeb15d38b0f35a85f23c105dc50557e2ce (patch)
tree552dfe952bc2c913a83a11e5686d2445e277c280 /src/lib/ecore_drm2/ecore_drm2_fb.c
parent8d72a2cf46a69c1f128d957d5c21b8749a128e36 (diff)
ecore_drm2: Refactor common code from non-atomic path
We'll need to perform all this for atomic operations as well.
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index d4c52ae79b..fefd8be6f4 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -378,27 +378,6 @@ _fb_flip(Ecore_Drm2_Output *output)
378 378
379 fb = output->prep.fb; 379 fb = output->prep.fb;
380 380
381 if (output->pending.fb)
382 {
383 if (output->next.fb) _release_buffer(output, output->next.fb);
384 output->next.fb = fb;
385 if (output->next.fb) output->next.fb->busy = EINA_TRUE;
386 return 0;
387 }
388 if (!fb) fb = output->next.fb;
389
390 /* So we can generate a tick by flipping to the current fb */
391 if (!fb) fb = output->current.fb;
392
393 if (output->next.fb)
394 {
395 output->next.fb->busy = EINA_FALSE;
396 output->next.fb = NULL;
397 }
398
399 /* If we don't have an fb to set by now, BAIL! */
400 if (!fb) return -1;
401
402 if ((!output->current.fb) || 381 if ((!output->current.fb) ||
403 (output->current.fb->strides[0] != fb->strides[0])) 382 (output->current.fb->strides[0] != fb->strides[0]))
404 { 383 {
@@ -477,9 +456,6 @@ _fb_flip(Ecore_Drm2_Output *output)
477 return 0; 456 return 0;
478 } 457 }
479 458
480 output->pending.fb = fb;
481 output->pending.fb->busy = EINA_TRUE;
482
483 return 0; 459 return 0;
484} 460}
485 461
@@ -493,6 +469,27 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
493 469
494 if (!output->enabled) return -1; 470 if (!output->enabled) return -1;
495 471
472 if (output->pending.fb)
473 {
474 if (output->next.fb) _release_buffer(output, output->next.fb);
475 output->next.fb = fb;
476 if (output->next.fb) output->next.fb->busy = EINA_TRUE;
477 return 0;
478 }
479 if (!fb) fb = output->next.fb;
480
481 /* So we can generate a tick by flipping to the current fb */
482 if (!fb) fb = output->current.fb;
483
484 if (output->next.fb)
485 {
486 output->next.fb->busy = EINA_FALSE;
487 output->next.fb = NULL;
488 }
489
490 /* If we don't have an fb to set by now, BAIL! */
491 if (!fb) return -1;
492
496 output->prep.fb = fb; 493 output->prep.fb = fb;
497 494
498 if (_ecore_drm2_use_atomic) 495 if (_ecore_drm2_use_atomic)
@@ -500,6 +497,10 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
500 else 497 else
501 ret = _fb_flip(output); 498 ret = _fb_flip(output);
502 499
500 output->pending.fb = fb;
501 output->pending.fb->busy = EINA_TRUE;
502 output->prep.fb = NULL;
503
503 return ret; 504 return ret;
504} 505}
505 506