Fix build errors 70/39170/1 submit/tizen_mobile/20150511.123737 submit/tizen_mobile/20150512.034918
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 11 May 2015 07:16:17 +0000 (16:16 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 11 May 2015 07:16:17 +0000 (16:16 +0900)
Wayland porting layer should be implemented.

[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: Ibdf56bb76f8db9287c7d61db0c5ca43d7c97b545

packaging/libwidget_provider.spec
widget_provider/src/fb_wayland.c
widget_provider_app/src/util_wayland.c

index 7dc6fec..32ecb04 100644 (file)
@@ -4,7 +4,7 @@ Name: libwidget_provider
 Summary: Library for developing the widget service provider
 Version: 1.1.3
 Release: 1
-Group: HomeTF/widget
+Group: Applications/Core Applications
 License: Flora License, Version 1.1
 Source0: %{name}-%{version}.tar.gz
 Source1001: %{name}.manifest
@@ -19,7 +19,6 @@ BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(eina)
 BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: model-build-features
 
 %if %{with wayland}
 %else
@@ -39,12 +38,12 @@ API for accessing the remote buffer of widgetes.
 Feature for life-cycle management by the master provider.
 
 %package devel
-Summary: widget data provider development library (dev)
+Summary: Header & package configuration files
 Group: Development/Libraries
 Requires: %{name} = %{version}-%{release}
 
 %description devel
-Header & package configuration files for developing the widget service provider
+Widget data provider development library (dev)
 
 %prep
 %setup -q
@@ -100,20 +99,22 @@ mkdir -p %{buildroot}/%{_datarootdir}/license
 # libwidget_provider_app
 %package -n %{name}_app
 Summary: Library for developing the widget app provider
-Group: HomeTF/widget
-License: Flora
-Requires: libwidget_provider
+Group: Applications/Core Applications
+License: Flora License, Version 1.1
 
 %description -n %{name}_app
 Provider APIs to develop the widget provider applications.
 
 %package -n %{name}_app-devel
-Summary: Header & package configuration files to support development of the widget provider applications.
+Summary: Widget provider application development library (dev)
 Group: Development/Libraries
 Requires: %{name}_app
 
 %description -n %{name}_app-devel
-widget provider application development library (dev)
+Header & package configuration files to support development of the widget provider applications.
+
+%post -n %{name}_app -p /sbin/ldconfig
+%postun -n %{name}_app -p /sbin/ldconfig
 
 %files -n %{name}_app
 %manifest %{name}.manifest
index 054cd9a..0e38358 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <dlog.h>
 #include <widget_errno.h>
+#include <widget_service.h>
 #include <widget_buffer.h>
 #include <widget_util.h>
 
 
 int errno;
 
-struct fb_info {
-       char *id;
-       int w;
-       int h;
-       int bufsz;
-       void *buffer;
-
-       int pixels;
-       int handle;
+static struct info {
+       int master_disconnected;
+} s_info = {
+       .master_disconnected = 0,
 };
 
 int fb_init(void *disp)
 {
+       s_info.master_disconnected = 0;
        return WIDGET_ERROR_NONE;
 }
 
@@ -66,7 +63,8 @@ int fb_fini(void)
 static inline int sync_for_file(struct fb_info *info)
 {
        int fd;
-       widget_fb_t *buffer;
+       widget_fb_t buffer;
+       const char *path;
 
        buffer = info->buffer;
        if (!buffer) {
@@ -74,19 +72,25 @@ static inline int sync_for_file(struct fb_info *info)
                return WIDGET_ERROR_NONE;
        }
 
-       if (buffer->state != CREATED) {
+       if (buffer->state != WIDGET_FB_STATE_CREATED) {
                ErrPrint("Invalid state of a FB\n");
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
-       if (buffer->type != BUFFER_TYPE_FILE) {
+       if (buffer->type != WIDGET_FB_TYPE_FILE) {
                DbgPrint("Ingore sync\n");
                return WIDGET_ERROR_NONE;
        }
 
-       fd = open(widget_util_uri_to_path(info->id), O_WRONLY | O_CREAT, 0644);
+       path = widget_util_uri_to_path(info->id);
+       if (!path) {
+               ErrPrint("Invalid id: %s\n", info->id);
+               return WIDGET_ERROR_INVALID_PARAMETER;
+       }
+
+       fd = open(path, O_WRONLY | O_CREAT, 0644);
        if (fd < 0) {
-               ErrPrint("open %s: %d\n", widget_util_uri_to_path(info->id), errno);
+               ErrPrint("open %s: %d\n", path, errno);
                return WIDGET_ERROR_IO_ERROR;
        }
 
@@ -104,6 +108,11 @@ static inline int sync_for_file(struct fb_info *info)
        return WIDGET_ERROR_NONE;
 }
 
+static inline int sync_for_pixmap(struct fb_info *info)
+{
+       return WIDGET_ERROR_NONE;
+}
+
 int fb_sync(struct fb_info *info)
 {
        if (!info) {
@@ -119,6 +128,7 @@ int fb_sync(struct fb_info *info)
        if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
                return sync_for_file(info);
        } else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+               return sync_for_pixmap(info);
        } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
                return WIDGET_ERROR_NONE;
        }
@@ -154,10 +164,7 @@ struct fb_info *fb_create(const char *id, int w, int h)
        if (sscanf(info->id, SCHEMA_SHM "%d", &info->handle) == 1) {
                DbgPrint("SHMID: %d\n", info->handle);
        } else if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &info->handle, &info->pixels) == 2) {
-               ErrPrint("Unsupported type\n");
-               free(info->id);
-               free(info);
-               return NULL;
+               DbgPrint("PIXMAP: %d\n", info->handle);
        } else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
                info->handle = -1;
        } else {
@@ -173,6 +180,31 @@ struct fb_info *fb_create(const char *id, int w, int h)
        return info;
 }
 
+int fb_has_gem(struct fb_info *info)
+{
+       return 0;
+}
+
+int fb_create_gem(struct fb_info *info, int auto_align)
+{
+       return WIDGET_ERROR_NOT_SUPPORTED;
+}
+
+int fb_destroy_gem(struct fb_info *info)
+{
+       return WIDGET_ERROR_NONE;
+}
+
+void *fb_acquire_gem(struct fb_info *info)
+{
+       return NULL;
+}
+
+int fb_release_gem(struct fb_info *info)
+{
+       return WIDGET_ERROR_NONE;
+}
+
 int fb_destroy(struct fb_info *info)
 {
        if (!info) {
@@ -181,7 +213,7 @@ int fb_destroy(struct fb_info *info)
        }
 
        if (info->buffer) {
-               widget_fb_t *buffer;
+               widget_fb_t buffer;
                buffer = info->buffer;
                buffer->info = NULL;
        }
@@ -199,9 +231,7 @@ int fb_is_created(struct fb_info *info)
        }
 
        if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)) && info->handle != 0) {
-               /* Dead Code */
-               ErrPrint("Invalid FB is created\n");
-               return 0;
+               return 1;
        } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM)) && info->handle > 0) {
                return 1;
        } else {
@@ -219,8 +249,7 @@ int fb_is_created(struct fb_info *info)
 
 void *fb_acquire_buffer(struct fb_info *info)
 {
-       struct pixmap_info *pixmap_info;
-       widget_fb_t *buffer;
+       widget_fb_t buffer;
        void *addr;
 
        if (!info) {
@@ -229,10 +258,6 @@ void *fb_acquire_buffer(struct fb_info *info)
 
        if (!info->buffer) {
                if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
-                       /*!
-                        * Use the S/W backend
-                        */
-                       ErrPrint("Unsupported type\n");
                        return NULL;
                } else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
                        info->bufsz = info->w * info->h * info->pixels;
@@ -243,9 +268,9 @@ void *fb_acquire_buffer(struct fb_info *info)
                                return NULL;
                        }
 
-                       buffer->type = BUFFER_TYPE_FILE;
+                       buffer->type = WIDGET_FB_TYPE_FILE;
                        buffer->refcnt = 0;
-                       buffer->state = CREATED;
+                       buffer->state = WIDGET_FB_STATE_CREATED;
                        buffer->info = info;
                        info->buffer = buffer;
                } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
@@ -264,13 +289,15 @@ void *fb_acquire_buffer(struct fb_info *info)
 
        buffer = info->buffer;
        switch (buffer->type) {
-       case BUFFER_TYPE_FILE:
+       case WIDGET_FB_TYPE_PIXMAP:
+               addr = NULL;
+               break;
+       case WIDGET_FB_TYPE_FILE:
                buffer->refcnt++;
                /* Fall through */
-       case BUFFER_TYPE_SHM:
+       case WIDGET_FB_TYPE_SHM:
                addr = buffer->data;
                break;
-       case BUFFER_TYPE_PIXMAP:
        default:
                addr = NULL;
                break;
@@ -281,8 +308,7 @@ void *fb_acquire_buffer(struct fb_info *info)
 
 int fb_release_buffer(void *data)
 {
-       widget_fb_t *buffer;
-       struct fb_info *info;
+       widget_fb_t buffer;
 
        if (!data) {
                return WIDGET_ERROR_NONE;
@@ -290,13 +316,13 @@ int fb_release_buffer(void *data)
 
        buffer = container_of(data, struct widget_fb, data);
 
-       if (buffer->state != CREATED) {
+       if (buffer->state != WIDGET_FB_STATE_CREATED) {
                ErrPrint("Invalid handle\n");
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
        switch (buffer->type) {
-       case BUFFER_TYPE_SHM:
+       case WIDGET_FB_TYPE_SHM:
                /*!
                 * \note
                 * SHM can not use the "info"
@@ -306,21 +332,20 @@ int fb_release_buffer(void *data)
                        ErrPrint("shmdt: %d\n", errno);
                }
                break;
-       case BUFFER_TYPE_FILE:
+       case WIDGET_FB_TYPE_PIXMAP:
+               break;
+       case WIDGET_FB_TYPE_FILE:
                buffer->refcnt--;
                if (buffer->refcnt == 0) {
                        struct fb_info *info;
                        info = buffer->info;
-
-                       buffer->state = DESTROYED;
-                       free(buffer);
-
                        if (info && info->buffer == buffer) {
                                info->buffer = NULL;
                        }
+                       buffer->state = WIDGET_FB_STATE_DESTROYED;
+                       free(buffer);
                }
                break;
-       case BUFFER_TYPE_PIXMAP:
        default:
                ErrPrint("Unknown type\n");
                return WIDGET_ERROR_INVALID_PARAMETER;
@@ -334,22 +359,23 @@ int fb_type(struct fb_info *info)
        widget_fb_t buffer;
 
        if (!info) {
-               return BUFFER_TYPE_ERROR;
+               return WIDGET_FB_TYPE_ERROR;
        }
 
        buffer = info->buffer;
        if (!buffer) {
-               int type = BUFFER_TYPE_ERROR;
+               int type = WIDGET_FB_TYPE_ERROR;
                /*!
                 * \note
                 * Try to get this from SCHEMA
                 */
                if (info->id) {
                        if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
-                               type = BUFFER_TYPE_FILE;
+                               type = WIDGET_FB_TYPE_FILE;
                        } else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+                               type = WIDGET_FB_TYPE_PIXMAP;
                        } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
-                               type = BUFFER_TYPE_SHM;
+                               type = WIDGET_FB_TYPE_SHM;
                        }
                }
 
@@ -371,13 +397,13 @@ int fb_refcnt(void *data)
 
        buffer = container_of(data, struct widget_fb, data);
 
-       if (buffer->state != CREATED) {
+       if (buffer->state != WIDGET_FB_STATE_CREATED) {
                ErrPrint("Invalid handle\n");
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
        switch (buffer->type) {
-       case BUFFER_TYPE_SHM:
+       case WIDGET_FB_TYPE_SHM:
                if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
                        ErrPrint("shmctl: %d\n", errno);
                        ret = WIDGET_ERROR_FAULT;
@@ -386,10 +412,12 @@ int fb_refcnt(void *data)
 
                ret = buf.shm_nattch; /*!< This means attached count of process */
                break;
-       case BUFFER_TYPE_FILE:
+       case WIDGET_FB_TYPE_PIXMAP:
+               ret = buffer->refcnt;
+               break;
+       case WIDGET_FB_TYPE_FILE:
                ret = buffer->refcnt;
                break;
-       case BUFFER_TYPE_PIXMAP:
        default:
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                break;
@@ -431,4 +459,19 @@ int fb_sync_xdamage(struct fb_info *info, widget_damage_region_s *region)
        return WIDGET_ERROR_NONE;
 }
 
+int fb_stride(struct fb_info *info)
+{
+       int stride;
+
+       stride = info->w * info->pixels;
+       DbgPrint("Stride: %d\n", stride);
+
+       return stride;
+}
+
+void fb_master_disconnected(void)
+{
+       s_info.master_disconnected = 1;
+}
+
 /* End of a file */
index 38ef8cd..b144217 100644 (file)
  */
 
 #include <stdio.h>
+#include <Eina.h> /* for util.h */
 
-#include <widget-service.h>
+#include <widget_errno.h>
+#include <widget_service.h>
 
 #include "util.h"