Tizen 2.4 SDK Rev6 Release accepted/tizen_2.4_mobile tizen_2.4 accepted/tizen/2.4/mobile/20160530.220657 submit/tizen_2.4/20160530.023327
authorJaekyu Park <jk7744.park@samsung.com>
Fri, 27 May 2016 07:53:01 +0000 (16:53 +0900)
committerJaekyu Park <jk7744.park@samsung.com>
Fri, 27 May 2016 07:53:01 +0000 (16:53 +0900)
15 files changed:
src/bin/eolian/legacy_generator.c
src/lib/ecore_buffer/Ecore_Buffer.h
src/lib/ecore_buffer/bq_mgr_protocol.c
src/lib/ecore_buffer/bq_mgr_protocol.h
src/lib/ecore_buffer/ecore_buffer.c
src/lib/ecore_buffer/ecore_buffer_consumer.c
src/lib/ecore_buffer/ecore_buffer_private.h
src/lib/ecore_buffer/ecore_buffer_provider.c
src/lib/edje/edje_entry.c
src/lib/evas/Evas_Common.h
src/lib/evas/Evas_Legacy.h
src/lib/evas/canvas/evas_image.eo
src/lib/evas/canvas/evas_object.eo
src/modules/ecore_buffer/x11_dri2/ecore_buffer_x11_dri2.c
src/modules/ecore_buffer/x11_dri3/ecore_buffer_x11_dri3.c

index 11f334a..5ac0623 100644 (file)
@@ -107,10 +107,58 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
      {
         eina_strbuf_append(linedesc," *");
      }
+   // TIZEN_ONLY(20160125): add parameter "obj" documentation
+   Eina_Bool has_param_obj = !!strstr(eina_strbuf_string_get(linedesc), "param[in] obj");
 
    eina_strbuf_replace_all(fbody, "@#desc", eina_strbuf_string_get(linedesc));
    eina_strbuf_free(linedesc);
 
+   if (!has_param_obj)
+     {
+        Eolian_Class_Type type;
+        char *ch, *nm;
+
+        eina_strbuf_append(descparam, " * @param[in] obj The ");
+
+        type = eolian_class_type_get(class);
+
+        nm = strdup(eolian_class_name_get(class));
+        eina_str_tolower(&nm);
+        while ((ch = strchr(nm, '.'))) *ch = ' ';
+        while ((ch = strchr(nm, '_'))) *ch = ' ';
+
+        if (!strncmp(nm, "object", strlen("object")))
+          {
+             ch = nm + strlen("object");
+             if (*ch)
+               {
+                  while (*ch == ' ') ch++;
+                  eina_strbuf_append(descparam, ch);
+                  if ((type == EOLIAN_CLASS_REGULAR) ||
+                      (type == EOLIAN_CLASS_ABSTRACT))
+                    eina_strbuf_append(descparam, " object\n");
+               }
+             else
+               {
+                  free(nm);
+                  nm = strdup(eolian_class_full_name_get(class));
+                  eina_str_tolower(&nm);
+                  while ((ch = strchr(nm, '.'))) *ch = ' ';
+                  while ((ch = strchr(nm, '_'))) *ch = ' ';
+                  eina_strbuf_append(descparam, nm);
+                  eina_strbuf_append_char(descparam, '\n');
+               }
+          }
+        else
+          {
+             eina_strbuf_append(descparam, nm);
+             if ((type == EOLIAN_CLASS_REGULAR) ||
+                 (type == EOLIAN_CLASS_ABSTRACT))
+               eina_strbuf_append(descparam, " object\n");
+          }
+        free(nm);
+     }
+   //
    itr = eolian_property_keys_get(funcid);
    EINA_ITERATOR_FOREACH(itr, data)
      {
index d951600..94bc119 100644 (file)
@@ -426,6 +426,40 @@ typedef enum _Ecore_Export_Type
 } Ecore_Export_Type;
 
 /**
+ * @brief Definition for the maximum number of Ecore_Buffer's plane.
+ * @since_tizen 2.4
+ */
+#define ECORE_BUFFER_PLANE_MAX   4
+
+/**
+ * @brief Definition for the Ecore_Buffer plane struct.
+ * @since_tizen 2.4
+ */
+typedef struct _Ecore_Buffer_Plane
+{
+   int size;
+   int offset;
+   int stride;
+} Ecore_Buffer_Plane;
+
+/**
+ * @brief Definition for the Ecore_Buffer information struct.
+ * @since_tizen 2.4
+ */
+typedef struct _Ecore_Buffer_Info
+{
+   int width;
+   int height;
+   int bpp;
+   int size;
+   Ecore_Buffer_Format format;
+
+   int num_planes;
+   Ecore_Buffer_Plane planes[ECORE_BUFFER_PLANE_MAX];
+   Ecore_Pixmap pixmap;
+} Ecore_Buffer_Info;
+
+/**
  * @struct _Ecore_Buffer_Backend
  * @brief Structure used when initializing Ecore Buffer Backend. This structure
  * is mainly used by modules implementing the Ecore Buffer Backend interface.
@@ -446,13 +480,15 @@ struct _Ecore_Buffer_Backend
                                                                 int *ret_w, int *ret_h,
                                                                 Ecore_Buffer_Format *ret_format,
                                                                 unsigned int flags); /**< Create Ecore_Buffer from existed tbm_surface handle. */
+   Eina_Bool                   (*buffer_info_get)(Ecore_Buffer_Module_Data bmdata,
+                                                  Ecore_Buffer_Data bdata,
+                                                  Ecore_Buffer_Info *info);
    void                        (*buffer_free)(Ecore_Buffer_Module_Data bmdata,
                                               Ecore_Buffer_Data bdata); /**< Free allocated memory */
    Ecore_Export_Type           (*buffer_export)(Ecore_Buffer_Module_Data bmdata,
                                                 Ecore_Buffer_Data bdata, int *id); /**< Get the id or fd of Ecore_Buffer for exporting it */
    Ecore_Buffer_Data           (*buffer_import)(Ecore_Buffer_Module_Data bmdata,
-                                                int w, int h,
-                                                Ecore_Buffer_Format format,
+                                                Ecore_Buffer_Info *info,
                                                 Ecore_Export_Type type,
                                                 int export_id,
                                                 unsigned int flags); /**< Import and create Ecore_Buffer from id or fd */
index fe8b98c..16cf129 100644 (file)
@@ -41,6 +41,14 @@ static const struct wl_interface *types[] = {
        NULL,
        NULL,
        &bq_buffer_interface,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       &bq_buffer_interface,
        &bq_buffer_interface,
        NULL,
        &bq_buffer_interface,
@@ -66,6 +74,14 @@ static const struct wl_interface *types[] = {
        NULL,
        NULL,
        &bq_buffer_interface,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       &bq_buffer_interface,
        &bq_buffer_interface,
        NULL,
        &bq_buffer_interface,
@@ -84,6 +100,7 @@ WL_EXPORT const struct wl_interface bq_mgr_interface = {
 };
 
 static const struct wl_message bq_consumer_requests[] = {
+       { "destroy", "", types + 0 },
        { "release_buffer", "o", types + 10 },
 };
 
@@ -92,40 +109,47 @@ static const struct wl_message bq_consumer_events[] = {
        { "disconnected", "", types + 0 },
        { "buffer_attached", "nsiiiu", types + 11 },
        { "set_buffer_id", "oiiiiiii", types + 17 },
-       { "set_buffer_fd", "ohiiiiii", types + 25 },
-       { "buffer_detached", "o", types + 33 },
-       { "add_buffer", "ou", types + 34 },
+       { "set_buffer_pixmap_id", "oiiiiiii", types + 25 },
+       { "set_buffer_fd", "ohiiiiii", types + 33 },
+       { "buffer_detached", "o", types + 41 },
+       { "add_buffer", "ou", types + 42 },
 };
 
 WL_EXPORT const struct wl_interface bq_consumer_interface = {
        "bq_consumer", 1,
-       1, bq_consumer_requests,
-       7, bq_consumer_events,
+       2, bq_consumer_requests,
+       8, bq_consumer_events,
 };
 
 static const struct wl_message bq_provider_requests[] = {
-       { "attach_buffer", "nsiiiu", types + 36 },
-       { "set_buffer_id", "oiiiiiii", types + 42 },
-       { "set_buffer_fd", "ohiiiiii", types + 50 },
-       { "detach_buffer", "o", types + 58 },
-       { "enqueue_buffer", "ou", types + 59 },
+       { "destroy", "", types + 0 },
+       { "attach_buffer", "nsiiiu", types + 44 },
+       { "set_buffer_id", "oiiiiiii", types + 50 },
+       { "set_buffer_pixmap_id", "oiiiiiii", types + 58 },
+       { "set_buffer_fd", "ohiiiiii", types + 66 },
+       { "detach_buffer", "o", types + 74 },
+       { "enqueue_buffer", "ou", types + 75 },
 };
 
 static const struct wl_message bq_provider_events[] = {
        { "connected", "iii", types + 0 },
        { "disconnected", "", types + 0 },
-       { "add_buffer", "ou", types + 61 },
+       { "add_buffer", "ou", types + 77 },
 };
 
 WL_EXPORT const struct wl_interface bq_provider_interface = {
        "bq_provider", 1,
-       5, bq_provider_requests,
+       7, bq_provider_requests,
        3, bq_provider_events,
 };
 
+static const struct wl_message bq_buffer_requests[] = {
+       { "destroy", "", types + 0 },
+};
+
 WL_EXPORT const struct wl_interface bq_buffer_interface = {
        "bq_buffer", 1,
-       0, NULL,
+       1, bq_buffer_requests,
        0, NULL,
 };
 
index 7cf9ad9..e80debd 100644 (file)
@@ -124,6 +124,27 @@ struct bq_consumer_listener {
                              int32_t offset2,
                              int32_t stride2);
        /**
+        * set_buffer_pixmap_id - (none)
+        * @buffer: (none)
+        * @id: (none)
+        * @offset0: (none)
+        * @stride0: (none)
+        * @offset1: (none)
+        * @stride1: (none)
+        * @offset2: (none)
+        * @stride2: (none)
+        */
+       void (*set_buffer_pixmap_id)(void *data,
+                                    struct bq_consumer *bq_consumer,
+                                    struct bq_buffer *buffer,
+                                    int32_t id,
+                                    int32_t offset0,
+                                    int32_t stride0,
+                                    int32_t offset1,
+                                    int32_t stride1,
+                                    int32_t offset2,
+                                    int32_t stride2);
+       /**
         * set_buffer_fd - (none)
         * @buffer: (none)
         * @fd: (none)
@@ -170,7 +191,8 @@ bq_consumer_add_listener(struct bq_consumer *bq_consumer,
                                     (void (**)(void)) listener, data);
 }
 
-#define BQ_CONSUMER_RELEASE_BUFFER     0
+#define BQ_CONSUMER_DESTROY    0
+#define BQ_CONSUMER_RELEASE_BUFFER     1
 
 static inline void
 bq_consumer_set_user_data(struct bq_consumer *bq_consumer, void *user_data)
@@ -187,6 +209,9 @@ bq_consumer_get_user_data(struct bq_consumer *bq_consumer)
 static inline void
 bq_consumer_destroy(struct bq_consumer *bq_consumer)
 {
+       wl_proxy_marshal((struct wl_proxy *) bq_consumer,
+                        BQ_CONSUMER_DESTROY);
+
        wl_proxy_destroy((struct wl_proxy *) bq_consumer);
 }
 
@@ -241,11 +266,13 @@ bq_provider_add_listener(struct bq_provider *bq_provider,
                                     (void (**)(void)) listener, data);
 }
 
-#define BQ_PROVIDER_ATTACH_BUFFER      0
-#define BQ_PROVIDER_SET_BUFFER_ID      1
-#define BQ_PROVIDER_SET_BUFFER_FD      2
-#define BQ_PROVIDER_DETACH_BUFFER      3
-#define BQ_PROVIDER_ENQUEUE_BUFFER     4
+#define BQ_PROVIDER_DESTROY    0
+#define BQ_PROVIDER_ATTACH_BUFFER      1
+#define BQ_PROVIDER_SET_BUFFER_ID      2
+#define BQ_PROVIDER_SET_BUFFER_PIXMAP_ID       3
+#define BQ_PROVIDER_SET_BUFFER_FD      4
+#define BQ_PROVIDER_DETACH_BUFFER      5
+#define BQ_PROVIDER_ENQUEUE_BUFFER     6
 
 static inline void
 bq_provider_set_user_data(struct bq_provider *bq_provider, void *user_data)
@@ -262,6 +289,9 @@ bq_provider_get_user_data(struct bq_provider *bq_provider)
 static inline void
 bq_provider_destroy(struct bq_provider *bq_provider)
 {
+       wl_proxy_marshal((struct wl_proxy *) bq_provider,
+                        BQ_PROVIDER_DESTROY);
+
        wl_proxy_destroy((struct wl_proxy *) bq_provider);
 }
 
@@ -284,6 +314,13 @@ bq_provider_set_buffer_id(struct bq_provider *bq_provider, struct bq_buffer *buf
 }
 
 static inline void
+bq_provider_set_buffer_pixmap_id(struct bq_provider *bq_provider, struct bq_buffer *buffer, int32_t id, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
+{
+       wl_proxy_marshal((struct wl_proxy *) bq_provider,
+                        BQ_PROVIDER_SET_BUFFER_PIXMAP_ID, buffer, id, offset0, stride0, offset1, stride1, offset2, stride2);
+}
+
+static inline void
 bq_provider_set_buffer_fd(struct bq_provider *bq_provider, struct bq_buffer *buffer, int32_t fd, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
 {
        wl_proxy_marshal((struct wl_proxy *) bq_provider,
@@ -304,6 +341,8 @@ bq_provider_enqueue_buffer(struct bq_provider *bq_provider, struct bq_buffer *bu
                         BQ_PROVIDER_ENQUEUE_BUFFER, buffer, serial);
 }
 
+#define BQ_BUFFER_DESTROY      0
+
 static inline void
 bq_buffer_set_user_data(struct bq_buffer *bq_buffer, void *user_data)
 {
@@ -319,6 +358,9 @@ bq_buffer_get_user_data(struct bq_buffer *bq_buffer)
 static inline void
 bq_buffer_destroy(struct bq_buffer *bq_buffer)
 {
+       wl_proxy_marshal((struct wl_proxy *) bq_buffer,
+                        BQ_BUFFER_DESTROY);
+
        wl_proxy_destroy((struct wl_proxy *) bq_buffer);
 }
 
index 44a274f..e90a1e7 100644 (file)
@@ -23,11 +23,9 @@ struct _Ecore_Buffer_Module
 
 struct _Ecore_Buffer
 {
-   unsigned int width;
-   unsigned int height;
-   int format;
    unsigned int flags;
 
+   Ecore_Buffer_Info info;
    Ecore_Buffer_Data buffer_data;
    Ecore_Buffer_Module *bm;
 
@@ -90,7 +88,8 @@ _ecore_buffer_get_backend(const char *name)
    if ((!bm) || (!bm->be) || (!bm->be->init))
      return NULL;
 
-   bm->data = bm->be->init(NULL, NULL);
+   if (!bm->data)
+     bm->data = bm->be->init(NULL, NULL);
 
    return bm;
 }
@@ -266,10 +265,16 @@ ecore_buffer_new(const char *engine, unsigned int width, unsigned int height, Ec
         return NULL;
      }
 
+   if (bm->be->buffer_info_get)
+     bm->be->buffer_info_get(bm->data, bo_data, &bo->info);
+   else
+     {
+        bo->info.width = width;
+        bo->info.height = height;
+        bo->info.format = format;
+     }
+
    bo->bm = bm;
-   bo->width = width;
-   bo->height = height;
-   bo->format = format;
    bo->flags = flags;
    bo->buffer_data = bo_data;
 
@@ -312,12 +317,18 @@ ecore_buffer_new_with_tbm_surface(const char *engine, void *tbm_surface, unsigne
         return NULL;
      }
 
+   if (bm->be->buffer_info_get)
+     bm->be->buffer_info_get(bm->data, bo_data, &bo->info);
+   else
+     {
+        bo->info.width = w;
+        bo->info.height = h;
+        bo->info.format = format;
+     }
+
    bo->bm = bm;
    bo->flags = flags;
    bo->buffer_data = bo_data;
-   bo->width = w;
-   bo->height = h;
-   bo->format = format;
 
    return bo;
 }
@@ -386,8 +397,8 @@ ecore_buffer_size_get(Ecore_Buffer *buf, unsigned int *width, unsigned int *heig
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(buf, EINA_FALSE);
 
-   if (width) *width = buf->width;
-   if (height) *height = buf->height;
+   if (width) *width = buf->info.width;
+   if (height) *height = buf->info.height;
 
    return EINA_TRUE;
 }
@@ -397,7 +408,7 @@ ecore_buffer_format_get(Ecore_Buffer *buf)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(buf, 0);
 
-   return buf->format;
+   return buf->info.format;
 }
 
 EAPI unsigned int
@@ -480,7 +491,7 @@ _ecore_buffer_export(Ecore_Buffer *buf, int *id)
 }
 
 Ecore_Buffer *
-_ecore_buffer_import(const char *engine, int width, int height, Ecore_Buffer_Format format, Ecore_Export_Type type, int export_id, unsigned int flags)
+_ecore_buffer_import(const char *engine, Ecore_Buffer_Info *info, Ecore_Export_Type type, int export_id, unsigned int flags)
 {
    Ecore_Buffer_Module *bm;
    Ecore_Buffer *bo;
@@ -505,19 +516,29 @@ _ecore_buffer_import(const char *engine, int width, int height, Ecore_Buffer_For
    if (!bo)
      return NULL;
 
-   bo_data = bm->be->buffer_import(bm->data, width, height, format, type, export_id, flags);
+   bo_data = bm->be->buffer_import(bm->data, info, type, export_id, flags);
    if (!bo_data)
      {
         free(bo);
         return NULL;
      }
 
+   memcpy(&bo->info, info, sizeof(*info));
+
    bo->bm = bm;
-   bo->width = width;
-   bo->height = height;
-   bo->format = format;
    bo->flags = flags;
    bo->buffer_data = bo_data;
 
    return bo;
 }
+
+Eina_Bool
+_ecore_buffer_info_get(Ecore_Buffer *buf, Ecore_Buffer_Info *info)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(buf, EINA_FALSE);
+
+   if (info)
+     memcpy(info, &buf->info, sizeof(*info));
+
+   return EINA_TRUE;
+}
index eabdead..e770b20 100644 (file)
@@ -28,11 +28,12 @@ static void _ecore_buffer_consumer_cb_provider_connected(void *data, struct bq_c
 static void _ecore_buffer_consumer_cb_provider_disconnected(void *data, struct bq_consumer *bq_consumer);
 static void _ecore_buffer_consumer_cb_buffer_attached(void *data, struct bq_consumer *bq_consumer, struct bq_buffer *id, const char *engine, int32_t width, int32_t height, int32_t format, uint32_t flags);
 static void _ecore_buffer_consumer_cb_buffer_id_set(void *data, struct bq_consumer *bq_consumer, struct bq_buffer *buffer, int32_t id, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2);
+static void _ecore_buffer_consumer_cb_buffer_pixmap_id_set(void *data, struct bq_consumer *bq_consumer, struct bq_buffer *buffer, int32_t id, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2);
 static void _ecore_buffer_consumer_cb_buffer_fd_set(void *data, struct bq_consumer *bq_consumer, struct bq_buffer *buffer, int32_t fd, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2);
 static void _ecore_buffer_consumer_cb_buffer_detached(void *data, struct bq_consumer *bq_consumer, struct bq_buffer *id);
 static void _ecore_buffer_consumer_cb_add_buffer(void *data, struct bq_consumer *bq_consumer, struct bq_buffer *buffer, uint32_t serial);
 static void _ecore_buffer_consumer_cb_buffer_free(Ecore_Buffer *buf, void *data);
-static Eina_Bool _ecore_buffer_consumer_buffer_import(Ecore_Buffer_Consumer *consumer, Shared_Buffer *sb, int32_t seed, Ecore_Export_Type export_type);
+static Eina_Bool _ecore_buffer_consumer_buffer_import(Ecore_Buffer_Consumer *consumer, Shared_Buffer *sb, int32_t seed, Ecore_Export_Type export_type, Ecore_Buffer_Info *info);
 
 struct bq_consumer_listener _ecore_buffer_consumer_listener =
 {
@@ -40,6 +41,7 @@ struct bq_consumer_listener _ecore_buffer_consumer_listener =
    _ecore_buffer_consumer_cb_provider_disconnected,
    _ecore_buffer_consumer_cb_buffer_attached,
    _ecore_buffer_consumer_cb_buffer_id_set,
+   _ecore_buffer_consumer_cb_buffer_pixmap_id_set,
    _ecore_buffer_consumer_cb_buffer_fd_set,
    _ecore_buffer_consumer_cb_buffer_detached,
    _ecore_buffer_consumer_cb_add_buffer
@@ -90,6 +92,24 @@ ecore_buffer_consumer_new(const char *name, int32_t queue_size, int32_t w, int32
    return consumer;
 }
 
+static void
+_consumer_shared_buffer_free(Ecore_Buffer_Consumer *consumer)
+{
+   Eina_List *clone, *shared_buffers, *l;
+   Shared_Buffer *sb;
+
+   if (!consumer->ebq)
+     return;
+
+   shared_buffers = _ecore_buffer_queue_shared_buffer_list_get(consumer->ebq);
+   clone = eina_list_clone(shared_buffers);
+
+   EINA_LIST_FOREACH(clone, l, sb)
+      ecore_buffer_free(_shared_buffer_buffer_get(sb));
+
+   eina_list_free(clone);
+}
+
 EAPI void
 ecore_buffer_consumer_free(Ecore_Buffer_Consumer *consumer)
 {
@@ -97,6 +117,8 @@ ecore_buffer_consumer_free(Ecore_Buffer_Consumer *consumer)
 
    DBG("Consumer Free");
 
+   _consumer_shared_buffer_free(consumer);
+
    if (consumer->ebq)
      _ecore_buffer_queue_free(consumer->ebq);
 
@@ -232,8 +254,6 @@ static void
 _ecore_buffer_consumer_cb_provider_disconnected(void *data, struct bq_consumer *bq_consumer EINA_UNUSED)
 {
    Ecore_Buffer_Consumer *consumer = data;
-   Eina_List *clone, *shared_buffers, *l;
-   Shared_Buffer *sb;
 
    EINA_SAFETY_ON_NULL_RETURN(consumer);
 
@@ -243,13 +263,7 @@ _ecore_buffer_consumer_cb_provider_disconnected(void *data, struct bq_consumer *
 
    CALLBACK_CALL(consumer, provider_del);
 
-   shared_buffers = _ecore_buffer_queue_shared_buffer_list_get(consumer->ebq);
-   clone = eina_list_clone(shared_buffers);
-
-   EINA_LIST_FOREACH(clone, l, sb)
-      ecore_buffer_free(_shared_buffer_buffer_get(sb));
-
-   eina_list_free(clone);
+   _consumer_shared_buffer_free(consumer);
 }
 
 static void
@@ -288,35 +302,68 @@ _ecore_buffer_consumer_cb_buffer_free(Ecore_Buffer *buf, void *data)
    _shared_buffer_free(sb);
 }
 
+#define INFO_SET(I, PIX)         \
+   I.planes[0].offset = offset0; \
+   I.planes[0].stride = stride0; \
+   I.planes[1].offset = offset1; \
+   I.planes[1].stride = stride1; \
+   I.planes[2].offset = offset2; \
+   I.planes[2].stride = stride2; \
+   I.pixmap = PIX
+static void
+_ecore_buffer_consumer_cb_buffer_id_set(void *data, struct bq_consumer *bq_consumer EINA_UNUSED, struct bq_buffer *buffer, int32_t id, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
+{
+   Ecore_Buffer_Consumer *consumer = data;
+   Shared_Buffer *sb = bq_buffer_get_user_data(buffer);
+   Ecore_Buffer_Info info;
+
+   EINA_SAFETY_ON_NULL_RETURN(consumer);
+   EINA_SAFETY_ON_NULL_RETURN(sb);
+
+   INFO_SET(info, 0);
+
+   if (_ecore_buffer_consumer_buffer_import(consumer, sb, id, EXPORT_TYPE_ID, &info))
+     bq_buffer_set_user_data(buffer, sb);
+   else
+     ERR("Failed to import buffer - buffer resource %p", buffer);
+}
+
 static void
-_ecore_buffer_consumer_cb_buffer_id_set(void *data, struct bq_consumer *bq_consumer EINA_UNUSED, struct bq_buffer *buffer, int32_t id, int32_t offset0 EINA_UNUSED, int32_t stride0 EINA_UNUSED, int32_t offset1 EINA_UNUSED, int32_t stride1 EINA_UNUSED, int32_t offset2 EINA_UNUSED, int32_t stride2 EINA_UNUSED)
+_ecore_buffer_consumer_cb_buffer_pixmap_id_set(void *data, struct bq_consumer *bq_consumer EINA_UNUSED, struct bq_buffer *buffer, int32_t id, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
 {
    Ecore_Buffer_Consumer *consumer = data;
    Shared_Buffer *sb = bq_buffer_get_user_data(buffer);
+   Ecore_Buffer_Info info;
 
    EINA_SAFETY_ON_NULL_RETURN(consumer);
    EINA_SAFETY_ON_NULL_RETURN(sb);
 
-   if (_ecore_buffer_consumer_buffer_import(consumer, sb, id, EXPORT_TYPE_ID))
+   INFO_SET(info, id);
+
+   if (_ecore_buffer_consumer_buffer_import(consumer, sb, id, EXPORT_TYPE_ID, &info))
      bq_buffer_set_user_data(buffer, sb);
    else
      ERR("Failed to import buffer - buffer resource %p", buffer);
 }
 
 static void
-_ecore_buffer_consumer_cb_buffer_fd_set(void *data, struct bq_consumer *bq_consumer EINA_UNUSED, struct bq_buffer *buffer, int32_t fd, int32_t offset0 EINA_UNUSED, int32_t stride0 EINA_UNUSED, int32_t offset1 EINA_UNUSED, int32_t stride1 EINA_UNUSED, int32_t offset2 EINA_UNUSED, int32_t stride2 EINA_UNUSED)
+_ecore_buffer_consumer_cb_buffer_fd_set(void *data, struct bq_consumer *bq_consumer EINA_UNUSED, struct bq_buffer *buffer, int32_t fd, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
 {
    Ecore_Buffer_Consumer *consumer = data;
    Shared_Buffer *sb = bq_buffer_get_user_data(buffer);
+   Ecore_Buffer_Info info;
 
    EINA_SAFETY_ON_NULL_RETURN(consumer);
    EINA_SAFETY_ON_NULL_RETURN(sb);
 
-   if (_ecore_buffer_consumer_buffer_import(consumer, sb, fd, EXPORT_TYPE_FD))
+   INFO_SET(info, 0);
+
+   if (_ecore_buffer_consumer_buffer_import(consumer, sb, fd, EXPORT_TYPE_FD, &info))
      bq_buffer_set_user_data(buffer, sb);
    else
      ERR("Failed to import buffer - buffer resource %p", buffer);
 }
+#undef INFO_SET
 
 static void
 _ecore_buffer_consumer_cb_buffer_detached(void *data, struct bq_consumer *bq_consumer EINA_UNUSED, struct bq_buffer *id)
@@ -377,7 +424,7 @@ _ecore_buffer_consumer_cb_add_buffer(void *data, struct bq_consumer *bq_consumer
 }
 
 static Eina_Bool
-_ecore_buffer_consumer_buffer_import(Ecore_Buffer_Consumer *consumer, Shared_Buffer *sb, int32_t seed, Ecore_Export_Type export_type)
+_ecore_buffer_consumer_buffer_import(Ecore_Buffer_Consumer *consumer, Shared_Buffer *sb, int32_t seed, Ecore_Export_Type export_type, Ecore_Buffer_Info *info)
 {
    Ecore_Buffer *buffer;
    const char *engine = NULL;
@@ -398,7 +445,11 @@ _ecore_buffer_consumer_buffer_import(Ecore_Buffer_Consumer *consumer, Shared_Buf
         return EINA_FALSE;
      }
 
-   if (!(buffer = _ecore_buffer_import(engine, w, h, format, export_type, seed, flags)))
+   info->width = w;
+   info->height = h;
+   info->format = format;
+
+   if (!(buffer = _ecore_buffer_import(engine, info, export_type, seed, flags)))
      {
         ERR("Failed to Import Buffer - size (%dx%d), foramt %d, seed %d, export_type %d",
             w, h, format, seed, export_type);
index 4e33772..d00d85e 100644 (file)
@@ -27,5 +27,6 @@ const char        *_ecore_buffer_engine_name_get(Ecore_Buffer *buf);
 /* NOTE: if Ecore_Export_Type as a return value is EXPORT_TYPE_FD,
  * then caller should close the fd after using it. */
 Ecore_Export_Type  _ecore_buffer_export(Ecore_Buffer *buf, int *id);
-Ecore_Buffer      *_ecore_buffer_import(const char *engine, int width, int height, Ecore_Buffer_Format format, Ecore_Export_Type type, int export_id, unsigned int flags);
+Ecore_Buffer      *_ecore_buffer_import(const char *engine, Ecore_Buffer_Info *info, Ecore_Export_Type type, int export_id, unsigned int flags);
+Eina_Bool          _ecore_buffer_info_get(Ecore_Buffer *buf, Ecore_Buffer_Info *info);
 #endif /* _ECORE_BUFFER_PRIVATE_H_ */
index 179662c..1f166fa 100644 (file)
@@ -311,12 +311,16 @@ static Shared_Buffer *
 _ecore_buffer_provider_shared_buffer_new(Ecore_Buffer_Provider *provider, Ecore_Buffer *buffer)
 {
    Shared_Buffer *sb;
+   Ecore_Export_Type export_type;
+   Ecore_Buffer_Info info;
+   Eina_Bool res;
    struct bq_buffer *buf_resource;
    unsigned int w = 0, h = 0, format = 0;
-   Ecore_Export_Type export_type;
    int export_id;
    const char *engine;
    unsigned int flags;
+   int offset[3] = {0,}, stride[3] = {0,};
+   int i;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(provider, NULL);
 
@@ -328,12 +332,30 @@ _ecore_buffer_provider_shared_buffer_new(Ecore_Buffer_Provider *provider, Ecore_
         return NULL;
      }
 
-   ecore_buffer_size_get(buffer, &w, &h);
-   format = ecore_buffer_format_get(buffer);
-   export_type = _ecore_buffer_export(buffer, &export_id);
    engine = _ecore_buffer_engine_name_get(buffer);
    flags = ecore_buffer_flags_get(buffer);
 
+   res = _ecore_buffer_info_get(buffer, &info);
+   if (res)
+     {
+        int count;
+        w = info.width;
+        h = info.height;
+        format = info.format;
+        /* FIXME info.num_planes may be 4 */
+        count = info.num_planes < 4 ? info.num_planes : 3;
+        for (i = 0; i < count; i++)
+          {
+             offset[i] = info.planes[i].offset;
+             stride[i] = info.planes[i].stride;
+          }
+     }
+   else
+     {
+        ecore_buffer_size_get(buffer, &w, &h);
+        format = ecore_buffer_format_get(buffer);
+     }
+
    buf_resource = bq_provider_attach_buffer(provider->resource, engine, w, h, format, flags);
    if (!buf_resource)
      {
@@ -342,15 +364,36 @@ _ecore_buffer_provider_shared_buffer_new(Ecore_Buffer_Provider *provider, Ecore_
         return NULL;
      }
 
+   export_type = _ecore_buffer_export(buffer, &export_id);
    switch (export_type)
      {
       case EXPORT_TYPE_ID:
-         bq_provider_set_buffer_id(provider->resource, buf_resource,
-                                   export_id, 0, 0, 0, 0, 0, 0);
+         if (info.pixmap)
+           {
+              bq_provider_set_buffer_pixmap_id(provider->resource,
+                                               buf_resource,
+                                               info.pixmap,
+                                               offset[0], stride[0],
+                                               offset[1], stride[1],
+                                               offset[2], stride[2]);
+           }
+         else
+           {
+              bq_provider_set_buffer_id(provider->resource,
+                                        buf_resource,
+                                        export_id,
+                                        offset[0], stride[0],
+                                        offset[1], stride[1],
+                                        offset[2], stride[2]);
+           }
          break;
       case EXPORT_TYPE_FD:
-         bq_provider_set_buffer_fd(provider->resource, buf_resource,
-                                   export_id, 0, 0, 0, 0, 0, 0);
+         bq_provider_set_buffer_fd(provider->resource,
+                                   buf_resource,
+                                   export_id,
+                                   offset[0], stride[0],
+                                   offset[1], stride[1],
+                                   offset[2], stride[2]);
          close(export_id);
          break;
       default:
index 45e371b..5ddc0eb 100644 (file)
@@ -4566,6 +4566,12 @@ _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx E
    _edje_emit(ed, "entry,changed", en->rp->part->name);
    _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
                    _free_entry_change_info);
+   _edje_emit(ed, "cursor,changed", en->rp->part->name);
+   _edje_emit(ed, "cursor,changed,manual", en->rp->part->name);
+
+   _edje_entry_imf_cursor_info_set(en);
+   _edje_entry_real_part_configure(ed, rp);
+
 end:
    evas_textblock_cursor_free(del_start);
    evas_textblock_cursor_free(del_end);
index 7c4062e..8b85664 100644 (file)
@@ -460,6 +460,11 @@ typedef Efl_Gfx_Fill_Spread Evas_Fill_Spread;
 #define EVAS_TEXTURE_RESTRICT_REPEAT EFL_GFX_FILL_RESTRICT_REPEAT
 #define EVAS_TEXTURE_PAD EFL_GFX_FILL_PAD
 
+/**
+ * @typedef Evas_Pixel_Import_Pixel_Format
+ * Pixel format for import call. See evas_object_image_pixels_import()
+ * @ingroup Evas_Object_Image
+ */
 typedef enum _Evas_Pixel_Import_Pixel_Format
 {
    EVAS_PIXEL_FORMAT_NONE = 0, /**< No pixel format */
@@ -467,6 +472,11 @@ typedef enum _Evas_Pixel_Import_Pixel_Format
    EVAS_PIXEL_FORMAT_YUV420P_601 = 2 /**< YUV 420 Planar format with CCIR 601 color encoding with contiguous planes in the order Y, U and V */
 } Evas_Pixel_Import_Pixel_Format; /**< Pixel format for import call. See evas_object_image_pixels_import() */
 
+/**
+ * @typedef Evas_Pixel_Import_Source
+ * A source description of pixels for importing pixels
+ * @ingroup Evas_Object_Image
+ */
 struct _Evas_Pixel_Import_Source
 {
    Evas_Pixel_Import_Pixel_Format format; /**< pixel format type ie ARGB32, YUV420P_601 etc. */
index 741e6e3..ec243d3 100644 (file)
@@ -379,7 +379,7 @@ EAPI void             evas_event_thaw(Evas *e) EINA_ARG_NONNULL(1);
 EAPI int              evas_event_freeze_get(const Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
 
 /**
- * @brief After thaw of a canvas, re-evaluate the state of objects and call callbacks
+ * @brief After thaw of a canvas, evaluate the state of objects and call callbacks
  *
  * @if MOBILE @since_tizen 2.3
  * @elseif WEARABLE @since_tizen 2.3.1
@@ -387,9 +387,11 @@ EAPI int              evas_event_freeze_get(const Evas *e) EINA_WARN_UNUSED_RESU
  *
  * @param[in] e The canvas to evaluate after a thaw
  *
- * @remark This is normally called after evas_event_thaw() to re-evaluate mouse
+ * @remark This is normally called after evas_event_thaw() to evaluate mouse
  * containment and other states and thus also call callbacks for mouse in and
- * out on new objects if the state change demands it.
+ * out on new objects if the state change demands it. This will re-evaluate
+ * the states of objects and call callbacks, because this is normally called
+ * after evas_event_thaw(), and the evas_event_thaw() evaluates interally.
  */
 EAPI void             evas_event_thaw_eval(Evas *e) EINA_ARG_NONNULL(1);
 /**
@@ -2552,13 +2554,19 @@ EAPI void                          evas_object_image_native_surface_set(Evas_Obj
  * @elseif WEARABLE @since_tizen 2.3.1
  * @endif
  *
+ * @ingroup Evas_Object_Image
+ *
  * @param[in] obj The given image object.
  * @param[in] cancel @c EINA_FALSE will add it the preloading work queue,
  *               @c EINA_TRUE will remove it (if it was issued before).
  *
  * @remark This function requests the preload of the data image in the
- * background. The work is queued before being processed (because
- * there might be other pending requests of this type).
+ * background asynchronously. The work is queued before being processed
+ * (because there might be other pending requests of this type).
+ *
+ * @remark In general, the image data will be loaded at render time.
+ * But if evas_object_image_preload() is called with EINA_FALSE as param,
+ * the image data load will be queued.
  *
  * @remark Whenever the image data gets loaded, Evas will call
  * #EVAS_CALLBACK_IMAGE_PRELOADED registered callbacks on @p obj (what
@@ -2704,11 +2712,14 @@ EAPI void evas_object_image_mmap_get(const Eo *obj, const Eina_File **f, const c
 /**
  * @brief
  * Save the given image object's contents to an (image) file.
+ * Proxy object is image object, but it doesn't have contents. So you can't use this function for proxy objects.
  *
  * @if MOBILE @since_tizen 2.3
  * @elseif WEARABLE @since_tizen 2.3.1
  * @endif
  *
+ * @ingroup Evas_Object_Image
+ *
  * @remark The extension suffix on @p file will determine which <b>saver
  * module</b> Evas is to use when saving, thus the final file's
  * format. If the file supports multiple data stored in it (Eet ones),
@@ -2718,6 +2729,12 @@ EAPI void evas_object_image_mmap_get(const Eo *obj, const Eina_File **f, const c
  * acceptable flags are @c quality and @c compress. Eg.: @c
  * "quality=100 compress=9"
  *
+ * @remark quality is hint for the quality of image,0-100. 0 means low quality
+ * and saved image size is small. 100 means high quality and saved image size is big.
+ *
+ * @remart compress is hint for the compression modes (Eet ones) or for the compression flags (Png one)
+ * (1 == compress, 0 = don't compress).
+ *
  * @param[in] file The filename to be used to save the image (extension
 obligatory).
  * @param[in] key The image key in the file (if an Eet one), or @c NULL,
@@ -2791,6 +2808,8 @@ EAPI Eina_Bool evas_object_image_animated_get(const Eo *obj);
  * @elseif WEARABLE @since_tizen 2.3.1
  * @endif
  *
+ * @ingroup Evas_Object_Image
+ *
  * @remark This function sets a new geometry size for the given canvas image.
  * The image will be loaded into memory as if it was the set size instead of
  * the original size.
@@ -2798,7 +2817,16 @@ EAPI Eina_Bool evas_object_image_animated_get(const Eo *obj);
  * @remark The size of a given image object's source image will be less than or
  * equal to the size of @p w and @p h.
  *
+ * @remark This function has a similar effect as evas_object_image_load_scale_down_set().
+ * For example, if the image content size is 1920X1080,
+ * you can get the same result with the following two calls:
+ * e.g.,
+ * evas_object_image_load_scale_down_set(obj, 2) or
+ * evas_object_image_load_size_set(obj, 960, 540).
+ * evas_object_image_load_scale_down_set() takes precedence over evas_object_image_load_size_set().
+ *
  * @see evas_object_image_load_size_get()
+ * @see evas_object_image_load_scale_down_set()
  *
  * @param[in] w The new width of the image's load size.
  * @param[in] h The new height of the image's load size.
index b58fece..9028f6d 100644 (file)
@@ -775,9 +775,15 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image)
             @ingroup Evas_Object_Image
 
             @remark This function sets the scale down factor of a given canvas
-            image. Most useful for the SVG image loader.
-
-            @see evas_object_image_load_scale_down_get() */
+            image. If you're loading images which are too big, consider setting
+            previously it's loading size to something smaller, in case you
+            won't expose them in real size. It may speed up the loading considerably.
+            Scale down factor can be set to several values.
+            For example, image's content size is 1920X1080, the scale factor is set to 2, loading size is 960X540.
+            Most useful for the SVG image loader, but BMP, JPG, PNG image loader also work.
+
+            @see evas_object_image_load_scale_down_get()
+            @see evas_object_image_load_size_set() */
          }
          get {
             /*@
index 42f82a4..5148d6b 100644 (file)
@@ -1146,6 +1146,7 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx.Base)
             @p prop is @c EINA_FALSE, events occurring on this object will @b
             not be propagated on to the smart object of which @p obj is a
             member.  The default value is @c EINA_TRUE.
+            All events are propagated from the child to parent between the smart members.
 
             @see evas_object_propagate_events_get()
             @see evas_object_repeat_events_set()
index ee6d21c..1c72c74 100644 (file)
@@ -350,11 +350,11 @@ _ecore_buffer_x11_dri2_buffer_alloc(Ecore_Buffer_Module_Data bmdata, int width,
    info.height =  height;
    info.format = format;
    info.bpp = bpp;
-   info.size = width * bufs->pitch;
+   info.size = height * bufs->pitch;
    info.num_planes = num_plane;
    for ( i = 0 ; i < num_plane ; i++)
    {
-      info.planes[i].size = width * bufs->pitch;
+      info.planes[i].size = height * bufs->pitch;
       info.planes[i].stride = bufs->pitch;
       info.planes[i].offset = 0;
    }
@@ -405,6 +405,41 @@ _ecore_buffer_x11_dri2_buffer_alloc_with_tbm_surface(Ecore_Buffer_Module_Data bm
    return buf;
 }
 
+static Eina_Bool
+_ecore_buffer_x11_dri2_buffer_info_get(Ecore_Buffer_Module_Data bmdata EINA_UNUSED, Ecore_Buffer_Data bdata, Ecore_Buffer_Info *info)
+{
+   Ecore_Buffer_X11_Dri2_Data *buf = bdata;
+   tbm_surface_info_s tinfo;
+   int i, res;
+
+   if (!buf->tbm.surface)
+     return EINA_FALSE;
+
+   res = tbm_surface_get_info(buf->tbm.surface, &tinfo);
+   if (res != TBM_SURFACE_ERROR_NONE)
+     return EINA_FALSE;
+
+   if (info)
+     {
+        info->width = tinfo.width;
+        info->height = tinfo.height;
+        info->format = tinfo.format;
+        info->bpp = tinfo.bpp;
+        info->size = tinfo.size;
+        info->num_planes = tinfo.num_planes;
+        info->pixmap = buf->pixmap;
+
+        for (i = 0; i < tinfo.num_planes; i++)
+          {
+             info->planes[i].size = tinfo.planes[i].size;
+             info->planes[i].offset = tinfo.planes[i].offset;
+             info->planes[i].stride = tinfo.planes[i].stride;
+          }
+     }
+
+   return EINA_TRUE;
+}
+
 static void
 _ecore_buffer_x11_dri2_buffer_free(Ecore_Buffer_Module_Data bmdata EINA_UNUSED, Ecore_Buffer_Data bdata)
 {
@@ -430,86 +465,118 @@ static Ecore_Export_Type
 _ecore_buffer_x11_dri2_buffer_export(Ecore_Buffer_Module_Data bmdata EINA_UNUSED, Ecore_Buffer_Data bdata, int *id)
 {
    Ecore_Buffer_X11_Dri2_Data *buf = bdata;
+   tbm_bo bo;
 
-   if (id) *id = buf->pixmap;
+   if (id)
+     {
+        if (buf->pixmap)
+          *id = buf->pixmap;
+        else
+          {
+             tbm_bo bo;
+             /* NOTE: constraints - cannot support more than two bos */
+             bo = tbm_surface_internal_get_bo(buf->tbm.surface, 0);
+             *id = (int)(tbm_bo_export(bo));
+          }
+     }
 
    return EXPORT_TYPE_ID;
 }
 
-static void *
-_ecore_buffer_x11_dri2_buffer_import(Ecore_Buffer_Module_Data bmdata EINA_UNUSED, int w, int h, Ecore_Buffer_Format format, Ecore_Export_Type type, int export_id, unsigned int flags EINA_UNUSED)
+static tbm_bo
+_x11_dri2_bo_get_from_pixmap(tbm_bufmgr tbm_mgr, Ecore_Pixmap pixmap, int width, int height)
 {
-   Ecore_Buffer_Module_X11_Dri2_Data *bm = bmdata;
    Ecore_X_Display *xdpy;
-   Ecore_X_Pixmap pixmap = (Ecore_X_Pixmap)export_id;
-   Ecore_Buffer_X11_Dri2_Data *buf;
-   int rw, rh, rx, ry;
    DRI2Buffer *bufs = NULL;
    tbm_bo bo = NULL;
+   int rw, rh, rx, ry;
    int rcount;
    unsigned int attachment = DRI2BufferFrontLeft;
-   tbm_surface_info_s info;
-   int i;
 
-   if (type != EXPORT_TYPE_ID)
+   // Check valid pixmap
+   ecore_x_pixmap_geometry_get(pixmap, &rx, &ry, &rw, &rh);
+   if ((rw != width) || (rh != height))
      return NULL;
 
    xdpy = ecore_x_display_get();
+   DRI2CreateDrawable(xdpy, pixmap);
+   bufs = DRI2GetBuffers(xdpy, pixmap, &rw, &rh, &attachment, 1, &rcount);
+   if ((!bufs) || (width != rw) || (height != rh))
+     goto err;
 
-   //Check valid pixmap
-   ecore_x_pixmap_geometry_get(pixmap, &rx, &ry, &rw, &rh);
-   if ((rw != w) || (rh != h))
-     return NULL;
+   bo = tbm_bo_import(tbm_mgr, bufs->name);
+   free(bufs);
+   if (!bo)
+     goto err;
 
-   buf = calloc(1, sizeof(Ecore_Buffer_X11_Dri2_Data));
-   if (!buf)
-     return NULL;
+   return bo;
+err:
+   DRI2DestroyDrawable(xdpy, pixmap);
+   return NULL;
+}
 
-   buf->w = w;
-   buf->h = h;
-   buf->format = format;
-   buf->pixmap = pixmap;
-   buf->is_imported = EINA_TRUE;
+static void *
+_ecore_buffer_x11_dri2_buffer_import(Ecore_Buffer_Module_Data bmdata, Ecore_Buffer_Info *einfo, Ecore_Export_Type type, int export_id, unsigned int flags EINA_UNUSED)
+{
+   Ecore_Buffer_Module_X11_Dri2_Data *bm = bmdata;
+   Ecore_Buffer_X11_Dri2_Data *buf;
+   tbm_bo bo = NULL;
+   tbm_surface_h surface;
+   tbm_surface_info_s tinfo;
+   int i;
 
-   //Get DRI2Buffer
-   DRI2CreateDrawable(xdpy, buf->pixmap);
-   bufs = DRI2GetBuffers(xdpy, buf->pixmap, &rw, &rh, &attachment, 1, &rcount);
-   if ((!bufs) || (buf->w != rw) || (buf->h != rh))
-     goto on_error;
+   if (type != EXPORT_TYPE_ID)
+     return NULL;
 
-   buf->stride = bufs->pitch;
+   if (!einfo)
+     return NULL;
+
+   if (einfo->pixmap)
+     bo = _x11_dri2_bo_get_from_pixmap(bm->tbm_mgr, einfo->pixmap, einfo->width, einfo->height);
+   else
+     bo = tbm_bo_import(bm->tbm_mgr, export_id);
 
-   //Import tbm_surface
-   bo = tbm_bo_import(bm->tbm_mgr, bufs->name);
    if (!bo)
-     goto on_error;
+     goto err;
+
+   tinfo.width = einfo->width;
+   tinfo.height = einfo->height;
+   tinfo.format = einfo->format;
+   tinfo.bpp = _buf_get_bpp(einfo->format);
+   tinfo.size = einfo->height * einfo->planes[0].stride;
+   tinfo.num_planes = _buf_get_num_planes(einfo->format);
+   for (i = 0; i < tinfo.num_planes; i++)
+     {
+        tinfo.planes[i].size = einfo->height * einfo->planes[i].stride;
+        tinfo.planes[i].stride = einfo->planes[i].stride;
+        tinfo.planes[i].offset = einfo->planes[i].offset;
+     }
 
-   info.width = w;
-   info.height = h;
-   info.format = format;
-   info.bpp = _buf_get_bpp(format);
-   info.size = w * bufs->pitch;
-   info.num_planes = _buf_get_num_planes(format);
-   for ( i = 0 ; i < info.num_planes ; i++)
-   {
-      info.planes[i].size = w * bufs->pitch;
-      info.planes[i].stride = bufs->pitch;
-      info.planes[i].offset = 0;
-   }
+   surface = tbm_surface_internal_create_with_bos(&tinfo, &bo, 1);
+   tbm_bo_unref(bo);
+   if (!surface)
+     goto err;
 
-   buf->tbm.surface = tbm_surface_internal_create_with_bos(&info, &bo, 1);
-   if (!buf->tbm.surface)
-     goto on_error;
+   buf = calloc(1, sizeof(Ecore_Buffer_X11_Dri2_Data));
+   if (!buf)
+     goto err_alloc;
 
+   buf->w = einfo->width;
+   buf->h = einfo->height;
+   buf->format = einfo->format;
+   buf->pixmap = einfo->pixmap;
+   buf->stride = einfo->planes[0].stride;
+   buf->is_imported = EINA_TRUE;
+   buf->tbm.surface = surface;
    buf->tbm.owned = EINA_TRUE;
-   tbm_bo_unref(bo);
-   free(bufs);
 
    return buf;
-on_error:
-   if (bo) tbm_bo_unref(bo);
-   if (bufs) free(bufs);
-   DRI2DestroyDrawable(xdpy, buf->pixmap);
+err_alloc:
+   tbm_surface_internal_unref(surface);
+err:
+   if ((bo) && (einfo->pixmap))
+     DRI2DestroyDrawable(ecore_x_display_get(), einfo->pixmap);
+
    free(buf);
 
    return NULL;
@@ -546,6 +613,7 @@ static Ecore_Buffer_Backend _ecore_buffer_x11_dri2_backend = {
      &_ecore_buffer_x11_dri2_shutdown,
      &_ecore_buffer_x11_dri2_buffer_alloc,
      &_ecore_buffer_x11_dri2_buffer_alloc_with_tbm_surface,
+     &_ecore_buffer_x11_dri2_buffer_info_get,
      &_ecore_buffer_x11_dri2_buffer_free,
      &_ecore_buffer_x11_dri2_buffer_export,
      &_ecore_buffer_x11_dri2_buffer_import,
index f156f86..cfdc2e2 100644 (file)
@@ -43,6 +43,8 @@ struct _Ecore_Buffer_X11_Dri3_Data {
      Eina_Bool is_imported;
 };
 
+static Ecore_Pixmap  _ecore_buffer_x11_dri3_pixmap_get(Ecore_Buffer_Module_Data bmdata, Ecore_Buffer_Data bdata);
+
 static int
 _buf_get_num_planes(Ecore_Buffer_Format format)
 {
@@ -451,6 +453,41 @@ _ecore_buffer_x11_dri3_buffer_alloc_with_tbm_surface(Ecore_Buffer_Module_Data bm
    return buf;
 }
 
+static Eina_Bool
+_ecore_buffer_x11_dri3_buffer_info_get(Ecore_Buffer_Module_Data bmdata, Ecore_Buffer_Data bdata, Ecore_Buffer_Info *info)
+{
+   Ecore_Buffer_X11_Dri3_Data *buf = bdata;
+   tbm_surface_info_s tinfo;
+   int i, res;
+
+   if (!buf->tbm_surface)
+     return EINA_FALSE;
+
+   res = tbm_surface_get_info(buf->tbm_surface, &tinfo);
+   if (res != TBM_SURFACE_ERROR_NONE)
+     return EINA_FALSE;
+
+   if (info)
+     {
+        info->width = tinfo.width;
+        info->height = tinfo.height;
+        info->format = tinfo.format;
+        info->bpp = tinfo.bpp;
+        info->size = tinfo.size;
+        info->num_planes = tinfo.num_planes;
+        info->pixmap = _ecore_buffer_x11_dri3_pixmap_get(bmdata, bdata);
+
+        for (i = 0; i < tinfo.num_planes; i++)
+          {
+             info->planes[i].size = tinfo.planes[i].size;
+             info->planes[i].offset = tinfo.planes[i].offset;
+             info->planes[i].stride = tinfo.planes[i].stride;
+          }
+     }
+
+   return EINA_TRUE;
+}
+
 static void
 _ecore_buffer_x11_dri3_buffer_free(Ecore_Buffer_Module_Data bmdata EINA_UNUSED, Ecore_Buffer_Data bdata)
 {
@@ -487,12 +524,12 @@ _ecore_buffer_x11_dri3_buffer_export(Ecore_Buffer_Module_Data bmdata EINA_UNUSED
 }
 
 static Ecore_Buffer_Data
-_ecore_buffer_x11_dri3_buffer_import(Ecore_Buffer_Module_Data bmdata, int w, int h, Ecore_Buffer_Format format, Ecore_Export_Type type, int export_id, unsigned int flags)
+_ecore_buffer_x11_dri3_buffer_import(Ecore_Buffer_Module_Data bmdata, Ecore_Buffer_Info *einfo, Ecore_Export_Type type, int export_id, unsigned int flags)
 {
    Ecore_Buffer_Module_X11_Dri3_Data *bm = bmdata;
    Ecore_Buffer_X11_Dri3_Data *buf;
    tbm_bo bo;
-   tbm_surface_info_s info;
+   tbm_surface_info_s tinfo;
    int i;
 
    if (!bm)
@@ -508,9 +545,9 @@ _ecore_buffer_x11_dri3_buffer_import(Ecore_Buffer_Module_Data bmdata, int w, int
    if (!buf)
      return NULL;
 
-   buf->w = w;
-   buf->h = h;
-   buf->format = format;
+   buf->w = einfo->width;
+   buf->h = einfo->height;
+   buf->format = einfo->format;
    buf->flags = flags;
    buf->is_imported = EINA_TRUE;
 
@@ -522,20 +559,20 @@ _ecore_buffer_x11_dri3_buffer_import(Ecore_Buffer_Module_Data bmdata, int w, int
         return NULL;
      }
 
-   info.width = w;
-   info.height = h;
-   info.format = format;
-   info.bpp = _buf_get_bpp(format);
-   info.size = w * h * info.bpp;
-   info.num_planes = _buf_get_num_planes(format);
-   for ( i = 0 ; i < info.num_planes ; i++)
+   tinfo.width = buf->w = einfo->width;
+   tinfo.height = buf->h = einfo->height;
+   tinfo.format = buf->format = einfo->format;
+   tinfo.bpp = _buf_get_bpp(einfo->format);
+   tinfo.size = einfo->height * einfo->planes[0].stride;
+   tinfo.num_planes = _buf_get_num_planes(einfo->format);
+   for (i = 0; i < tinfo.num_planes; i++)
    {
-      info.planes[i].size = w * h * info.bpp;
-      info.planes[i].stride = w * info.bpp;
-      info.planes[i].offset = 0;
+      tinfo.planes[i].size = einfo->height * einfo->planes[i].stride;
+      tinfo.planes[i].stride = einfo->planes[i].stride;
+      tinfo.planes[i].offset = einfo->planes[i].offset;
    }
 
-   buf->tbm_surface = tbm_surface_internal_create_with_bos(&info, &bo, 1);
+   buf->tbm_surface = tbm_surface_internal_create_with_bos(&tinfo, &bo, 1);
    if (!buf->tbm_surface)
      {
         tbm_bo_unref(bo);
@@ -605,6 +642,7 @@ static Ecore_Buffer_Backend _ecore_buffer_x11_dri3_backend = {
      &_ecore_buffer_x11_dri3_shutdown,
      &_ecore_buffer_x11_dri3_buffer_alloc,
      &_ecore_buffer_x11_dri3_buffer_alloc_with_tbm_surface,
+     &_ecore_buffer_x11_dri3_buffer_info_get,
      &_ecore_buffer_x11_dri3_buffer_free,
      &_ecore_buffer_x11_dri3_buffer_export,
      &_ecore_buffer_x11_dri3_buffer_import,