summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/software_x11/evas_engine.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-10-14 19:42:49 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-10-14 20:14:51 +0900
commit425265ca6d1d926081155d0f23a8d801b5ff56d4 (patch)
treee65eedf0b2ce282bbdbdd227b5b83307daf7a6e4 /src/modules/evas/engines/software_x11/evas_engine.c
parent045f774c2772bf7fc0b5380051e35c671bdef6be (diff)
Evas GL: Fix support for the SW engines (OSMesa)
Since @raster changed the behaviour of the dirty flag on images, damages must be added to redraw the GL surface. Evas_Image checks if it is an Evas GL surface by looking at its native surface. But in case of SW engine, there was no native surface information for Evas GL surfaces. Also, the OPENGL surface type was awfully abused for OSMesa support. Luckily EVASGL surface type lets us pass arbitrary pointers :)
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/software_x11/evas_engine.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c
index 02e6630620..5a5d1cf25a 100644
--- a/src/modules/evas/engines/software_x11/evas_engine.c
+++ b/src/modules/evas/engines/software_x11/evas_engine.c
@@ -632,6 +632,20 @@ eng_canvas_alpha_get(void *data, void *context EINA_UNUSED)
632 (re->outbuf_alpha_get(re->generic.ob)); 632 (re->outbuf_alpha_get(re->generic.ob));
633} 633}
634 634
635static void
636_native_evasgl_free(void *data EINA_UNUSED, void *image)
637{
638 RGBA_Image *im = image;
639 Native *n = im->native.data;
640
641 im->native.data = NULL;
642 im->native.func.data = NULL;
643 im->native.func.bind = NULL;
644 im->native.func.free = NULL;
645 //im->image.data = NULL;
646 free(n);
647}
648
635static void * 649static void *
636eng_image_native_set(void *data EINA_UNUSED, void *image, void *native) 650eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
637{ 651{
@@ -640,7 +654,13 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
640 Image_Entry *ie = image, *ie2 = NULL; 654 Image_Entry *ie = image, *ie2 = NULL;
641 RGBA_Image *im = image; 655 RGBA_Image *im = image;
642 656
643 if (!im || !ns) return im; 657 if (!im) return NULL;
658 if (!ns)
659 {
660 if (im->native.data && im->native.func.free)
661 im->native.func.free(im->native.func.data, im);
662 return NULL;
663 }
644 664
645 if (ns->type == EVAS_NATIVE_SURFACE_X11) 665 if (ns->type == EVAS_NATIVE_SURFACE_X11)
646 { 666 {
@@ -669,10 +689,10 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
669 } 689 }
670 690
671 // Code from software_generic 691 // Code from software_generic
672 if ((ns->type == EVAS_NATIVE_SURFACE_OPENGL) && 692 if ((ns->type == EVAS_NATIVE_SURFACE_EVASGL) &&
673 (ns->version == EVAS_NATIVE_SURFACE_VERSION)) 693 (ns->version == EVAS_NATIVE_SURFACE_VERSION))
674 ie2 = evas_cache_image_data(evas_common_image_cache_get(), 694 ie2 = evas_cache_image_data(evas_common_image_cache_get(),
675 ie->w, ie->h, ns->data.x11.visual, 1, 695 ie->w, ie->h, ns->data.evasgl.surface, 1,
676 EVAS_COLORSPACE_ARGB8888); 696 EVAS_COLORSPACE_ARGB8888);
677 else 697 else
678 ie2 = evas_cache_image_data(evas_common_image_cache_get(), 698 ie2 = evas_cache_image_data(evas_common_image_cache_get(),
@@ -702,10 +722,26 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
702 return evas_xcb_image_native_set(re->generic.ob, ie, ns); 722 return evas_xcb_image_native_set(re->generic.ob, ie, ns);
703#endif 723#endif
704 } 724 }
705 if (ns->type == EVAS_NATIVE_SURFACE_TBM) 725 else if (ns->type == EVAS_NATIVE_SURFACE_TBM)
706 { 726 {
707 return evas_native_tbm_image_set(re->generic.ob, ie, ns); 727 return evas_native_tbm_image_set(re->generic.ob, ie, ns);
708 } 728 }
729 else if (ns->type == EVAS_NATIVE_SURFACE_EVASGL)
730 {
731 /* Native contains Evas_Native_Surface. What a mess. */
732 Native *n = calloc(1, sizeof(Native));
733 if (n)
734 {
735 im = (RGBA_Image *) ie;
736 n->ns.type = EVAS_NATIVE_SURFACE_EVASGL;
737 n->ns.version = EVAS_NATIVE_SURFACE_VERSION;
738 n->ns.data.evasgl.surface = ns->data.evasgl.surface;
739 im->native.data = n;
740 im->native.func.free = _native_evasgl_free;
741 im->native.func.data = NULL;
742 im->native.func.bind = NULL;
743 }
744 }
709 745
710 return ie; 746 return ie;
711} 747}