summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-11-08 13:57:20 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-11-08 15:12:51 -0600
commit566c3f328a2cdeb55f78b5efa0efb8698ec6ae3b (patch)
treeb3ece7b1f14776ce6f90f9e2828df5b2a9165bdd
parent73bddb4471235de4bc61cd44117a2963e5af1620 (diff)
wayland_shm: Remove dmabuf fallback
Now that we're dependent on create_immed there's no possibility of falling back to non dmabuf allocation. The only failing case we really need to handle is failing the first allocation, which is currently broken and I'll be adding an advance test for it shortly.
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_dmabuf.c62
1 files changed, 3 insertions, 59 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
index de1c3fc124..ffa65e9ff2 100644
--- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
@@ -462,6 +462,7 @@ _buffer_manager_deref(void)
462 close(drm_fd); 462 close(drm_fd);
463} 463}
464 464
465/* Currently no callers, but that will change...
465static void 466static void
466_buffer_manager_destroy(void) 467_buffer_manager_destroy(void)
467{ 468{
@@ -469,7 +470,7 @@ _buffer_manager_destroy(void)
469 buffer_manager->destroyed = EINA_TRUE; 470 buffer_manager->destroyed = EINA_TRUE;
470 _buffer_manager_deref(); 471 _buffer_manager_deref();
471} 472}
472 473*/
473 474
474static Buffer_Handle * 475static Buffer_Handle *
475_buffer_manager_alloc(const char *name, int w, int h, unsigned long *stride, int32_t *fd) 476_buffer_manager_alloc(const char *name, int w, int h, unsigned long *stride, int32_t *fd)
@@ -513,57 +514,6 @@ _buffer_manager_discard(Dmabuf_Buffer *buf)
513} 514}
514 515
515static void 516static void
516_fallback(Dmabuf_Surface *s, int w, int h)
517{
518 Dmabuf_Buffer *b;
519 Surface *surf;
520 Eina_Bool recovered;
521 unsigned char *new_data, *old_data;
522 int y;
523
524 dmabuf_totally_hosed = EINA_TRUE;
525 surf = s->surface;
526 if (!surf) goto out;
527
528 recovered = _evas_surface_init(surf, w, h, s->nbuf);
529 if (!recovered)
530 {
531 ERR("Fallback from dmabuf to shm attempted and failed.");
532 abort();
533 }
534
535 /* Since a buffer may have been filled before we realized we can't
536 * display it, we need to make sure any async render on it is finished,
537 * then copy the contents into one of the newly allocated shm buffers
538 */
539
540 b = s->pre;
541 if (!b) b = s->current;
542 if (!b) goto out;
543
544 if (!b->mapping) b->mapping = _buffer_manager_map(b);
545
546 b->busy = EINA_FALSE;
547
548 if (!b->mapping) goto out;
549
550 evas_thread_queue_wait();
551
552 old_data = b->mapping;
553 surf->funcs.assign(surf);
554 new_data = surf->funcs.data_get(surf, NULL, NULL);
555 for (y = 0; y < h; y++)
556 memcpy(new_data + y * w * 4, old_data + y * b->stride, w * 4);
557 surf->funcs.post(surf, NULL, 0);
558 _buffer_manager_unmap(b);
559 b->mapping = NULL;
560
561out:
562 _internal_evas_dmabuf_surface_destroy(s);
563 _buffer_manager_destroy();
564}
565
566static void
567_evas_dmabuf_buffer_unlock(Dmabuf_Buffer *b) 517_evas_dmabuf_buffer_unlock(Dmabuf_Buffer *b)
568{ 518{
569 _buffer_manager_unmap(b); 519 _buffer_manager_unmap(b);
@@ -616,12 +566,7 @@ _evas_dmabuf_surface_reconfigure(Surface *s, int w, int h, uint32_t flags EINA_U
616 _evas_dmabuf_buffer_destroy(b); 566 _evas_dmabuf_buffer_destroy(b);
617 } 567 }
618 buf = _evas_dmabuf_buffer_init(surface, w, h); 568 buf = _evas_dmabuf_buffer_init(surface, w, h);
619 if (!buf) 569 if (!buf) return;
620 {
621 if (surface) _fallback(surface, w, h);
622 s->surf.dmabuf = NULL;
623 return;
624 }
625 surface->buffer[i] = buf; 570 surface->buffer[i] = buf;
626 } 571 }
627} 572}
@@ -777,7 +722,6 @@ _evas_dmabuf_buffer_init(Dmabuf_Surface *s, int w, int h)
777 if (!out->bh) 722 if (!out->bh)
778 { 723 {
779 free(out); 724 free(out);
780 _fallback(s, w, h);
781 return NULL; 725 return NULL;
782 } 726 }
783 out->w = w; 727 out->w = w;