On 01/05/2016 03:07 AM, Wonsik Jung wrote:
> jpeg pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=7db9613e8c95268acfa6d51ea6aa45418ee8e697
>
> commit 7db9613e8c95268acfa6d51ea6aa45418ee8e697
> Author: Wonsik Jung <[email protected]>
> Date:   Tue Jan 5 16:41:14 2016 +0900
>
>      Evas_Engine: add TBM surface and clean up Native Struct
>
>      Summary:
>      Add TBM surface in wayland and clean up Native struct on Evas Engine.
>      Previous TBM surface for evas_object_image's native_surface_set is only 
> in Evas X11 backend.
>      This patch has the code for wayland backend.
>      In addition, evas_native_tbm.c is moved to software_generic. Becuase 
> this file is common.
>      And, Native in Evas_Engine is clean-up.
>
>      @feature
>
>      Test Plan:
>      TBM surface is tested with spacegrapher's test app(tbm.c) in Tizen 
> Device.
>      Pixmap surface is tested in ubuntu with same test app.
>      EvasGL is tested with elementary_test.
>
>      Reviewers: jpeg, spacegrapher, raster, cedric
>
>      Subscribers: dkdk, scholb.kim, JoogabYun
>
>      Differential Revision: https://phab.enlightenment.org/D3501
> ---

<snip>

> diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c 
> b/src/modules/evas/engines/wayland_shm/evas_engine.c
> index 8250090..e6a810c 100644
> --- a/src/modules/evas/engines/wayland_shm/evas_engine.c
> +++ b/src/modules/evas/engines/wayland_shm/evas_engine.c
> @@ -5,6 +5,11 @@
>   #endif
>
>   #include "evas_engine.h"
> +#include "../software_generic/evas_native_common.h"
> +
> +#ifdef HAVE_DLSYM
> +# include <dlfcn.h>
> +#endif
>
>   /* logging domain variable */
>   int _evas_engine_way_shm_log_dom = -1;
> @@ -12,6 +17,8 @@ int _evas_engine_way_shm_log_dom = -1;
>   /* evas function tables - filled in later (func and parent func) */
>   static Evas_Func func, pfunc;
>
> +Evas_Native_Tbm_Surface_Image_Set_Call  
> glsym_evas_native_tbm_surface_image_set = NULL;
> +
>   /* engine structure data */
>   typedef struct _Render_Engine Render_Engine;
>   struct _Render_Engine
> @@ -77,6 +84,22 @@ err:
>      return NULL;
>   }
>
> +static void
> +_symbols(void)
> +{
> +   static int done = 0;
> +
> +   if (done) return;
> +
> +#define LINK2GENERIC(sym) \
> +   glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
> +
> +   // Get function pointer to native_common that is now provided through the 
> link of SW_Generic.
> +   LINK2GENERIC(evas_native_tbm_surface_image_set);
> +
> +   done = 1;
> +}
> +
>   /* ENGINE API FUNCTIONS WE PROVIDE */
>   static void *
>   eng_info(Evas *eo_evas EINA_UNUSED)
> @@ -242,6 +265,71 @@ eng_output_resize(void *data, int w, int h)
>      re->generic.h = h;
>   }
>
> +static void *
> +eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
> +{
> +   Evas_Native_Surface *ns = native;
> +   Image_Entry *ie = image;
> +   RGBA_Image *im = image, *im2;
> +
> +   if (!im || !ns) return im;
> +
> +   if (ns->type == EVAS_NATIVE_SURFACE_TBM)
> +     {
> +        if (im->native.data)
> +          {
> +             //image have native surface already
> +             Evas_Native_Surface *ens = im->native.data;
> +
> +             if ((ens->type == ns->type) &&
> +                 (ens->data.tbm.buffer == ns->data.tbm.buffer))
> +                return im;
> +          }
> +      }
> +
> +   if ((ns->type == EVAS_NATIVE_SURFACE_OPENGL) &&
> +       (ns->version == EVAS_NATIVE_SURFACE_VERSION))
> +     im2 = evas_cache_image_data(evas_common_image_cache_get(),
> +                                 ie->w, ie->h,
> +                                 ns->data.x11.visual, 1,
> +                                 EVAS_COLORSPACE_ARGB8888);

This looks wrong here... How are we going to have an X11 Visual if we 
are running in Wayland ?? Is this a typo/copy & paste error perhaps ?? 
Accessing ns->data.x11.visual seems like it's going to fail as we won't 
have any X11 visuals...

dh

> +   else
> +     im2 = evas_cache_image_data(evas_common_image_cache_get(),
> +                                 ie->w, ie->h,
> +                                 NULL, 1,
> +                                 EVAS_COLORSPACE_ARGB8888);
> +
> +   if (im->native.data)
> +      {
> +         if (im->native.func.free)
> +            im->native.func.free(im->native.func.data, im);
> +      }
> +
> +#ifdef EVAS_CSERVE2
> +   if (evas_cserve2_use_get() && evas_cache2_image_cached(ie))
> +     evas_cache2_image_close(ie);
> +   else
> +#endif
> +   evas_cache_image_drop(ie);
> +   im = im2;
> +
> +   if (ns->type == EVAS_NATIVE_SURFACE_TBM)
> +      return glsym_evas_native_tbm_surface_image_set(NULL, im, ns);
> +
> +   return im;
> +}
> +
> +static void *
> +eng_image_native_get(void *data EINA_UNUSED, void *image)
> +{
> +   RGBA_Image *im = image;
> +   Native *n;
> +   if (!im) return NULL;
> +   n = im->native.data;
> +   if (!n) return NULL;
> +   return &(n->ns);
> +}
> +
>   /* EVAS MODULE FUNCTIONS */
>   static int
>   module_open(Evas_Module *em)
> @@ -273,7 +361,10 @@ module_open(Evas_Module *em)
>      ORD(setup);
>      ORD(output_free);
>      ORD(output_resize);
> +   ORD(image_native_set);
> +   ORD(image_native_get);
>
> +   _symbols();
>      /* advertise our own engine functions */
>      em->functions = (void *)(&func);
>
>


------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to