Split source tree into separate libraries
authorTaekyun Kim <tkq.kim@samsung.com>
Mon, 1 Jun 2015 08:50:36 +0000 (17:50 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Fri, 19 Jun 2015 09:06:41 +0000 (18:06 +0900)
Now the repository contains several packages. Each package is a separate
library or a bin program. Followings are brief descriptions of directories.

===============================================================================
pepper       |  Pepper core library package.
-------------------------------------------------------------------------------
render        |  Rendering library (pixman, OpenGL)
-------------------------------------------------------------------------------
desktop-shell |  Desktop shell library
-------------------------------------------------------------------------------
drm           |  DRM output backend library
-------------------------------------------------------------------------------
libinput      |  Libinput input backend library
-------------------------------------------------------------------------------
wayland       |  Wayland output/input backend library
-------------------------------------------------------------------------------
x11           |  X11 output/input backend library
-------------------------------------------------------------------------------
utils         |  Utility library
-------------------------------------------------------------------------------
samples       |  Sample programs for testing pepper libraries
-------------------------------------------------------------------------------
doctor        |  Reference server using pepper libraries
===============================================================================

Renderer is no longer a core object, instead, output libraries can freely use
it by linking against separate libpepper-render.

pepper_output_schedule_repaint() is now exposed as an API.

Put utility functions on the pepper-utils package.

Need a build script which takes options for enabling or disabling each library.

Change-Id: I5c686d158ea61056cd517f29c4eda4b2d4c7877a

117 files changed:
.gitignore
Makefile.am [deleted file]
configure.ac [deleted file]
desktop-shell/Makefile.am [new file with mode: 0644]
desktop-shell/autogen.sh [moved from autogen.sh with 100% similarity]
desktop-shell/configure.ac [new file with mode: 0644]
desktop-shell/src/Makefile.am [new file with mode: 0644]
desktop-shell/src/desktop-shell-internal.h [moved from src/modules/desktop-shell/desktop-shell-internal.h with 97% similarity]
desktop-shell/src/pepper-desktop-shell.h [moved from src/modules/desktop-shell/pepper-desktop-shell.h with 100% similarity]
desktop-shell/src/pepper-desktop-shell.pc.in [new file with mode: 0644]
desktop-shell/src/shell-surface.c [moved from src/modules/desktop-shell/shell-surface.c with 97% similarity]
desktop-shell/src/shell.c [moved from src/modules/desktop-shell/shell.c with 93% similarity]
desktop-shell/src/wl-shell.c [moved from src/modules/desktop-shell/wl-shell.c with 100% similarity]
doctor/Makefile.am [new file with mode: 0644]
doctor/autogen.sh [new file with mode: 0755]
doctor/configure.ac [new file with mode: 0644]
doctor/src/Makefile.am [new file with mode: 0644]
doctor/src/server.c [moved from src/server/server.c with 93% similarity]
drm/Makefile.am [new file with mode: 0644]
drm/autogen.sh [new file with mode: 0755]
drm/configure.ac [new file with mode: 0644]
drm/src/Makefile.am [new file with mode: 0644]
drm/src/drm-common.c [moved from src/modules/drm/drm-common.c with 92% similarity]
drm/src/drm-internal.h [moved from src/modules/drm/drm-internal.h with 96% similarity]
drm/src/drm-output.c [moved from src/modules/drm/drm-output.c with 96% similarity]
drm/src/pepper-drm.h [moved from src/modules/drm/pepper-drm.h with 100% similarity]
drm/src/pepper-drm.pc.in [new file with mode: 0644]
libinput/Makefile.am [new file with mode: 0644]
libinput/autogen.sh [new file with mode: 0755]
libinput/configure.ac [new file with mode: 0644]
libinput/src/Makefile.am [new file with mode: 0644]
libinput/src/libinput-internal.h [moved from src/modules/libinput/libinput-internal.h with 95% similarity]
libinput/src/libinput.c [moved from src/modules/libinput/libinput.c with 98% similarity]
libinput/src/pepper-libinput.h [moved from src/modules/libinput/pepper-libinput.h with 100% similarity]
libinput/src/pepper-libinput.pc.in [new file with mode: 0644]
pepper/AUTHORS [moved from AUTHORS with 100% similarity]
pepper/CODING_STYLE [moved from CODING_STYLE with 100% similarity]
pepper/COPYING [moved from COPYING with 100% similarity]
pepper/Makefile.am [new file with mode: 0644]
pepper/README [moved from README with 100% similarity]
pepper/autogen.sh [new file with mode: 0755]
pepper/configure.ac [new file with mode: 0644]
pepper/packaging/pepper.spec [moved from packaging/pepper.spec with 72% similarity]
pepper/src/Makefile.am [new file with mode: 0644]
pepper/src/buffer.c [moved from src/buffer.c with 100% similarity]
pepper/src/common.c [moved from src/common.c with 100% similarity]
pepper/src/common.h [moved from src/common.h with 100% similarity]
pepper/src/compositor.c [moved from src/compositor.c with 100% similarity]
pepper/src/data-device.c [moved from src/data-device.c with 100% similarity]
pepper/src/input.c [moved from src/input.c with 100% similarity]
pepper/src/layer.c [moved from src/layer.c with 100% similarity]
pepper/src/output.c [moved from src/output.c with 99% similarity]
pepper/src/pepper-internal.h [moved from src/pepper-internal.h with 99% similarity]
pepper/src/pepper-util.c [moved from src/pepper-util.c with 100% similarity]
pepper/src/pepper-util.h [moved from src/pepper-util.h with 100% similarity]
pepper/src/pepper.h [moved from src/pepper.h with 93% similarity]
pepper/src/pepper.pc.in [new file with mode: 0644]
pepper/src/region.c [moved from src/region.c with 100% similarity]
pepper/src/surface.c [moved from src/surface.c with 100% similarity]
pepper/src/view.c [moved from src/view.c with 100% similarity]
render/Makefile.am [new file with mode: 0644]
render/autogen.sh [new file with mode: 0755]
render/configure.ac [new file with mode: 0644]
render/src/Makefile.am [new file with mode: 0644]
render/src/eglextwayland.h [moved from src/eglextwayland.h with 100% similarity]
render/src/gl-renderer.c [moved from src/gl-renderer.c with 81% similarity]
render/src/pepper-gl-renderer.h [moved from src/pepper-gl-renderer.h with 79% similarity]
render/src/pepper-pixman-renderer.h [new file with mode: 0644]
render/src/pepper-render-internal.h [new file with mode: 0644]
render/src/pepper-render.h [new file with mode: 0644]
render/src/pepper-render.pc.in [new file with mode: 0644]
render/src/pixman-renderer.c [moved from src/pixman-renderer.c with 74% similarity]
render/src/renderer.c [new file with mode: 0644]
samples/Makefile.am [new file with mode: 0644]
samples/autogen.sh [new file with mode: 0755]
samples/configure.ac [new file with mode: 0644]
samples/src/Makefile.am [new file with mode: 0644]
samples/src/drm-backend.c [moved from test/drm-backend.c with 91% similarity]
samples/src/simple-shm.c [moved from test/simple-shm.c with 99% similarity]
samples/src/simple-touch.c [moved from test/simple-touch.c with 99% similarity]
samples/src/wayland-backend.c [moved from test/wayland-backend.c with 94% similarity]
samples/src/x11-backend.c [moved from test/x11-backend.c with 95% similarity]
shared/Makefile.am [deleted file]
src/Makefile.am [deleted file]
src/client.c [deleted file]
src/pepper-pixman-renderer.h [deleted file]
src/renderer.c [deleted file]
test/Makefile.am [deleted file]
utils/Makefile.am [new file with mode: 0644]
utils/autogen.sh [new file with mode: 0755]
utils/configure.ac [new file with mode: 0644]
utils/src/Makefile.am [new file with mode: 0644]
utils/src/pepper-utils.h [moved from shared/pepper-os-compat.h with 93% similarity]
utils/src/pepper-utils.pc.in [new file with mode: 0644]
utils/src/shm.c [moved from shared/pepper-os-compat.c with 97% similarity]
wayland/Makefile.am [new file with mode: 0644]
wayland/autogen.sh [new file with mode: 0755]
wayland/configure.ac [new file with mode: 0644]
wayland/src/Makefile.am [new file with mode: 0644]
wayland/src/pepper-wayland.h [moved from src/modules/wayland/pepper-wayland.h with 100% similarity]
wayland/src/pepper-wayland.pc.in [new file with mode: 0644]
wayland/src/wayland-common.c [moved from src/modules/wayland/wayland-common.c with 84% similarity]
wayland/src/wayland-input.c [moved from src/modules/wayland/wayland-input.c with 96% similarity]
wayland/src/wayland-internal.h [moved from src/modules/wayland/wayland-internal.h with 92% similarity]
wayland/src/wayland-output.c [moved from src/modules/wayland/wayland-output.c with 94% similarity]
wayland/src/wayland-shm-buffer.c [moved from src/modules/wayland/wayland-shm-buffer.c with 59% similarity]
x11/Makefile.am [new file with mode: 0644]
x11/autogen.sh [new file with mode: 0755]
x11/configure.ac [new file with mode: 0644]
x11/src/Makefile.am [new file with mode: 0644]
x11/src/pepper-x11.h [moved from src/modules/x11/pepper-x11.h with 100% similarity]
x11/src/pepper-x11.pc.in [new file with mode: 0644]
x11/src/x11-common.c [moved from src/modules/x11/x11-common.c with 96% similarity]
x11/src/x11-cursor.c [moved from src/modules/x11/x11-cursor.c with 97% similarity]
x11/src/x11-input.c [moved from src/modules/x11/x11-input.c with 99% similarity]
x11/src/x11-internal.h [moved from src/modules/x11/x11-internal.h with 97% similarity]
x11/src/x11-output.c [moved from src/modules/x11/x11-output.c with 97% similarity]

index fcd954a..5882efe 100644 (file)
@@ -6,6 +6,7 @@
 *.so
 *.pc
 *.in
+!*.pc.in
 aclocal.m4
 autom4te.cache/
 config.guess
@@ -22,11 +23,16 @@ install-sh
 libtool
 ltmain.sh
 missing
-src/.deps/
-src/.libs/
+.deps/
+.libs/
 Makefile
 stamp-h1
 
-pepper
+doctor
+drm-backend
+wayland-backend
+x11-backend
+simple-touch
+simple-shm
 
 .vim.custom
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644 (file)
index b17d8d2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = shared src test
diff --git a/configure.ac b/configure.ac
deleted file mode 100644 (file)
index 87bb14a..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-#                                               -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-m4_define([pepper_major], 0)
-m4_define([pepper_minor], 0)
-m4_define([pepper_micro], 0)
-
-m4_define([pepper_version], [pepper_major.pepper_minor.pepper_micro])
-
-AC_PREREQ([2.64])
-AC_INIT([pepper], [pepper_version], [tkq.kim@samsung.com])
-AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
-AM_SILENT_RULES([yes])
-
-# Checks for programs.
-AC_PROG_CC
-
-# libtool
-LT_PREREQ([2.2])
-LT_INIT([disable-static])
-
-# Pepper build requirements
-LIB_PEPPER_MODULES="wayland-server >= 1.6.00 pixman-1 >= 0.25.2"
-
-# Check pepper modules
-PKG_CHECK_MODULES(LIB_PEPPER, [$LIB_PEPPER_MODULES])
-
-# gl renderer
-AC_ARG_ENABLE(gl-renderer,
-              AC_HELP_STRING([--enable-gl-renderer], [enable OpenGL renderer]),
-              [enable_gl_renderer=$enableval], [enable_gl_renderer=yes])
-
-AM_CONDITIONAL(ENABLE_GL_RENDERER, test $enable_gl_renderer = yes)
-
-if test $enable_gl_renderer = yes; then
-    AC_DEFINE(ENABLE_GL_RENDERER, 1, [Enable OpenGL renderer])
-    PKG_CHECK_MODULES(GL_RENDERER, [egl glesv2])
-fi
-
-# wayland backend
-AC_ARG_ENABLE(wayland-backend,
-              AC_HELP_STRING([--enable-wayland-backend], [enable wayland backend]),
-              [enable_wayland_backend=$enableval], [enable_wayland_backend=yes])
-
-AM_CONDITIONAL(ENABLE_WAYLAND_BACKEND, test $enable_wayland_backend = yes)
-
-if test $enable_wayland_backend = yes; then
-    AC_DEFINE(ENABLE_WAYLAND_BACKEND, 1, [Enable wayland backend])
-    PKG_CHECK_MODULES(WAYLAND_BACKEND, [wayland-client >= 1.6.00])
-fi
-
-AC_ARG_ENABLE(wayland-backend-egl,
-              AC_HELP_STRING([--enable-wayland-backend-egl], [enable wayland backend EGL support]),
-              [if test $enableval = yes && test $enable_wayland_backend = yes; then
-                enable_wayland_backend_egl=yes
-               else
-                enable_wayland_backend_egl=no
-               fi],
-              [enable_wayland_backend_egl=no])
-
-AM_CONDITIONAL(ENABLE_WAYLAND_BACKEND_EGL, test $enable_wayland_backend_egl = yes)
-
-if test $enable_wayland_backend_egl = yes; then
-    AC_DEFINE(ENABLE_WAYLAND_BACKEND_EGL, 1, [Enable wayland backend EGL support])
-    PKG_CHECK_MODULES(WAYLAND_BACKEND, [wayland-egl])
-fi
-
-# drm backend
-AC_ARG_ENABLE(drm-backend,
-              AC_HELP_STRING([--enable-drm-backend], [enable drm backend]),
-              [enable_drm_backend=$enableval], [enable_drm_backend=yes])
-
-AM_CONDITIONAL(ENABLE_DRM_BACKEND, test $enable_drm_backend = yes)
-
-if test $enable_drm_backend = yes; then
-    AC_DEFINE(ENABLE_DRM_BACKEND, 1, [Enable drm backend])
-fi
-
-# use libinput module
-AC_ARG_ENABLE(libinput,
-              AC_HELP_STRING([--enable-libinput], [enable libinput module]),
-              [enable_libinput=yes], [enable_libinput=yes])
-
-AM_CONDITIONAL(ENABLE_LIBINPUT, test $enable_libinput = yes)
-
-if test $enable_libinput = yes; then
-    AC_DEFINE(ENABLE_LIBINPUT, 1, [Enable libinput module])
-    PKG_CHECK_MODULES(LIBINPUT, [libinput >= 0.6.0])
-fi
-
-# x11 backend
-AC_ARG_ENABLE(x11-backend,
-              AC_HELP_STRING([--enable-x11-backend], [enable x11 backend]),
-              [enable_x11_backend=$enableval], [enable_x11_backend=yes])
-#              [enable_x11_backend=$enableval], [enable_x11_backend=no])
-
-AM_CONDITIONAL(ENABLE_X11_BACKEND, test $enable_x11_backend = yes)
-
-if test $enable_x11_backend = yes; then
-    AC_DEFINE(ENABLE_X11_BACKEND, 1, [Enable x11 backend])
-    PKG_CHECK_MODULES(X11_BACKEND, [x11 xcb-shm x11-xcb])
-fi
-
-# desktop-shell module
-AC_ARG_ENABLE(desktop-shell,
-              AC_HELP_STRING([--enable-desktop-shell], [enable desktop shell]),
-              [enable_desktop_shell=$enableval], [enable_desktop_shell=yes])
-
-AM_CONDITIONAL(ENABLE_DESKTOP_SHELL, test $enable_desktop_shell = yes)
-
-if test $enable_desktop_shell = yes; then
-    AC_DEFINE(ENABLE_DESKTOP_SHELL, 1, [Enable desktop shell])
-    PKG_CHECK_MODULES(DESKTOP_SHELL, [wayland-server])
-fi
-
-# pepper server
-AC_ARG_ENABLE(pepper-server,
-              AC_HELP_STRING([--enable-pepper-server], [build pepper reference server]),
-              [enable_pepper_server=$enableval], [enable_pepper_server=yes])
-
-AM_CONDITIONAL(ENABLE_PEPPER_SERVER, test $enable_pepper_server = yes)
-
-if test $enable_pepper_server = yes; then
-    AC_DEFINE(ENABLE_PEPPER_SERVER, 1, [Build pepper reference server])
-    PKG_CHECK_MODULES(PEPPER_SERVER, [wayland-server >= 1.6.00])
-fi
-
-# test programs
-TEST_PROGRAM_MODULES="wayland-client wayland-server"
-
-PKG_CHECK_MODULES(TEST_PROGRAM, [$TEST_PROGRAM_MODULES])
-
-# Output files
-AC_CONFIG_FILES([
-Makefile
-shared/Makefile
-src/Makefile
-test/Makefile
-])
-
-AC_OUTPUT
diff --git a/desktop-shell/Makefile.am b/desktop-shell/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
similarity index 100%
rename from autogen.sh
rename to desktop-shell/autogen.sh
diff --git a/desktop-shell/configure.ac b/desktop-shell/configure.ac
new file mode 100644 (file)
index 0000000..afc1dd0
--- /dev/null
@@ -0,0 +1,34 @@
+m4_define([pepper_desktop_shell_major], 0)
+m4_define([pepper_desktop_shell_minor], 0)
+m4_define([pepper_desktop_shell_micro], 0)
+
+m4_define([pepper_desktop_shell_version],
+          [pepper_desktop_shell_major.pepper_desktop_shell_minor.pepper_desktop_shell_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_desktop_shell], [pepper_desktop_shell_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_DESKTOP_SHELL_VERSION_MAJOR], [pepper_desktop_shell_major_version])
+AC_SUBST([PEPPER_DESKTOP_SHELL_VERSION_MINOR], [pepper_desktop_shell_minor_version])
+AC_SUBST([PEPPER_DESKTOP_SHELL_VERSION_MICRO], [pepper_desktop_shell_micro_version])
+AC_SUBST([PEPPER_DESKTOP_SHELL_VERSION], [pepper_desktop_shell_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PEPPER_DESKTOP_SHELL_MODULES="pepper"
+PKG_CHECK_MODULES(PEPPER_DESKTOP_SHELL, [$PEPPER_DESKTOP_SHELL_MODULES])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper-desktop-shell.pc
+])
+
+AC_OUTPUT
diff --git a/desktop-shell/src/Makefile.am b/desktop-shell/src/Makefile.am
new file mode 100644 (file)
index 0000000..d36097c
--- /dev/null
@@ -0,0 +1,13 @@
+lib_LTLIBRARIES = libpepper-desktop-shell.la
+include_HEADERS = pepper-desktop-shell.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-desktop-shell.pc
+
+libpepper_desktop_shell_la_CFLAGS = $(PEPPER_DESKTOP_SHELL_CFLAGS)
+libpepper_desktop_shell_la_LIBADD = $(PEPPER_DESKTOP_SHELL_LIBS)
+
+libpepper_desktop_shell_la_SOURCES =    desktop-shell-internal.h  \
+                                        shell.c                   \
+                                        shell-surface.c           \
+                                        wl-shell.c
@@ -1,7 +1,9 @@
 #include <config.h>
 #include "pepper-desktop-shell.h"
 #include <wayland-server.h>
-#include <common.h>
+
+/* TODO: */
+#define PEPPER_ERROR(...)
 
 /* Ping timeout value in ms. */
 #define DESKTOP_SHELL_PING_TIMEOUT  200
diff --git a/desktop-shell/src/pepper-desktop-shell.pc.in b/desktop-shell/src/pepper-desktop-shell.pc.in
new file mode 100644 (file)
index 0000000..570a19a
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper Libinput Backend Library
+Description: Pepper libinput backend library header and library files
+Version: @PEPPER_LIBINPUT_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper-desktop-shell
similarity index 97%
rename from src/modules/desktop-shell/shell-surface.c
rename to desktop-shell/src/shell-surface.c
index 3e9a426..b379d95 100644 (file)
@@ -1,4 +1,5 @@
 #include "desktop-shell-internal.h"
+#include <stdlib.h>
 
 static void
 remove_ping_timer(shell_surface_t *shsurf)
@@ -55,7 +56,7 @@ shell_surface_create(shell_t *shell, pepper_surface_t *surface, struct wl_client
     if (pepper_surface_get_role(surface))
         return NULL;
 
-    shsurf = pepper_calloc(1, sizeof(shell_surface_t));
+    shsurf = calloc(1, sizeof(shell_surface_t));
     if (!shsurf)
         return NULL;
 
similarity index 93%
rename from src/modules/desktop-shell/shell.c
rename to desktop-shell/src/shell.c
index 8bca260..8850401 100644 (file)
@@ -1,4 +1,5 @@
 #include "desktop-shell-internal.h"
+#include <stdlib.h>
 
 shell_t *
 shell_create(pepper_compositor_t *compositor, struct wl_client *client,
@@ -7,7 +8,7 @@ shell_create(pepper_compositor_t *compositor, struct wl_client *client,
 {
     shell_t *shell;
 
-    shell = pepper_calloc(1, sizeof(shell_t));
+    shell = calloc(1, sizeof(shell_t));
     if (!shell)
     {
         wl_client_post_no_memory(client);
diff --git a/doctor/Makefile.am b/doctor/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/doctor/autogen.sh b/doctor/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/doctor/configure.ac b/doctor/configure.ac
new file mode 100644 (file)
index 0000000..dfa043a
--- /dev/null
@@ -0,0 +1,33 @@
+m4_define([doctor_major], 0)
+m4_define([doctor_minor], 0)
+m4_define([doctor_micro], 0)
+
+m4_define([doctor_version], [doctor_major.doctor_minor.doctor_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([doctor], [doctor_version], [tkq.kim@samsung.com])
+
+AC_SUBST([DOCTOR_VERSION_MAJOR], [doctor_major_version])
+AC_SUBST([DOCTOR_VERSION_MINOR], [doctor_minor_version])
+AC_SUBST([DOCTOR_VERSION_MICRO], [doctor_micro_version])
+AC_SUBST([DOCTOR_VERSION], [doctor_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+DOCTOR_MODULES="wayland-server pepper"
+
+PKG_CHECK_MODULES(DOCTOR, [$DOCTOR_MODULES])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+])
+
+AC_OUTPUT
diff --git a/doctor/src/Makefile.am b/doctor/src/Makefile.am
new file mode 100644 (file)
index 0000000..3d6da19
--- /dev/null
@@ -0,0 +1,4 @@
+bin_PROGRAMS = doctor
+doctor_CFLAGS = $(DOCTOR_CFLAGS) -Wall
+doctor_LDADD = $(DOCTOR_LIBS)
+doctor_SOURCES = server.c
similarity index 93%
rename from src/server/server.c
rename to doctor/src/server.c
index c986d02..ac29ec5 100644 (file)
@@ -1,4 +1,3 @@
-#include "../common.h"
 #include <pepper.h>
 
 int
diff --git a/drm/Makefile.am b/drm/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/drm/autogen.sh b/drm/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/drm/configure.ac b/drm/configure.ac
new file mode 100644 (file)
index 0000000..01181e8
--- /dev/null
@@ -0,0 +1,35 @@
+m4_define([pepper_drm_major], 0)
+m4_define([pepper_drm_minor], 0)
+m4_define([pepper_drm_micro], 0)
+
+m4_define([pepper_drm_version], [pepper_drm_major.pepper_drm_minor.pepper_drm_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_drm], [pepper_drm_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_DRM_VERSION_MAJOR], [pepper_drm_major_version])
+AC_SUBST([PEPPER_DRM_VERSION_MINOR], [pepper_drm_minor_version])
+AC_SUBST([PEPPER_DRM_VERSION_MICRO], [pepper_drm_micro_version])
+AC_SUBST([PEPPER_DRM_VERSION], [pepper_drm_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PEPPER_DRM_MODULES="pepper pepper-render pepper-libinput pixman-1 wayland-server \
+                    libdrm gbm pepper-desktop-shell"
+
+PKG_CHECK_MODULES(PEPPER_DRM, [$PEPPER_DRM_MODULES])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper-drm.pc
+])
+
+AC_OUTPUT
diff --git a/drm/src/Makefile.am b/drm/src/Makefile.am
new file mode 100644 (file)
index 0000000..f9703e9
--- /dev/null
@@ -0,0 +1,12 @@
+lib_LTLIBRARIES = libpepper-drm.la
+include_HEADERS = pepper-drm.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-drm.pc
+
+libpepper_drm_la_CFLAGS = $(PEPPER_DRM_CFLAGS) -Wall
+libpepper_drm_la_LIBADD = $(PEPPER_DRM_LIBS)
+
+libpepper_drm_la_SOURCES =  drm-internal.h      \
+                            drm-common.c        \
+                            drm-output.c
similarity index 92%
rename from src/modules/drm/drm-common.c
rename to drm/src/drm-common.c
index 5e43e15..1bbb7db 100644 (file)
@@ -1,13 +1,14 @@
 #include <libudev.h>
 #include <unistd.h>
 #include "drm-internal.h"
+#include <stdlib.h>
 
 PEPPER_API pepper_drm_t *
 pepper_drm_create(pepper_compositor_t *compositor, const char *device)
 {
     pepper_drm_t    *drm;
 
-    drm = (pepper_drm_t *)pepper_calloc(1, sizeof(pepper_drm_t));
+    drm = (pepper_drm_t *)calloc(1, sizeof(pepper_drm_t));
     if (!drm)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
@@ -62,7 +63,7 @@ pepper_drm_destroy(pepper_drm_t *drm)
     }
 
     if (drm->crtcs)
-        pepper_free(drm->crtcs);
+        free(drm->crtcs);
 
     if (drm->drm_fd)
         close(drm->drm_fd);
@@ -73,7 +74,7 @@ pepper_drm_destroy(pepper_drm_t *drm)
     if (drm->udev)
         udev_unref(drm->udev);
 
-    pepper_free(drm);
+    free(drm);
 
     return;
 }
similarity index 96%
rename from src/modules/drm/drm-internal.h
rename to drm/src/drm-internal.h
index ef64fb4..be6d23f 100644 (file)
@@ -5,13 +5,16 @@
 #include <xf86drm.h>
 #include <xf86drmMode.h>
 
-#include <common.h>
 #include <pepper-libinput.h>
+#include <pepper-render.h>
 
 #include "pepper-drm.h"
 
 #define DUMB_FB_COUNT   2
 
+/* TODO: Error Logging. */
+#define PEPPER_ERROR(...)
+
 typedef struct drm_output       drm_output_t;
 typedef struct drm_fb           drm_fb_t;
 
similarity index 96%
rename from src/modules/drm/drm-output.c
rename to drm/src/drm-output.c
index 31043b4..027cc65 100644 (file)
@@ -42,9 +42,9 @@ drm_output_destroy(void *o)
     fini_renderer(output);
 
     if (output->modes)
-        pepper_free(output->modes);
+        free(output->modes);
 
-    pepper_free(output);
+    free(output);
 }
 
 static void
@@ -90,14 +90,12 @@ drm_output_get_subpixel_order(void *data)
 static const char *
 drm_output_get_maker_name(void *output)
 {
-    PEPPER_IGNORE(output);
     return "PePPer DRM";
 }
 
 static const char *
 drm_output_get_model_name(void *output)
 {
-    PEPPER_IGNORE(output);
     return "PePPer DRM";
 }
 
@@ -179,7 +177,7 @@ destroy_fb(struct gbm_bo *bo, void *data)
     if (fb->id)
         drmModeRmFB(fb->fd, fb->id);
 
-    pepper_free(fb);
+    free(fb);
 }
 
 static drm_fb_t *
@@ -189,7 +187,7 @@ create_fb(drm_output_t *output, struct gbm_bo *bo)
     uint32_t    w, h;
     drm_fb_t   *fb;
 
-    fb = (drm_fb_t *)pepper_calloc(1, sizeof(drm_fb_t));
+    fb = (drm_fb_t *)calloc(1, sizeof(drm_fb_t));
     if (!fb)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
@@ -239,7 +237,7 @@ draw_gl(drm_output_t *output)
 {
     struct gbm_bo *bo;
 
-    output->renderer->draw(output->renderer, NULL/*FIXME*/, NULL);
+    pepper_renderer_repaint_output(output->renderer, output->base);
 
     bo = gbm_surface_lock_front_buffer(output->gbm_surface);
     if (!bo)
@@ -262,7 +260,8 @@ draw_pixman(drm_output_t *output)
 {
     output->back_fb_index ^= 1;
     output->back_fb = output->dumb_fb[output->back_fb_index];
-    output->renderer->draw(output->renderer, output->dumb_image[output->back_fb_index], NULL);
+    pepper_renderer_repaint_output(output->renderer, output->base);
+    pepper_pixman_renderer_set_target(output->renderer, output->dumb_image[output->back_fb_index]);
 }
 
 static void
@@ -470,7 +469,7 @@ create_dumb_fb(drm_output_t *output)
     struct drm_mode_destroy_dumb    destroy_arg;
     struct drm_mode_map_dumb        map_arg;
 
-    fb = pepper_calloc(1, sizeof(drm_fb_t));
+    fb = calloc(1, sizeof(drm_fb_t));
     if (!fb)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
@@ -528,7 +527,7 @@ err_bo:
     drmIoctl(drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg);
 
 err_fb:
-    pepper_free(fb);
+    free(fb);
     return NULL;
 }
 
@@ -550,7 +549,7 @@ destroy_dumb_fb(drm_fb_t *fb)
     destroy_arg.handle = fb->handle;
     drmIoctl(fb->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg);
 
-    pepper_free(fb);
+    free(fb);
 }
 
 static void
@@ -566,8 +565,8 @@ fini_pixman_renderer(drm_output_t *output)
             pixman_image_unref(output->dumb_image[i]);
     }
 
-    if (output->renderer && output->renderer->destroy)
-        output->renderer->destroy(output->renderer);
+    if (output->renderer)
+        pepper_renderer_destroy(output->renderer);
 }
 
 /* FIXME: copied from weston */
@@ -596,7 +595,7 @@ init_pixman_renderer(drm_output_t *output)
         }
     }
 
-    output->renderer = pepper_pixman_renderer_create();
+    output->renderer = pepper_pixman_renderer_create(output->drm->compositor);
     if (!output->renderer)
     {
         PEPPER_ERROR("Failed to create pixman renderer in %s\n", __FUNCTION__);
@@ -616,7 +615,7 @@ static void
 fini_gl_renderer(drm_output_t *output)
 {
     if (output->renderer)
-        output->renderer->destroy(output->renderer);
+        pepper_renderer_destroy(output->renderer);
 
     if (output->gbm_surface)
         gbm_surface_destroy(output->gbm_surface);
@@ -696,7 +695,7 @@ drm_output_create(pepper_drm_t *drm, struct udev_device *device,
     int             i;
     drm_output_t   *output;
 
-    output = (drm_output_t *)pepper_calloc(1, sizeof(drm_output_t));
+    output = (drm_output_t *)calloc(1, sizeof(drm_output_t));
     if (!output)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
@@ -724,7 +723,7 @@ drm_output_create(pepper_drm_t *drm, struct udev_device *device,
 
     /* set modes */
     output->mode_count = conn->count_modes;
-    output->modes = (drmModeModeInfo *)pepper_calloc(conn->count_modes,
+    output->modes = (drmModeModeInfo *)calloc(conn->count_modes,
                                                      sizeof(drmModeModeInfo));
     if (!output->modes)
     {
@@ -775,7 +774,7 @@ drm_add_outputs(pepper_drm_t *drm, struct udev_device *device)
         return PEPPER_FALSE;
     }
 
-    drm->crtcs = pepper_calloc(res->count_crtcs, sizeof(uint32_t));
+    drm->crtcs = calloc(res->count_crtcs, sizeof(uint32_t));
     if (!drm->crtcs)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
diff --git a/drm/src/pepper-drm.pc.in b/drm/src/pepper-drm.pc.in
new file mode 100644 (file)
index 0000000..e6b5600
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper Libinput Backend Library
+Description: Pepper libinput backend library header and library files
+Version: @PEPPER_LIBINPUT_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper-drm
diff --git a/libinput/Makefile.am b/libinput/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/libinput/autogen.sh b/libinput/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/libinput/configure.ac b/libinput/configure.ac
new file mode 100644 (file)
index 0000000..7034d9d
--- /dev/null
@@ -0,0 +1,34 @@
+m4_define([pepper_libinput_major], 0)
+m4_define([pepper_libinput_minor], 0)
+m4_define([pepper_libinput_micro], 0)
+
+m4_define([pepper_libinput_version],
+          [pepper_libinput_major.pepper_libinput_minor.pepper_libinput_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_libinput], [pepper_libinput_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_LIBINPUT_VERSION_MAJOR], [pepper_libinput_major_version])
+AC_SUBST([PEPPER_LIBINPUT_VERSION_MINOR], [pepper_libinput_minor_version])
+AC_SUBST([PEPPER_LIBINPUT_VERSION_MICRO], [pepper_libinput_micro_version])
+AC_SUBST([PEPPER_LIBINPUT_VERSION], [pepper_libinput_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PEPPER_LIBINPUT_MODULES="pepper wayland-server libinput"
+PKG_CHECK_MODULES(PEPPER_LIBINPUT, [$PEPPER_LIBINPUT_MODULES])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper-libinput.pc
+])
+
+AC_OUTPUT
diff --git a/libinput/src/Makefile.am b/libinput/src/Makefile.am
new file mode 100644 (file)
index 0000000..75605ff
--- /dev/null
@@ -0,0 +1,11 @@
+lib_LTLIBRARIES = libpepper-libinput.la
+include_HEADERS = pepper-libinput.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-libinput.pc
+
+libpepper_libinput_la_CFLAGS = $(PEPPER_LIBINPUT_CFLAGS) -Wall
+libpepper_libinput_la_LIBADD = $(PEPPER_LIBINPUT_LIBS)
+
+libpepper_libinput_la_SOURCES = libinput-internal.h      \
+                                libinput.c
similarity index 95%
rename from src/modules/libinput/libinput-internal.h
rename to libinput/src/libinput-internal.h
index e41be04..4177deb 100644 (file)
@@ -1,9 +1,11 @@
 #ifndef LIBINPUT_INTERNAL_H
 #define LIBINPUT_INTERNAL_H
 
-#include <common.h>
 #include "pepper-libinput.h"
 
+/* TODO: Error logging. */
+#define PEPPER_ERROR(...)
+
 typedef struct libinput_seat         libinput_seat_t;
 
 struct pepper_libinput
similarity index 98%
rename from src/modules/libinput/libinput.c
rename to libinput/src/libinput.c
index 1677a40..a3bcc74 100644 (file)
@@ -16,9 +16,9 @@ libinput_seat_destroy(void *data)
     wl_list_remove(&seat->link);
 
     if (seat->name)
-        pepper_string_free(seat->name);
+        free(seat->name);
 
-    pepper_free(seat);
+    free(seat);
 }
 
 static void
@@ -63,7 +63,7 @@ libinput_seat_create(pepper_libinput_t *input)
 {
     libinput_seat_t *seat;
 
-    seat = (libinput_seat_t *)pepper_calloc(1, sizeof(libinput_seat_t));
+    seat = (libinput_seat_t *)calloc(1, sizeof(libinput_seat_t));
     if (!seat)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
@@ -86,7 +86,7 @@ libinput_seat_create(pepper_libinput_t *input)
 
 error:
     if (seat)
-        pepper_free(seat);
+        free(seat);
 
     return NULL;
 }
@@ -191,7 +191,7 @@ device_added(pepper_libinput_t *input, struct libinput_device *libinput_device)
 
     if (!seat->name)
     {
-        seat->name = pepper_string_copy(seat_name);
+        seat->name = strdup(seat_name);
         wl_signal_emit(&seat->name_signal, seat);
     }
 }
@@ -504,7 +504,7 @@ pepper_libinput_create(pepper_compositor_t *compositor, struct udev *udev)
     struct wl_event_loop   *loop;
     pepper_libinput_t      *input;
 
-    input = (pepper_libinput_t *)pepper_calloc(1, sizeof(pepper_libinput_t));
+    input = (pepper_libinput_t *)calloc(1, sizeof(pepper_libinput_t));
     if (!input)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
@@ -568,5 +568,5 @@ pepper_libinput_destroy(pepper_libinput_t *input)
     if (input->libinput_event_source)
         wl_event_source_remove(input->libinput_event_source);
 
-    pepper_free(input);
+    free(input);
 }
diff --git a/libinput/src/pepper-libinput.pc.in b/libinput/src/pepper-libinput.pc.in
new file mode 100644 (file)
index 0000000..0b5f9d2
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper Libinput Backend Library
+Description: Pepper libinput backend library header and library files
+Version: @PEPPER_LIBINPUT_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper-libinput
similarity index 100%
rename from AUTHORS
rename to pepper/AUTHORS
similarity index 100%
rename from CODING_STYLE
rename to pepper/CODING_STYLE
similarity index 100%
rename from COPYING
rename to pepper/COPYING
diff --git a/pepper/Makefile.am b/pepper/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
similarity index 100%
rename from README
rename to pepper/README
diff --git a/pepper/autogen.sh b/pepper/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/pepper/configure.ac b/pepper/configure.ac
new file mode 100644 (file)
index 0000000..d4fb8a4
--- /dev/null
@@ -0,0 +1,34 @@
+m4_define([pepper_major], 0)
+m4_define([pepper_minor], 0)
+m4_define([pepper_micro], 0)
+
+m4_define([pepper_version], [pepper_major.pepper_minor.pepper_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper], [pepper_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_VERSION_MAJOR], [pepper_major_version])
+AC_SUBST([PEPPER_VERSION_MINOR], [pepper_minor_version])
+AC_SUBST([PEPPER_VERSION_MICRO], [pepper_micro_version])
+AC_SUBST([PEPPER_VERSION], [pepper_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PEPPER_MODULES="wayland-server pixman-1"
+PKG_CHECK_MODULES(PEPPER, [$PEPPER_MODULES])
+
+# Output files
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper.pc
+])
+
+AC_OUTPUT
similarity index 72%
rename from packaging/pepper.spec
rename to pepper/packaging/pepper.spec
index e404e12..518c1f7 100644 (file)
@@ -1,7 +1,7 @@
 Name:          pepper
 Version:       1.0.0
 Release:       0
-Summary:       Pepper Wayland Compositor
+Summary:       Pepper - Library for developing wayland compositor
 License:       Proprietary
 Group:         Graphics & UI Framework/Wayland Window System
 
@@ -16,7 +16,7 @@ BuildRequires:        pkgconfig(wayland-server)
 BuildRequires: pkgconfig(pixman-1)
 
 %description
-Pepper is a lightweight and flexible wayland compositor mainly designed for tizen.
+Pepper is a lightweight and flexible library for developing various types of wayland compositors.
 
 %prep
 %setup -q
@@ -30,6 +30,6 @@ make %{?_smp_mflags}
 %make_install
 
 %files
-%{_bindir}/pepper
+%{_libdir}/libpepper.so*
 
 %post
diff --git a/pepper/src/Makefile.am b/pepper/src/Makefile.am
new file mode 100644 (file)
index 0000000..92026bb
--- /dev/null
@@ -0,0 +1,24 @@
+lib_LTLIBRARIES = libpepper.la
+include_HEADERS = pepper.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper.pc
+
+libpepper_la_CFLAGS = $(PEPPER_CFLAGS) -Wall
+libpepper_la_LIBADD = $(PEPPER_LIBS)
+
+libpepper_la_SOURCES = pepper.h                 \
+                       pepper-internal.h        \
+                       common.h                 \
+                       common.c                 \
+                       compositor.c             \
+                       output.c                 \
+                       input.c                  \
+                       surface.c                \
+                       region.c                 \
+                       buffer.c                 \
+                       data-device.c            \
+                       view.c                   \
+                       layer.c                  \
+                       pepper-util.h            \
+                       pepper-util.c
similarity index 100%
rename from src/buffer.c
rename to pepper/src/buffer.c
similarity index 100%
rename from src/common.c
rename to pepper/src/common.c
similarity index 100%
rename from src/common.h
rename to pepper/src/common.h
similarity index 100%
rename from src/compositor.c
rename to pepper/src/compositor.c
similarity index 100%
rename from src/data-device.c
rename to pepper/src/data-device.c
similarity index 100%
rename from src/input.c
rename to pepper/src/input.c
similarity index 100%
rename from src/layer.c
rename to pepper/src/layer.c
similarity index 99%
rename from src/output.c
rename to pepper/src/output.c
index e9da091..45e37ed 100644 (file)
@@ -148,7 +148,7 @@ idle_repaint(void *data)
     }
 }
 
-void
+PEPPER_API void
 pepper_output_schedule_repaint(pepper_output_t *output)
 {
     struct wl_event_loop *loop;
similarity index 99%
rename from src/pepper-internal.h
rename to pepper/src/pepper-internal.h
index 8ab8c6d..ef7eb60 100644 (file)
@@ -60,9 +60,6 @@ struct pepper_output
 };
 
 void
-pepper_output_schedule_repaint(pepper_output_t *output);
-
-void
 pepper_output_repaint(pepper_output_t *output);
 
 struct pepper_buffer
similarity index 100%
rename from src/pepper-util.c
rename to pepper/src/pepper-util.c
similarity index 100%
rename from src/pepper-util.h
rename to pepper/src/pepper-util.h
similarity index 93%
rename from src/pepper.h
rename to pepper/src/pepper.h
index fbe1989..a5fe5a2 100644 (file)
@@ -37,7 +37,6 @@ typedef struct pepper_touch             pepper_touch_t;
 typedef struct pepper_input_event       pepper_input_event_t;
 typedef struct pepper_event_hook        pepper_event_hook_t;
 
-typedef struct pepper_renderer          pepper_renderer_t;
 typedef struct pepper_surface           pepper_surface_t;
 typedef struct pepper_view              pepper_view_t;
 typedef struct pepper_layer             pepper_layer_t;
@@ -215,6 +214,9 @@ pepper_output_get_mode(pepper_output_t *output, int index);
 PEPPER_API pepper_bool_t
 pepper_output_set_mode(pepper_output_t *output, const pepper_output_mode_t *mode);
 
+PEPPER_API void
+pepper_output_schedule_repaint(pepper_output_t *output);
+
 /* Input. */
 struct pepper_seat_interface
 {
@@ -277,27 +279,6 @@ pepper_compositor_add_event_hook(pepper_compositor_t        *compositor,
 PEPPER_API void
 pepper_event_hook_destroy(pepper_event_hook_t     *hook);
 
-/* Renderer. */
-struct pepper_renderer
-{
-    void            (*destroy)(pepper_renderer_t *renderer);
-
-    pepper_bool_t   (*read_pixels)(pepper_renderer_t *renderer, void *target,
-                                   int x, int y, int w, int h,
-                                   void *pixels, pepper_format_t format);
-
-    void            (*attach_surface)(pepper_renderer_t *renderer,
-                                      pepper_surface_t *surface, int *w, int *h);
-    void            (*flush_surface_damage)(pepper_renderer_t *renderer, pepper_surface_t *surface);
-    void            (*draw)(pepper_renderer_t *renderer, void *data, void *target);
-};
-
-PEPPER_API void
-pepper_renderer_init(pepper_renderer_t *renderer);
-
-PEPPER_API void
-pepper_renderer_destroy(pepper_renderer_t *renderer);
-
 /* Surface. */
 PEPPER_API void
 pepper_surface_add_destroy_listener(pepper_surface_t *surface, struct wl_listener *listener);
diff --git a/pepper/src/pepper.pc.in b/pepper/src/pepper.pc.in
new file mode 100644 (file)
index 0000000..7de619d
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper Library
+Description: Pepper library header and library files
+Version: @PEPPER_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper
similarity index 100%
rename from src/region.c
rename to pepper/src/region.c
similarity index 100%
rename from src/surface.c
rename to pepper/src/surface.c
similarity index 100%
rename from src/view.c
rename to pepper/src/view.c
diff --git a/render/Makefile.am b/render/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/render/autogen.sh b/render/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/render/configure.ac b/render/configure.ac
new file mode 100644 (file)
index 0000000..4717f4f
--- /dev/null
@@ -0,0 +1,56 @@
+m4_define([pepper_render_major], 0)
+m4_define([pepper_render_minor], 0)
+m4_define([pepper_render_micro], 0)
+
+m4_define([pepper_render_version], [pepper_render_major.pepper_render_minor.pepper_render_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_render], [pepper_render_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_RENDER_VERSION_MAJOR], [pepper_render_major_version])
+AC_SUBST([PEPPER_RENDER_VERSION_MINOR], [pepper_render_minor_version])
+AC_SUBST([PEPPER_RENDER_VERSION_MICRO], [pepper_render_micro_version])
+AC_SUBST([PEPPER_RENDER_VERSION], [pepper_render_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PKG_CHECK_MODULES(PEPPER_RENDER, [pepper])
+
+# pixman renderer
+AC_ARG_ENABLE(pixman,
+              AC_HELP_STRING([--enable-pixman], [enable pixman renderer]),
+              [enable_pixman=$enableval], [enable_pixman=yes])
+
+AM_CONDITIONAL(ENABLE_PIXMAN, test $enable_pixman = yes)
+
+if test $enable_pixman = yes; then
+    AC_DEFINE(ENABLE_PIXMAN, 1, [Enable pixman renderer])
+    PKG_CHECK_MODULES(PIXMAN, [pixman-1])
+fi
+
+# gl renderer
+AC_ARG_ENABLE(gl,
+              AC_HELP_STRING([--enable-gl], [enable OpenGL renderer]),
+              [enable_gl=$enableval], [enable_gl=yes])
+
+AM_CONDITIONAL(ENABLE_GL, test $enable_gl = yes)
+
+if test $enable_gl = yes; then
+    AC_DEFINE(ENABLE_GL, 1, [Enable OpenGL renderer])
+    PKG_CHECK_MODULES(GL, [egl glesv2])
+fi
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper-render.pc
+])
+
+AC_OUTPUT
diff --git a/render/src/Makefile.am b/render/src/Makefile.am
new file mode 100644 (file)
index 0000000..0246205
--- /dev/null
@@ -0,0 +1,37 @@
+lib_LTLIBRARIES =
+include_HEADERS =
+
+# pepper-render library
+lib_LTLIBRARIES += libpepper-render.la
+include_HEADERS += pepper-render.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-render.pc
+
+libpepper_render_la_CFLAGS = $(PEPPER_RENDER_CFLAGS) -Wall
+libpepper_render_la_LIBADD = $(PEPPER_RENDER_LIBS)
+
+libpepper_render_la_SOURCES = pepper-render.h          \
+                             pepper-render-internal.h  \
+                             renderer.c
+
+# pixman renderer
+if ENABLE_PIXMAN
+include_HEADERS += pepper-pixman-renderer.h
+
+libpepper_render_la_CFLAGS += $(PIXMAN_CFLAGS)
+libpepper_render_la_LIBADD += $(PIXMAN_LIBS)
+
+libpepper_render_la_SOURCES += pixman-renderer.c
+endif
+
+# gl renderer
+if ENABLE_GL
+include_HEADERS += pepper-gl-renderer.h
+
+libpepper_render_la_CFLAGS += $(GL_CFLAGS)
+libpepper_render_la_LIBADD += $(GL_LIBS)
+
+libpepper_render_la_SOURCES += gl-renderer.c    \
+                               eglextwayland.h
+endif
similarity index 81%
rename from src/gl-renderer.c
rename to render/src/gl-renderer.c
index 5e09f47..8334020 100644 (file)
@@ -1,11 +1,13 @@
 #include "pepper-gl-renderer.h"
-#include "common.h"
+#include "pepper-render-internal.h"
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 #include "eglextwayland.h"
 #include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 typedef struct gl_renderer      gl_renderer_t;
 typedef struct gl_surface_state gl_surface_state_t;
@@ -35,7 +37,6 @@ enum buffer_type
 struct gl_renderer
 {
     pepper_renderer_t       base;
-    pepper_compositor_t    *compositor;
 
     void                   *native_display;
     void                   *native_window;
@@ -110,60 +111,29 @@ struct gl_surface_state
 };
 
 static pepper_bool_t
-gl_renderer_use(gl_renderer_t *renderer)
+gl_renderer_use(gl_renderer_t *gr)
 {
-    if (!eglMakeCurrent(renderer->display, renderer->surface, renderer->surface, renderer->context))
+    if (!eglMakeCurrent(gr->display, gr->surface, gr->surface, gr->context))
         return PEPPER_FALSE;
 
     return PEPPER_TRUE;
 }
 
 static void
-gl_renderer_destroy(pepper_renderer_t *r)
+gl_renderer_destroy(pepper_renderer_t *renderer)
 {
-    gl_renderer_t *renderer = (gl_renderer_t *)r;
+    gl_renderer_t *gr = (gl_renderer_t *)renderer;
 
-    if (renderer->context != EGL_NO_CONTEXT)
-        eglDestroyContext(renderer->display, renderer->context);
+    if (gr->context != EGL_NO_CONTEXT)
+        eglDestroyContext(gr->display, gr->context);
 
-    if (renderer->surface != EGL_NO_SURFACE)
-        eglDestroySurface(renderer->display, renderer->surface);
+    if (gr->surface != EGL_NO_SURFACE)
+        eglDestroySurface(gr->display, gr->surface);
 
-    if (renderer->display != EGL_NO_DISPLAY)
-        eglTerminate(renderer->display);
+    if (gr->display != EGL_NO_DISPLAY)
+        eglTerminate(gr->display);
 
-    pepper_free(renderer);
-}
-
-static pepper_bool_t
-gl_renderer_read_pixels(pepper_renderer_t *r, void *target,
-                        int x, int y, int w, int h,
-                        void *pixels, pepper_format_t format)
-{
-    gl_renderer_t  *renderer = (gl_renderer_t *)r;
-    GLenum          gl_format;
-    GLenum          gl_type;
-
-    if (!gl_renderer_use(renderer))
-        return PEPPER_FALSE;
-
-    switch (format)
-    {
-    case PEPPER_FORMAT_ARGB8888:
-        gl_format = GL_BGRA_EXT;
-        gl_type = GL_UNSIGNED_BYTE;
-        break;
-    case PEPPER_FORMAT_ABGR8888:
-        gl_format = GL_RGBA;
-        gl_type = GL_UNSIGNED_BYTE;
-        break;
-    default:
-        return PEPPER_FALSE;
-    }
-
-    glPixelStorei(GL_PACK_ALIGNMENT, 1);
-    glReadPixels(x, y, w, h, gl_format, gl_type, pixels);
-    return PEPPER_TRUE;
+    free(gr);
 }
 
 /* TODO: Similar with pixman renderer. There might be a way of reusing those codes.  */
@@ -204,7 +174,7 @@ surface_state_handle_surface_destroy(struct wl_listener *listener, void *data)
     surface_state_release_buffer(state);
     wl_list_remove(&state->surface_destroy_listener.link);
     pepper_surface_set_user_data(state->surface, state->renderer, NULL, NULL);
-    pepper_free(state);
+    free(state);
 }
 
 static void
@@ -222,7 +192,7 @@ get_surface_state(pepper_renderer_t *renderer, pepper_surface_t *surface)
 
     if (!state)
     {
-        state = pepper_calloc(1, sizeof(gl_surface_state_t));
+        state = (gl_surface_state_t *)calloc(1, sizeof(gl_surface_state_t));
         if (!state)
             return NULL;
 
@@ -345,8 +315,8 @@ surface_state_attach_shm(gl_surface_state_t *state, pepper_buffer_t *buffer)
 static pepper_bool_t
 surface_state_attach_egl(gl_surface_state_t *state, pepper_buffer_t *buffer)
 {
-    gl_renderer_t      *renderer = state->renderer;
-    EGLDisplay          display = renderer->display;
+    gl_renderer_t      *gr = state->renderer;
+    EGLDisplay          display = gr->display;
     struct wl_resource *resource = pepper_buffer_get_resource(buffer);
     int                 num_planes;
     int                 sampler;
@@ -354,7 +324,7 @@ surface_state_attach_egl(gl_surface_state_t *state, pepper_buffer_t *buffer)
     int                 texture_format;
     int                 i;
 
-    if (!renderer->query_buffer(display, resource, EGL_TEXTURE_FORMAT, &texture_format))
+    if (!gr->query_buffer(display, resource, EGL_TEXTURE_FORMAT, &texture_format))
         return PEPPER_FALSE;
 
     switch (texture_format)
@@ -393,19 +363,19 @@ surface_state_attach_egl(gl_surface_state_t *state, pepper_buffer_t *buffer)
     for (i = 0; i < num_planes; i++)
     {
         attribs[1] = i;
-        state->images[i] = renderer->create_image(display, NULL, EGL_WAYLAND_BUFFER_WL,
-                                                  resource, attribs);
+        state->images[i] = gr->create_image(display, NULL, EGL_WAYLAND_BUFFER_WL,
+                                            resource, attribs);
 
         PEPPER_ASSERT(state->images[i] != EGL_NO_IMAGE_KHR);
 
         glActiveTexture(GL_TEXTURE0 + i);
         glBindTexture(GL_TEXTURE_2D, state->textures[i]);
-        renderer->image_target_texture_2d(GL_TEXTURE_2D, state->images[i]);
+        gr->image_target_texture_2d(GL_TEXTURE_2D, state->images[i]);
     }
 
-    renderer->query_buffer(display, resource, EGL_WIDTH, &state->buffer_width);
-    renderer->query_buffer(display, resource, EGL_HEIGHT, &state->buffer_height);
-    renderer->query_buffer(display, resource, EGL_WAYLAND_Y_INVERTED_WL, &state->y_inverted);
+    gr->query_buffer(display, resource, EGL_WIDTH, &state->buffer_width);
+    gr->query_buffer(display, resource, EGL_HEIGHT, &state->buffer_height);
+    gr->query_buffer(display, resource, EGL_WAYLAND_Y_INVERTED_WL, &state->y_inverted);
 
     state->buffer_type = BUFFER_TYPE_EGL;
     state->sampler = sampler;
@@ -413,7 +383,7 @@ surface_state_attach_egl(gl_surface_state_t *state, pepper_buffer_t *buffer)
     return PEPPER_TRUE;
 }
 
-static void
+static pepper_bool_t
 gl_renderer_attach_surface(pepper_renderer_t *renderer, pepper_surface_t *surface, int *w, int *h)
 {
     gl_surface_state_t *state = get_surface_state(renderer, surface);
@@ -421,8 +391,11 @@ gl_renderer_attach_surface(pepper_renderer_t *renderer, pepper_surface_t *surfac
 
     if (!buffer)
     {
+        *w = 0;
+        *h = 0;
+
         surface_state_release_buffer(state);
-        return;
+        return PEPPER_FALSE;
     }
 
     surface_state_destroy_images(state);
@@ -435,7 +408,7 @@ gl_renderer_attach_surface(pepper_renderer_t *renderer, pepper_surface_t *surfac
 
     /* Assert not reached. */
     PEPPER_ASSERT(PEPPER_FALSE);
-    return;
+    return PEPPER_FALSE;
 
 done:
     pepper_buffer_reference(buffer);
@@ -454,6 +427,8 @@ done:
     /* Output buffer size info. */
     *w = state->buffer_width;
     *h = state->buffer_height;
+
+    return PEPPER_TRUE;
 }
 
 static void
@@ -467,17 +442,48 @@ gl_renderer_flush_surface_damage(pepper_renderer_t *renderer, pepper_surface_t *
     /* TODO: Texture upload. */
 }
 
+static pepper_bool_t
+gl_renderer_read_pixels(pepper_renderer_t *renderer,
+                        int x, int y, int w, int h,
+                        void *pixels, pepper_format_t format)
+{
+    gl_renderer_t  *gr = (gl_renderer_t *)renderer;
+    GLenum          gl_format;
+    GLenum          gl_type;
+
+    if (!gl_renderer_use(gr))
+        return PEPPER_FALSE;
+
+    switch (format)
+    {
+    case PEPPER_FORMAT_ARGB8888:
+        gl_format = GL_BGRA_EXT;
+        gl_type = GL_UNSIGNED_BYTE;
+        break;
+    case PEPPER_FORMAT_ABGR8888:
+        gl_format = GL_RGBA;
+        gl_type = GL_UNSIGNED_BYTE;
+        break;
+    default:
+        return PEPPER_FALSE;
+    }
+
+    glPixelStorei(GL_PACK_ALIGNMENT, 1);
+    glReadPixels(x, y, w, h, gl_format, gl_type, pixels);
+    return PEPPER_TRUE;
+}
+
 static void
-gl_renderer_draw(pepper_renderer_t *r, void *target, void *data)
+gl_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output)
 {
-    gl_renderer_t  *renderer = (gl_renderer_t *)r;
+    gl_renderer_t  *gr = (gl_renderer_t *)renderer;
 
-    if (!gl_renderer_use(renderer))
+    if (!gl_renderer_use(gr))
         return;
 
-    glClearColor(1.0, 1.0, 0.0, 1.0);
+    glClearColor(0.0, 0.0, 0.0, 0.0);
     glClear(GL_COLOR_BUFFER_BIT);
-    eglSwapBuffers(renderer->display, renderer->surface);
+    eglSwapBuffers(gr->display, gr->surface);
 }
 
 static PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
@@ -513,9 +519,9 @@ gl_renderer_support_platform(const char *platform)
 }
 
 static pepper_bool_t
-setup_egl_extensions(gl_renderer_t *renderer)
+setup_egl_extensions(gl_renderer_t *gr)
 {
-    const char *extensions = eglQueryString(renderer->display, EGL_EXTENSIONS);
+    const char *extensions = eglQueryString(gr->display, EGL_EXTENSIONS);
 
     if (!extensions)
     {
@@ -525,8 +531,8 @@ setup_egl_extensions(gl_renderer_t *renderer)
 
     if (strstr(extensions, "EGL_KHR_image"))
     {
-        renderer->create_image  = (void *)eglGetProcAddress("eglCreateImageKHR");
-        renderer->destroy_image = (void *)eglGetProcAddress("eglDestroyImageKHR");
+        gr->create_image  = (void *)eglGetProcAddress("eglCreateImageKHR");
+        gr->destroy_image = (void *)eglGetProcAddress("eglDestroyImageKHR");
     }
     else
     {
@@ -537,7 +543,7 @@ setup_egl_extensions(gl_renderer_t *renderer)
 #ifdef EGL_EXT_swap_buffers_with_damage
     if (strstr(extensions, "EGL_EXT_swap_buffers_with_damage"))
     {
-        renderer->swap_buffers_with_damage =
+        gr->swap_buffers_with_damage =
             (void *)eglGetProcAddress("eglSwapBuffersWithDamageEXT");
     }
     else
@@ -548,27 +554,27 @@ setup_egl_extensions(gl_renderer_t *renderer)
 
     if (strstr(extensions, "EGL_WL_bind_wayland_display"))
     {
-        renderer->bind_display      = (void *)eglGetProcAddress("eglBindWaylandDisplayWL");
-        renderer->unbind_display    = (void *)eglGetProcAddress("eglUnbindWaylandDisplayWL");
-        renderer->query_buffer      = (void *)eglGetProcAddress("eglQueryWaylandBufferWL");
+        gr->bind_display      = (void *)eglGetProcAddress("eglBindWaylandDisplayWL");
+        gr->unbind_display    = (void *)eglGetProcAddress("eglUnbindWaylandDisplayWL");
+        gr->query_buffer      = (void *)eglGetProcAddress("eglQueryWaylandBufferWL");
 
-        if (!renderer->bind_display(renderer->display,
-                                    pepper_compositor_get_display(renderer->compositor)))
+        if (!gr->bind_display(gr->display,
+                                    pepper_compositor_get_display(gr->base.compositor)))
         {
-            renderer->bind_display = NULL;
-            renderer->unbind_display = NULL;
-            renderer->query_buffer = NULL;
+            gr->bind_display = NULL;
+            gr->unbind_display = NULL;
+            gr->query_buffer = NULL;
         }
     }
 
     if (strstr(extensions, "EGL_EXT_buffer_age"))
-        renderer->has_buffer_age = PEPPER_TRUE;
+        gr->has_buffer_age = PEPPER_TRUE;
     else
         PEPPER_ERROR("Performance Warning: EGL_EXT_buffer_age not supported.\n");
 
     if (strstr(extensions, "EGL_EXT_platform_base"))
     {
-        renderer->create_platform_window_surface =
+        gr->create_platform_window_surface =
             (void *)eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
     }
     else
@@ -580,7 +586,7 @@ setup_egl_extensions(gl_renderer_t *renderer)
 }
 
 static pepper_bool_t
-setup_gl_extensions(gl_renderer_t *renderer)
+setup_gl_extensions(gl_renderer_t *gr)
 {
     const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
 
@@ -590,9 +596,9 @@ setup_gl_extensions(gl_renderer_t *renderer)
         return PEPPER_FALSE;
     }
 
-    renderer->image_target_texture_2d = (void *)eglGetProcAddress("glEGLImageTargetTexture2DOES");
+    gr->image_target_texture_2d = (void *)eglGetProcAddress("glEGLImageTargetTexture2DOES");
 
-    if (!renderer->image_target_texture_2d)
+    if (!gr->image_target_texture_2d)
     {
         PEPPER_ERROR("glEGLImageTargetTexture2DOES not supported.\n");
         return PEPPER_FALSE;
@@ -605,17 +611,17 @@ setup_gl_extensions(gl_renderer_t *renderer)
     }
 
     if (strstr(extensions, "GL_EXT_read_format_bgra"))
-        renderer->has_read_format_bgra = PEPPER_TRUE;
+        gr->has_read_format_bgra = PEPPER_TRUE;
 
     if (strstr(extensions, "GL_EXT_unpack_subimage"))
-        renderer->has_unpack_subimage = PEPPER_TRUE;
+        gr->has_unpack_subimage = PEPPER_TRUE;
 
     return PEPPER_TRUE;
 }
 
 static pepper_bool_t
-init_egl(gl_renderer_t *renderer, void *dpy, void *win, EGLenum platform,
-         pepper_format_t format, const uint32_t *native_visual_id)
+init_egl(gl_renderer_t *gr, void *dpy, void *win, EGLenum platform,
+         pepper_format_t format, const void *visual_id)
 {
     EGLDisplay      display = EGL_NO_DISPLAY;
     EGLSurface      surface = EGL_NO_SURFACE;
@@ -684,7 +690,7 @@ init_egl(gl_renderer_t *renderer, void *dpy, void *win, EGLenum platform,
         goto error;
     }
 
-    if ((configs = (EGLConfig *)pepper_calloc(config_size, sizeof(EGLConfig))) == NULL)
+    if ((configs = (EGLConfig *)calloc(config_size, sizeof(EGLConfig))) == NULL)
         goto error;
 
     eglChooseConfig(display, config_attribs, configs, config_size, &num_configs);
@@ -697,12 +703,12 @@ init_egl(gl_renderer_t *renderer, void *dpy, void *win, EGLenum platform,
     {
         EGLint attrib;
 
-        if (native_visual_id)
+        if (visual_id)
         {
             /* Native visual id have privilege. */
             if (eglGetConfigAttrib(display, configs[i], EGL_NATIVE_VISUAL_ID, &attrib))
             {
-                if (attrib == (EGLint)(*native_visual_id))
+                if (attrib == *((EGLint *)visual_id))
                 {
                     config = configs[i];
                     break;
@@ -722,7 +728,7 @@ init_egl(gl_renderer_t *renderer, void *dpy, void *win, EGLenum platform,
         }
     }
 
-    pepper_free(configs);
+    free(configs);
     configs = NULL;
 
     if (!config)
@@ -751,15 +757,15 @@ init_egl(gl_renderer_t *renderer, void *dpy, void *win, EGLenum platform,
         goto error;
     }
 
-    renderer->display = display;
-    renderer->surface = surface;
-    renderer->context = context;
-    renderer->config  = config;
+    gr->display = display;
+    gr->surface = surface;
+    gr->context = context;
+    gr->config  = config;
 
-    if (!setup_egl_extensions(renderer))
+    if (!setup_egl_extensions(gr))
         goto error;
 
-    if (!setup_gl_extensions(renderer))
+    if (!setup_gl_extensions(gr))
         goto error;
 
     return PEPPER_TRUE;
@@ -775,7 +781,7 @@ error:
         eglTerminate(display);
 
     if (configs)
-        pepper_free(configs);
+        free(configs);
 
     return PEPPER_FALSE;
 }
@@ -798,9 +804,9 @@ platform_string_to_egl(const char *str)
 PEPPER_API pepper_renderer_t *
 pepper_gl_renderer_create(pepper_compositor_t *compositor, void *display, void *window,
                           const char *platform_str, pepper_format_t format,
-                          const uint32_t *native_visual_id)
+                          const void *visual_id)
 {
-    gl_renderer_t  *renderer;
+    gl_renderer_t  *gr;
     EGLenum         platform;
 
     if (!gl_renderer_support_platform(platform_str))
@@ -816,30 +822,28 @@ pepper_gl_renderer_create(pepper_compositor_t *compositor, void *display, void *
     if (!get_platform_display)
         get_platform_display = (void *)eglGetProcAddress("eglGetPlatformDisplayEXT");
 
-    renderer = (gl_renderer_t *)pepper_calloc(1, sizeof(gl_renderer_t));
-    if (!renderer)
+    gr = (gl_renderer_t *)calloc(1, sizeof(gl_renderer_t));
+    if (!gr)
         return NULL;
 
-    pepper_renderer_init(&renderer->base);
-
-    renderer->compositor = compositor;
-    renderer->native_display = display;
-    renderer->native_window  = window;
+    gr->base.compositor = compositor;
+    gr->native_display = display;
+    gr->native_window  = window;
 
-    if (!init_egl(renderer, display, window, platform, format, native_visual_id))
+    if (!init_egl(gr, display, window, platform, format, visual_id))
         goto error;
 
-    renderer->base.destroy              =   gl_renderer_destroy;
-    renderer->base.read_pixels          =   gl_renderer_read_pixels;
-    renderer->base.attach_surface       =   gl_renderer_attach_surface;
-    renderer->base.flush_surface_damage =   gl_renderer_flush_surface_damage;
-    renderer->base.draw                 =   gl_renderer_draw;
+    gr->base.destroy                =   gl_renderer_destroy;
+    gr->base.attach_surface         =   gl_renderer_attach_surface;
+    gr->base.flush_surface_damage   =   gl_renderer_flush_surface_damage;
+    gr->base.read_pixels            =   gl_renderer_read_pixels;
+    gr->base.repaint_output         =   gl_renderer_repaint_output;
 
-    return &renderer->base;
+    return &gr->base;
 
 error:
-    if (renderer)
-        gl_renderer_destroy(&renderer->base);
+    if (gr)
+        gl_renderer_destroy(&gr->base);
 
     return NULL;
 }
similarity index 79%
rename from src/pepper-gl-renderer.h
rename to render/src/pepper-gl-renderer.h
index 7d958bd..81474b6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PEPPER_GL_RENDERER_H
 #define PEPPER_GL_RENDERER_H
 
-#include "pepper.h"
+#include <pepper-render.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -9,8 +9,7 @@ extern "C" {
 
 PEPPER_API pepper_renderer_t *
 pepper_gl_renderer_create(pepper_compositor_t *compositor, void *display, void *window,
-                          const char *platform, pepper_format_t format,
-                          const uint32_t *native_visual_id);
+                          const char *platform, pepper_format_t format, const void *visual_id);
 
 #ifdef __cplusplus
 }
diff --git a/render/src/pepper-pixman-renderer.h b/render/src/pepper-pixman-renderer.h
new file mode 100644 (file)
index 0000000..9dfe40f
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef PEPPER_PIXMAN_RENDERER_H
+#define PEPPER_PIXMAN_RENDERER_H
+
+#include <pepper-render.h>
+#include <pixman.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+PEPPER_API pepper_renderer_t *
+pepper_pixman_renderer_create(pepper_compositor_t *compositor);
+
+PEPPER_API void
+pepper_pixman_renderer_set_target(pepper_renderer_t *r, pixman_image_t *image);
+
+PEPPER_API pixman_image_t *
+pepper_pixman_renderer_get_target(pepper_renderer_t *r);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PEPPER_PIXMAN_RENDERER_H */
diff --git a/render/src/pepper-render-internal.h b/render/src/pepper-render-internal.h
new file mode 100644 (file)
index 0000000..86b85e8
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef PEPPER_RENDER_INTERNAL_H
+#define PEPPER_RENDER_INTERNAL_H
+
+#include "pepper-render.h"
+
+/* TODO: Error logging. */
+#define PEPPER_ASSERT(exp)
+#define PEPPER_ERROR(...)
+
+struct pepper_renderer
+{
+    pepper_compositor_t    *compositor;
+
+    void            (*destroy)(pepper_renderer_t *renderer);
+
+    pepper_bool_t   (*attach_surface)(pepper_renderer_t *renderer,
+                                      pepper_surface_t *surface, int *w, int *h);
+
+    void            (*flush_surface_damage)(pepper_renderer_t *renderer,
+                                            pepper_surface_t *surface);
+
+    pepper_bool_t   (*read_pixels)(pepper_renderer_t *renderer,
+                                   int x, int y, int w, int h,
+                                   void *pixels, pepper_format_t format);
+
+    void            (*repaint_output)(pepper_renderer_t *renderer, pepper_output_t *output);
+};
+
+#endif /* PEPPER_RENDER_INTERNAL_H */
diff --git a/render/src/pepper-render.h b/render/src/pepper-render.h
new file mode 100644 (file)
index 0000000..101b3a7
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef PEPPER_RENDER_H
+#define PEPPER_RENDER_H
+
+#include <pepper.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct pepper_renderer  pepper_renderer_t;
+
+PEPPER_API void
+pepper_renderer_destroy(pepper_renderer_t *renderer);
+
+PEPPER_API void
+pepper_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PEPPER_RENDER_H */
diff --git a/render/src/pepper-render.pc.in b/render/src/pepper-render.pc.in
new file mode 100644 (file)
index 0000000..790ab7c
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper Rendering Library
+Description: Pepper rendering library header and library files
+Version: @PEPPER_RENDER_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper-render
similarity index 74%
rename from src/pixman-renderer.c
rename to render/src/pixman-renderer.c
index 375dec8..f6494ff 100644 (file)
@@ -1,6 +1,6 @@
 #include "pepper-pixman-renderer.h"
-#include "common.h"
-#include <pixman.h>
+#include "pepper-render-internal.h"
+#include <stdlib.h>
 
 typedef struct pixman_renderer      pixman_renderer_t;
 typedef struct pixman_surface_state pixman_surface_state_t;
@@ -8,6 +8,7 @@ typedef struct pixman_surface_state pixman_surface_state_t;
 struct pixman_renderer
 {
     pepper_renderer_t   base;
+    pixman_image_t     *target;
 };
 
 struct pixman_surface_state
@@ -23,7 +24,7 @@ struct pixman_surface_state
     struct wl_listener  surface_destroy_listener;
 };
 
-static PEPPER_INLINE pixman_format_code_t
+static inline pixman_format_code_t
 get_pixman_format(pepper_format_t format)
 {
     switch (format)
@@ -54,44 +55,14 @@ get_pixman_format(pepper_format_t format)
 }
 
 static void
-pixman_renderer_destroy(pepper_renderer_t *r)
+pixman_renderer_destroy(pepper_renderer_t *renderer)
 {
-    pixman_renderer_t *renderer = (pixman_renderer_t *)r;
-    pepper_free(renderer);
-}
+    pixman_renderer_t *pr = (pixman_renderer_t *)renderer;
 
-static pepper_bool_t
-pixman_renderer_read_pixels(pepper_renderer_t *r, void *target,
-                            int x, int y, int w, int h,
-                            void *pixels, pepper_format_t format)
-{
-    pixman_image_t         *image = (pixman_image_t *)target;
-    pixman_image_t         *dst;
-    pixman_format_code_t    pixman_format;
-    int                     stride;
+    if (pr->target)
+        pixman_image_unref(pr->target);
 
-    if (!image)
-        return PEPPER_FALSE;
-
-    pixman_format = get_pixman_format(format);
-
-    if (!pixman_format)
-    {
-        PEPPER_ERROR("Invalid format.\n");
-        return PEPPER_FALSE;
-    }
-
-    stride = (PEPPER_FORMAT_BPP(format) / 8) * w;
-    dst = pixman_image_create_bits(pixman_format, w, h, pixels, stride);
-
-    if (!dst)
-    {
-        PEPPER_ERROR("Failed to create pixman image.\n");
-        return PEPPER_FALSE;
-    }
-
-    pixman_image_composite(PIXMAN_OP_SRC, image, NULL, dst, x, y, 0, 0, 0, 0, w, h);
-    return PEPPER_TRUE;
+    free(pr);
 }
 
 /* TODO: Similar with gl renderer. There might be a way of reusing those codes.  */
@@ -122,7 +93,7 @@ surface_state_handle_surface_destroy(struct wl_listener *listener, void *data)
     surface_state_release_buffer(state);
     wl_list_remove(&state->surface_destroy_listener.link);
     pepper_surface_set_user_data(state->surface, state->renderer, NULL, NULL);
-    pepper_free(state);
+    free(state);
 }
 
 static void
@@ -140,7 +111,7 @@ get_surface_state(pepper_renderer_t *renderer, pepper_surface_t *surface)
 
     if (!state)
     {
-        state = pepper_calloc(1, sizeof(pixman_surface_state_t));
+        state = calloc(1, sizeof(pixman_surface_state_t));
         if (!state)
             return NULL;
 
@@ -178,7 +149,6 @@ surface_state_attach_shm(pixman_surface_state_t *state, pepper_buffer_t *buffer)
         format = PIXMAN_r5g6b5;
         break;
     default:
-        PEPPER_ERROR("Unknown shm buffer format.\n");
         return PEPPER_FALSE;
     }
 
@@ -199,7 +169,7 @@ surface_state_attach_shm(pixman_surface_state_t *state, pepper_buffer_t *buffer)
     return PEPPER_TRUE;;
 }
 
-static void
+static pepper_bool_t
 pixman_renderer_attach_surface(pepper_renderer_t *renderer, pepper_surface_t *surface,
                                int *w, int *h)
 {
@@ -208,8 +178,11 @@ pixman_renderer_attach_surface(pepper_renderer_t *renderer, pepper_surface_t *su
 
     if (!buffer)
     {
+        *w = 0;
+        *h = 0;
+
         surface_state_release_buffer(state);
-        return;
+        return PEPPER_TRUE;
     }
 
     if (surface_state_attach_shm(state, buffer))
@@ -217,9 +190,7 @@ pixman_renderer_attach_surface(pepper_renderer_t *renderer, pepper_surface_t *su
 
     /* TODO: Other buffer types which can be mapped into CPU address space. i.e. wl_tbm. */
 
-    /* TODO: return error so that the compositor can handle that error. */
-    PEPPER_ASSERT(PEPPER_FALSE);
-    return;
+    return PEPPER_FALSE;
 
 done:
     pepper_buffer_reference(buffer);
@@ -238,39 +209,101 @@ done:
     /* Output buffer size info. */
     *w = state->buffer_width;
     *h = state->buffer_height;
+
+    return PEPPER_TRUE;
+}
+
+static pepper_bool_t
+pixman_renderer_read_pixels(pepper_renderer_t *renderer,
+                            int x, int y, int w, int h,
+                            void *pixels, pepper_format_t format)
+{
+    pixman_image_t         *src = ((pixman_renderer_t *)renderer)->target;
+    pixman_image_t         *dst;
+    pixman_format_code_t    pixman_format;
+    int                     stride;
+
+    if (!src)
+        return PEPPER_FALSE;
+
+    pixman_format = get_pixman_format(format);
+
+    if (!pixman_format)
+    {
+        /* PEPPER_ERROR("Invalid format.\n"); */
+        return PEPPER_FALSE;
+    }
+
+    stride = (PEPPER_FORMAT_BPP(format) / 8) * w;
+    dst = pixman_image_create_bits(pixman_format, w, h, pixels, stride);
+
+    if (!dst)
+    {
+        /* PEPPER_ERROR("Failed to create pixman image.\n"); */
+        return PEPPER_FALSE;
+    }
+
+    pixman_image_composite(PIXMAN_OP_SRC, src, NULL, dst, x, y, 0, 0, 0, 0, w, h);
+    pixman_image_unref(dst);
+
+    return PEPPER_TRUE;
 }
 
 static void
-pixman_renderer_draw(pepper_renderer_t *r, void *target, void *data)
+pixman_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output)
 {
-    pixman_image_t     *image = (pixman_image_t *)target;
+    pixman_image_t *dst = ((pixman_renderer_t *)renderer)->target;
 
-    if (image)
+    if (dst)
     {
-        /* TODO: */
-        pixman_fill(pixman_image_get_data(image),
-                    pixman_image_get_stride(image) / sizeof(uint32_t),
-                    PIXMAN_FORMAT_BPP(pixman_image_get_format(image)),
+        pixman_fill(pixman_image_get_data(dst),
+                    pixman_image_get_stride(dst) / sizeof(uint32_t),
+                    PIXMAN_FORMAT_BPP(pixman_image_get_format(dst)),
                     0, 0,
-                    pixman_image_get_width(image),
-                    pixman_image_get_height(image),
-                    0xffffffff);
+                    pixman_image_get_width(dst),
+                    pixman_image_get_height(dst),
+                    0x00000000);
     }
+
+    /* TODO: */
 }
 
 PEPPER_API pepper_renderer_t *
-pepper_pixman_renderer_create()
+pepper_pixman_renderer_create(pepper_compositor_t *compositor)
 {
     pixman_renderer_t    *renderer;
 
-    renderer = pepper_calloc(1, sizeof(pixman_renderer_t));
+    renderer = calloc(1, sizeof(pixman_renderer_t));
     if (!renderer)
         return NULL;
 
+    renderer->base.compositor = compositor;
+
+    /* Backend functions. */
     renderer->base.destroy              = pixman_renderer_destroy;
-    renderer->base.read_pixels          = pixman_renderer_read_pixels;
     renderer->base.attach_surface       = pixman_renderer_attach_surface;
-    renderer->base.draw                 = pixman_renderer_draw;
+    renderer->base.read_pixels          = pixman_renderer_read_pixels;
+    renderer->base.repaint_output       = pixman_renderer_repaint_output;
 
     return &renderer->base;
 }
+
+PEPPER_API void
+pepper_pixman_renderer_set_target(pepper_renderer_t *renderer, pixman_image_t *target)
+{
+    pixman_renderer_t  *pr = (pixman_renderer_t *)renderer;
+
+    if (pr->target)
+        pixman_image_unref(pr->target);
+
+    if (target)
+        pixman_image_ref(target);
+
+    pr->target = target;
+}
+
+PEPPER_API pixman_image_t *
+pepper_pixman_renderer_get_target(pepper_renderer_t *renderer)
+{
+    return ((pixman_renderer_t *)renderer)->target;
+}
diff --git a/render/src/renderer.c b/render/src/renderer.c
new file mode 100644 (file)
index 0000000..ded995f
--- /dev/null
@@ -0,0 +1,13 @@
+#include "pepper-render-internal.h"
+
+PEPPER_API void
+pepper_renderer_destroy(pepper_renderer_t *renderer)
+{
+    renderer->destroy(renderer);
+}
+
+PEPPER_API void
+pepper_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output)
+{
+    renderer->repaint_output(renderer, output);
+}
diff --git a/samples/Makefile.am b/samples/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/samples/autogen.sh b/samples/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/samples/configure.ac b/samples/configure.ac
new file mode 100644 (file)
index 0000000..6f95d04
--- /dev/null
@@ -0,0 +1,49 @@
+m4_define([pepper_samples_major], 0)
+m4_define([pepper_samples_minor], 0)
+m4_define([pepper_samples_micro], 0)
+
+m4_define([pepper_samples_version], [pepper_samples_major.pepper_samples_minor.pepper_samples_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_samples], [pepper_samples_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_SAMPLES_VERSION_MAJOR], [pepper_samples_major_version])
+AC_SUBST([PEPPER_SAMPLES_VERSION_MINOR], [pepper_samples_minor_version])
+AC_SUBST([PEPPER_SAMPLES_VERSION_MICRO], [pepper_samples_micro_version])
+AC_SUBST([PEPPER_SAMPLES_VERSION], [pepper_samples_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+# drm-backend
+PKG_CHECK_MODULES(DRM_BACKEND,
+                  [wayland-server pepper pepper-render
+                   pepper-drm pepper-libinput
+                   pepper-desktop-shell])
+
+# wayland-backend
+PKG_CHECK_MODULES(WAYLAND_BACKEND,
+                  [wayland-server pepper pepper-render pepper-wayland pepper-desktop-shell])
+
+# x11-backend
+PKG_CHECK_MODULES(X11_BACKEND,
+                  [wayland-server pepper pepper-render pepper-x11 pepper-desktop-shell])
+
+# simple-touch
+PKG_CHECK_MODULES(SIMPLE_TOUCH, [wayland-client pepper-utils])
+
+# simple-shm
+PKG_CHECK_MODULES(SIMPLE_SHM, [wayland-client pepper-utils])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+])
+
+AC_OUTPUT
diff --git a/samples/src/Makefile.am b/samples/src/Makefile.am
new file mode 100644 (file)
index 0000000..3fe6e8e
--- /dev/null
@@ -0,0 +1,31 @@
+noinst_PROGRAMS =
+
+# drm-backend
+noinst_PROGRAMS += drm-backend
+drm_backend_CFLAGS = $(DRM_BACKEND_CFLAGS)
+drm_backend_LDADD = $(DRM_BACKEND_LIBS)
+drm_backend_SOURCES = drm-backend.c
+
+# wayland-backend
+noinst_PROGRAMS += wayland-backend
+wayland_backend_CFLAGS = $(WAYLAND_BACKEND_CFLAGS)
+wayland_backend_LDADD = $(WAYLAND_BACKEND_LIBS)
+wayland_backend_SOURCES = wayland-backend.c
+
+# x11-backend
+noinst_PROGRAMS += x11-backend
+x11_backend_CFLAGS = $(X11_BACKEND_CFLAGS)
+x11_backend_LDADD = $(X11_BACKEND_LIBS)
+x11_backend_SOURCES = x11-backend.c
+
+# simple-touch
+noinst_PROGRAMS += simple-touch
+simple_touch_CFLAGS = $(SIMPLE_TOUCH_CFLAGS)
+simple_touch_LDADD = $(SIMPLE_TOUCH_LIBS)
+simple_touch_SOURCES = simple-touch.c
+
+# simple-shm
+noinst_PROGRAMS += simple-shm
+simple_shm_CFLAGS = $(SIMPLE_TOUCH_CFLAGS)
+simple_shm_LDADD = $(SIMPLE_TOUCH_LIBS)
+simple_shm_SOURCES = simple-shm.c
similarity index 91%
rename from test/drm-backend.c
rename to samples/src/drm-backend.c
index e0b0f62..72cd470 100644 (file)
@@ -5,7 +5,10 @@
 #include <pepper.h>
 #include <pepper-drm.h>
 #include <pepper-desktop-shell.h>
-#include <common.h>
+
+/* TODO: */
+#define PEPPER_ASSERT(exp)
+#define PEPPER_ERROR(...)
 
 static int
 handle_sigint(int signal_number, void *data)
@@ -27,7 +30,9 @@ main(int argc, char **argv)
 
     {   /* for gdb attach */
         char cc;
-        scanf("%c", &cc);
+       int  ret;
+
+        ret = scanf("%c", &cc);
     }
 
     compositor = pepper_compositor_create("wayland-0");
similarity index 99%
rename from test/simple-shm.c
rename to samples/src/simple-shm.c
index 9c2d361..af3ad8f 100644 (file)
@@ -31,7 +31,7 @@
 #include <signal.h>
 
 #include <wayland-client.h>
-#include "../shared/pepper-os-compat.h"
+#include <pepper-utils.h>
 
 #include <sys/types.h>
 
similarity index 99%
rename from test/simple-touch.c
rename to samples/src/simple-touch.c
index e8986ba..50b6d4d 100644 (file)
@@ -32,7 +32,6 @@
 #include <sys/mman.h>
 
 #include <wayland-client.h>
-#include "../shared/pepper-os-compat.h"
 
 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
 
similarity index 94%
rename from test/wayland-backend.c
rename to samples/src/wayland-backend.c
index 2b527b7..7584c78 100644 (file)
@@ -1,6 +1,8 @@
 #include <pepper.h>
 #include <pepper-wayland.h>
-#include <common.h>
+
+/* TODO: */
+#define PEPPER_ASSERT(exp)
 
 int
 main(int argc, char **argv)
similarity index 95%
rename from test/x11-backend.c
rename to samples/src/x11-backend.c
index 9880d82..82425d7 100644 (file)
@@ -1,6 +1,8 @@
 #include <pepper.h>
 #include <pepper-x11.h>
-#include <common.h>
+
+/* TODO: */
+#define PEPPER_ASSERT(exp)
 
 int
 main(int argc, char **argv)
diff --git a/shared/Makefile.am b/shared/Makefile.am
deleted file mode 100644 (file)
index 1eb15e3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-noinst_LTLIBRARIES = libshared.la
-libshared_la_SOURCES =  pepper-os-compat.h  \
-                       pepper-os-compat.c
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644 (file)
index cc9e513..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-bin_PROGRAMS =
-lib_LTLIBRARIES =
-include_HEADERS =
-noinst_LTLIBRARIES =
-
-# pepper library
-lib_LTLIBRARIES += libpepper.la
-include_HEADERS += pepper.h pepper-pixman-renderer.h
-
-libpepper_la_CFLAGS = $(LIB_PEPPER_CFLAGS) -Wall
-libpepper_la_LIBADD = $(LIB_PEPPER_LIBS)
-
-libpepper_la_SOURCES = pepper.h                 \
-                       pepper-internal.h        \
-                       common.h                 \
-                       common.c                 \
-                       compositor.c             \
-                       output.c                 \
-                       input.c                  \
-                       client.c                 \
-                       surface.c                \
-                       region.c                 \
-                       buffer.c                 \
-                       renderer.c               \
-                       pixman-renderer.c        \
-                       data-device.c            \
-                       view.c                   \
-                       layer.c                  \
-                       pepper-util.h            \
-                       pepper-util.c
-
-# gl renderer
-if ENABLE_GL_RENDERER
-include_HEADERS += pepper-gl-renderer.h
-
-libpepper_la_CFLAGS += $(GL_RENDERER_CFLAGS)
-libpepper_la_LIBADD += $(GL_RENDERER_LIBS)
-
-libpepper_la_SOURCES += gl-renderer.c           \
-                        eglextwayland.h
-endif
-
-# wayland backend
-if ENABLE_WAYLAND_BACKEND
-include_HEADERS += modules/wayland/pepper-wayland.h
-
-libpepper_la_CFLAGS += $(WAYLAND_BACKEND_CFLAGS) -I$(top_srcdir)/shared/
-libpepper_la_LIBADD += $(WAYLAND_BACKEND_LIBS) $(top_builddir)/shared/libshared.la
-
-libpepper_la_SOURCES += modules/wayland/wayland-internal.h  \
-                        modules/wayland/wayland-common.c    \
-                        modules/wayland/wayland-output.c    \
-                        modules/wayland/wayland-input.c     \
-                        modules/wayland/wayland-shm-buffer.c
-endif
-
-# drm backend
-if ENABLE_DRM_BACKEND
-include_HEADERS += modules/drm/pepper-drm.h
-
-libpepper_la_CFLAGS += $(DRM_BACKEND_CFLAGS) -I$(top_srcdir)/src/modules/libinput/
-libpepper_la_LIBADD += $(DRM_BACKEND_LIBS)
-
-libpepper_la_SOURCES += modules/drm/drm-internal.h  \
-                        modules/drm/drm-common.c    \
-                        modules/drm/drm-output.c
-endif
-
-# libinput module for drm & fbdev backends
-if ENABLE_LIBINPUT
-include_HEADERS += modules/libinput/pepper-libinput.h
-
-libpepper_la_CFLAGS += $(LIBINPUT_CFLAGS)
-libpepper_la_LIBADD += $(LIBINPUT_LIBS)
-
-libpepper_la_SOURCES += modules/libinput/libinput-internal.h  \
-                        modules/libinput/libinput.c
-endif
-
-# x11 backend
-if ENABLE_X11_BACKEND
-include_HEADERS += modules/x11/pepper-x11.h
-
-libpepper_la_CFLAGS += $(X11_BACKEND_CFLAGS)
-libpepper_la_LIBADD += $(X11_BACKEND_LIBS)
-
-libpepper_la_SOURCES += modules/x11/x11-common.c    \
-                        modules/x11/x11-output.c    \
-                        modules/x11/x11-input.c     \
-                        modules/x11/x11-internal.h
-endif
-
-# desktop shell
-if ENABLE_DESKTOP_SHELL
-include_HEADERS += modules/desktop-shell/pepper-desktop-shell.h
-
-libpepper_la_CFLAGS += $(DESKTOP_SHELL_CFLAGS)
-libpepper_la_LIBADD += $(DESKTOP_SHELL_LIBS)
-
-libpepper_la_SOURCES += modules/desktop-shell/desktop-shell-internal.h  \
-                        modules/desktop-shell/shell.c                   \
-                        modules/desktop-shell/shell-surface.c           \
-                        modules/desktop-shell/wl-shell.c
-endif
-
-# Pepper server executable
-if ENABLE_PEPPER_SERVER
-bin_PROGRAMS += pepper
-
-pepper_LDFLAGS = -export-dynamic
-pepper_CFLAGS = $(PEPPER_SERVER_CFLAGS) -I$(top_srcdir)/src
-pepper_LDADD = $(PEPPER_SERVER_LIBS) -ldl libpepper.la
-
-pepper_SOURCES = server/server.c
-endif
diff --git a/src/client.c b/src/client.c
deleted file mode 100644 (file)
index aded7fb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "pepper-internal.h"
diff --git a/src/pepper-pixman-renderer.h b/src/pepper-pixman-renderer.h
deleted file mode 100644 (file)
index 4669060..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef PEPPER_PIXMAN_RENDERER_H
-#define PEPPER_PIXMAN_RENDERER_H
-
-#include "pepper.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-PEPPER_API pepper_renderer_t *
-pepper_pixman_renderer_create();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* PEPPER_PIXMAN_RENDERER_H */
diff --git a/src/renderer.c b/src/renderer.c
deleted file mode 100644 (file)
index 7f84015..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "pepper.h"
-#include <string.h>
-
-PEPPER_API void
-pepper_renderer_init(pepper_renderer_t *renderer)
-{
-    memset(renderer, 0x00, sizeof(pepper_renderer_t));
-}
-
-static void
-pepper_renderer_fini(pepper_renderer_t *renderer)
-{
-    memset(renderer, 0x00, sizeof(pepper_renderer_t));
-}
-
-PEPPER_API void
-pepper_renderer_destroy(pepper_renderer_t *renderer)
-{
-    pepper_renderer_fini(renderer);
-    renderer->destroy(renderer);
-}
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644 (file)
index 8fdd861..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-TESTPROGRAMS = drm-backend          \
-               wayland-backend      \
-               x11-backend          \
-               simple-touch         \
-               simple-shm
-
-AM_CFLAGS = $(TEST_PROGRAM_CFLAGS)                      \
-            -I$(top_srcdir)/src/                        \
-            -I$(top_srcdir)/src/modules/wayland/        \
-            -I$(top_srcdir)/src/modules/x11/            \
-            -I$(top_srcdir)/src/modules/drm/            \
-            -I$(top_srcdir)/src/modules/libinput/       \
-            -I$(top_srcdir)/src/modules/desktop-shell
-
-LDADD = $(top_builddir)/src/libpepper.la $(TEST_PROGRAM_LIBS)
-
-noinst_PROGRAMS = $(TESTPROGRAMS)
-TESTS = $(TESTPROGRAMS)
diff --git a/utils/Makefile.am b/utils/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/utils/autogen.sh b/utils/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/utils/configure.ac b/utils/configure.ac
new file mode 100644 (file)
index 0000000..0fde289
--- /dev/null
@@ -0,0 +1,32 @@
+m4_define([pepper_utils_major], 0)
+m4_define([pepper_utils_minor], 0)
+m4_define([pepper_utils_micro], 0)
+
+m4_define([pepper_utils_version], [pepper_utils_major.pepper_utils_minor.pepper_utils_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_utils], [pepper_utils_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_UTILS_VERSION_MAJOR], [pepper_utils_major_version])
+AC_SUBST([PEPPER_UTILS_VERSION_MINOR], [pepper_utils_minor_version])
+AC_SUBST([PEPPER_UTILS_VERSION_MICRO], [pepper_utils_micro_version])
+AC_SUBST([PEPPER_UTILS_VERSION], [pepper_utils_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PKG_CHECK_MODULES(PEPPER_UTILS, [pepper])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper-utils.pc
+])
+
+AC_OUTPUT
diff --git a/utils/src/Makefile.am b/utils/src/Makefile.am
new file mode 100644 (file)
index 0000000..b58b1f7
--- /dev/null
@@ -0,0 +1,11 @@
+lib_LTLIBRARIES = libpepper-utils.la
+include_HEADERS = pepper-utils.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-utils.pc
+
+libpepper_utils_la_CFLAGS = $(PEPPER_UTILS_CFLAGS)
+libpepper_utils_la_LIBADD = $(PEPPER_UTILS_LIBS)
+
+libpepper_utils_la_SOURCES = pepper-utils.h    \
+                             shm.c
similarity index 93%
rename from shared/pepper-os-compat.h
rename to utils/src/pepper-utils.h
index 0084a9f..b9dbae5 100644 (file)
 #ifndef PEPPER_OS_COMPAT_H
 #define PEPPER_OS_COMPAT_H
 
-#include <stdio.h>
+#include <pepper.h>
 
-int
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+PEPPER_API int
 pepper_create_anonymous_file(off_t size);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* PEPPER_OS_COMPAT_H */
diff --git a/utils/src/pepper-utils.pc.in b/utils/src/pepper-utils.pc.in
new file mode 100644 (file)
index 0000000..97b1b75
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper Utility Library
+Description: Pepper utility library header and library files
+Version: @PEPPER_UTILS_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper-utils
similarity index 97%
rename from shared/pepper-os-compat.c
rename to utils/src/shm.c
index 11a7635..b2bbaf9 100644 (file)
@@ -1,4 +1,4 @@
-#include "pepper-os-compat.h"
+#include "pepper-utils.h"
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
@@ -47,7 +47,7 @@ create_tmpfile_cloexec(char *tmpname)
     return fd;
 }
 
-int
+PEPPER_API int
 pepper_create_anonymous_file(off_t size)
 {
     static const char template[] = "/pepper-shared-XXXXXX";
diff --git a/wayland/Makefile.am b/wayland/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/wayland/autogen.sh b/wayland/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/wayland/configure.ac b/wayland/configure.ac
new file mode 100644 (file)
index 0000000..d23a3af
--- /dev/null
@@ -0,0 +1,33 @@
+m4_define([pepper_wayland_major], 0)
+m4_define([pepper_wayland_minor], 0)
+m4_define([pepper_wayland_micro], 0)
+
+m4_define([pepper_wayland_version], [pepper_wayland_major.pepper_wayland_minor.pepper_wayland_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_wayland], [pepper_wayland_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_WAYLAND_VERSION_MAJOR], [pepper_wayland_major_version])
+AC_SUBST([PEPPER_WAYLAND_VERSION_MINOR], [pepper_wayland_minor_version])
+AC_SUBST([PEPPER_WAYLAND_VERSION_MICRO], [pepper_wayland_micro_version])
+AC_SUBST([PEPPER_WAYLAND_VERSION], [pepper_wayland_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PEPPER_WAYLAND_MODULES="pepper pepper-render wayland-server wayland-client pixman-1"
+PKG_CHECK_MODULES(PEPPER_WAYLAND, [$PEPPER_WAYLAND_MODULES])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper-wayland.pc
+])
+
+AC_OUTPUT
diff --git a/wayland/src/Makefile.am b/wayland/src/Makefile.am
new file mode 100644 (file)
index 0000000..4b91743
--- /dev/null
@@ -0,0 +1,15 @@
+lib_LTLIBRARIES = libpepper-wayland.la
+include_HEADERS = pepper-wayland.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-wayland.pc
+
+libpepper_wayland_la_CFLAGS = $(PEPPER_WAYLAND_CFLAGS) -Wall
+libpepper_wayland_la_LIBADD = $(PEPPER_WAYLAND_LIBS)
+
+libpepper_wayland_la_SOURCES =  pepper-wayland.h        \
+                               wayland-internal.h      \
+                               wayland-common.c        \
+                               wayland-output.c        \
+                               wayland-input.c         \
+                               wayland-shm-buffer.c
diff --git a/wayland/src/pepper-wayland.pc.in b/wayland/src/pepper-wayland.pc.in
new file mode 100644 (file)
index 0000000..55e1b20
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper Wayland Backend Library
+Description: Pepper wayland backend library header and library files
+Version: @PEPPER_WAYLAND_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper-wayland
similarity index 84%
rename from src/modules/wayland/wayland-common.c
rename to wayland/src/wayland-common.c
index 8bb61fd..1743347 100644 (file)
@@ -1,5 +1,30 @@
 #include "wayland-internal.h"
 #include <string.h>
+#include <stdlib.h>
+
+char *
+string_alloc(int len)
+{
+    return (char *)malloc((len + 1) * sizeof (char));
+}
+
+char *
+string_copy(const char *str)
+{
+    int len = strlen(str);
+    char *ret = string_alloc(len);
+
+    if (ret)
+        memcpy(ret, str, (len + 1) * sizeof (char));
+
+    return ret;
+}
+
+void
+string_free(char *str)
+{
+    free(str);
+}
 
 static void
 handle_global(void *data, struct wl_registry *registry,
@@ -28,7 +53,7 @@ handle_global(void *data, struct wl_registry *registry,
 static void
 handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
 {
-    PEPPER_TRACE("TODO: %s\n", __FUNCTION__);
+    /* TODO: */
 }
 
 static const struct wl_registry_listener registry_listener =
@@ -68,13 +93,13 @@ pepper_wayland_connect(pepper_compositor_t *compositor, const char *socket_name)
     struct wl_display       *compositor_display;
     struct wl_event_loop    *loop;
 
-    conn = pepper_calloc(1, sizeof(pepper_wayland_t));
+    conn = (pepper_wayland_t *)calloc(1, sizeof(pepper_wayland_t));
     if (!conn)
         return NULL;
 
     conn->pepper = compositor;
 
-    conn->socket_name = pepper_string_copy(socket_name);
+    conn->socket_name = string_copy(socket_name);
     conn->display = wl_display_connect(socket_name);
     conn->fd = wl_display_get_fd(conn->display);
 
@@ -100,7 +125,7 @@ pepper_wayland_destroy(pepper_wayland_t *conn)
     wl_signal_emit(&conn->destroy_signal, conn);
 
     if (conn->socket_name)
-        pepper_string_free(conn->socket_name);
+        string_free(conn->socket_name);
 
     if (conn->event_source)
         wl_event_source_remove(conn->event_source);
@@ -113,4 +138,6 @@ pepper_wayland_destroy(pepper_wayland_t *conn)
 
     if (conn->shell)
         wl_shell_destroy(conn->shell);
+
+    free(conn);
 }
similarity index 96%
rename from src/modules/wayland/wayland-input.c
rename to wayland/src/wayland-input.c
index e35f0d5..a37d9f0 100644 (file)
@@ -1,4 +1,5 @@
 #include "wayland-internal.h"
+#include <stdlib.h>
 
 static void
 pointer_handle_enter(void *data, struct wl_pointer *pointer,
@@ -17,7 +18,7 @@ static void
 pointer_handle_leave(void *data, struct wl_pointer *pointer,
                      uint32_t serial, struct wl_surface *surface)
 {
-    PEPPER_TRACE("TODO: %s\n", __FUNCTION__);
+    /* TODO: */
 }
 
 static void
@@ -90,7 +91,7 @@ static void
 keyboard_handle_key_map(void *data, struct wl_keyboard *keyboard,
                         uint32_t format, int32_t fd, uint32_t size)
 {
-    PEPPER_TRACE("TODO: %s\n", __FUNCTION__);
+    /* TODO: */
 }
 
 static void
@@ -98,14 +99,14 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
                       uint32_t serial, struct wl_surface *surface,
                       struct wl_array *keys)
 {
-    PEPPER_TRACE("TODO: %s\n", __FUNCTION__);
+    /* TODO: */
 }
 
 static void
 keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
                       uint32_t serial, struct wl_surface *surface)
 {
-    PEPPER_TRACE("TODO: %s\n", __FUNCTION__);
+    /* TODO: */
 }
 
 static void
@@ -132,14 +133,14 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
                           uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched,
                           uint32_t mods_locked, uint32_t group)
 {
-    PEPPER_TRACE("TODO: %s\n", __FUNCTION__);
+    /* TODO: */
 }
 
 static void
 keyboard_handle_repeat_info(void *data, struct wl_keyboard *keyboard,
                             int32_t rate, int32_t delay)
 {
-    PEPPER_TRACE("TODO: %s\n", __FUNCTION__);
+    /* TODO: */
 }
 
 static const struct wl_keyboard_listener keyboard_listener =
@@ -295,7 +296,7 @@ seat_handle_name(void *data, struct wl_seat *s, const char *name)
     if (seat->seat != s) /* FIXME */
         return;
 
-    seat->name = pepper_string_copy(name);
+    seat->name = string_copy(name);
     wl_signal_emit(&seat->name_signal, seat);
 }
 
@@ -354,7 +355,7 @@ wayland_handle_global_seat(pepper_wayland_t *conn, struct wl_registry *registry,
 {
     wayland_seat_t  *seat;
 
-    seat = (wayland_seat_t *)pepper_calloc(1, sizeof(wayland_seat_t));
+    seat = (wayland_seat_t *)calloc(1, sizeof(wayland_seat_t));
     if (!seat)
     {
         PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
similarity index 92%
rename from src/modules/wayland/wayland-internal.h
rename to wayland/src/wayland-internal.h
index 5f42e74..b25cbcb 100644 (file)
@@ -1,13 +1,17 @@
 #include <config.h>
 #include "pepper-wayland.h"
 #include <wayland-client.h>
-#include <common.h>
 #include <pixman.h>
+#include <pepper-render.h>
 
 #if ENABLE_WAYLAND_BACKEND_EGL
 #include <wayland-egl.h>
 #endif
 
+/* TODO: Error logging. */
+#define PEPPER_ERROR(...)
+#define PEPPER_ASSERT(exp)
+
 #define NUM_SHM_BUFFERS 2
 
 typedef struct wayland_output       wayland_output_t;
@@ -56,6 +60,7 @@ struct wayland_shm_buffer
 struct wayland_output
 {
     pepper_wayland_t           *conn;
+    pepper_output_t            *base;
 
     struct wl_signal            destroy_signal;
     struct wl_signal            mode_change_signal;
@@ -124,3 +129,12 @@ wayland_shm_buffer_create(wayland_output_t *output);
 
 void
 wayland_shm_buffer_destroy(wayland_shm_buffer_t *buffer);
+
+char *
+string_alloc(int len);
+
+char *
+string_copy(const char *str);
+
+void
+string_free(char *str);
similarity index 94%
rename from src/modules/wayland/wayland-output.c
rename to wayland/src/wayland-output.c
index 56ce38c..83ae756 100644 (file)
@@ -1,6 +1,6 @@
 #include "wayland-internal.h"
-#include <pepper-os-compat.h>
 #include <string.h>
+#include <stdlib.h>
 #include <pepper-pixman-renderer.h>
 
 #if ENABLE_WAYLAND_BACKEND_EGL && ENABLE_GL_RENDERER
@@ -24,9 +24,6 @@ shell_surface_configure(void *data, struct wl_shell_surface *shell_surface, uint
     wayland_output_t       *output = data;
     wayland_shm_buffer_t   *buffer, *next;
 
-    PEPPER_IGNORE(shell_surface);
-    PEPPER_IGNORE(edges);
-
     output->w = w;
     output->h = h;
 
@@ -72,7 +69,7 @@ wayland_output_destroy(void *o)
     wl_surface_destroy(output->surface);
     wl_shell_surface_destroy(output->shell_surface);
 
-    pepper_free(output);
+    free(output);
 }
 
 static void
@@ -99,22 +96,18 @@ wayland_output_get_subpixel_order(void *o)
 static const char *
 wayland_output_get_maker_name(void *o)
 {
-    PEPPER_IGNORE(o);
     return maker_name;
 }
 
 static const char *
 wayland_output_get_model_name(void *o)
 {
-    PEPPER_IGNORE(o);
     return model_name;
 }
 
 static int
 wayland_output_get_mode_count(void *o)
 {
-    PEPPER_IGNORE(o);
-
     /* There's only one available mode in wayland backend which is also the current mode. */
     return 1;
 }
@@ -181,7 +174,7 @@ wayland_output_repaint(void *o)
         output->render_pre(output);
 
     /* TODO: Pass rendering data to the renderer. maybe view list? or scene graph data? */
-    output->renderer->draw(output->renderer, output->shm.current_buffer->image, NULL);
+    pepper_renderer_repaint_output(output->renderer, output->base);
 
     if (output->render_post)
         output->render_post(output);
@@ -283,7 +276,7 @@ init_pixman_renderer(wayland_output_t *output)
     wl_list_init(&output->shm.free_buffers);
     wl_list_init(&output->shm.attached_buffers);
 
-    output->renderer = pepper_pixman_renderer_create();
+    output->renderer = pepper_pixman_renderer_create(output->conn->pepper);
 
     if (output->renderer)
     {
@@ -313,10 +306,9 @@ init_renderer(wayland_output_t *output, const char *name)
 PEPPER_API pepper_output_t *
 pepper_wayland_output_create(pepper_wayland_t *conn, int32_t w, int32_t h, const char *renderer)
 {
-    pepper_output_t    *base;
     wayland_output_t   *output;
 
-    output = pepper_calloc(1, sizeof(wayland_output_t));
+    output = calloc(1, sizeof(wayland_output_t));
     if (!output)
         return NULL;
 
@@ -339,8 +331,8 @@ pepper_wayland_output_create(pepper_wayland_t *conn, int32_t w, int32_t h, const
     wl_shell_surface_set_toplevel(output->shell_surface);
 
     /* Add compositor base class output object for this output. */
-    base = pepper_compositor_add_output(conn->pepper, &wayland_output_interface, output);
-    if (!base)
+    output->base = pepper_compositor_add_output(conn->pepper, &wayland_output_interface, output);
+    if (!output->base)
     {
         wayland_output_destroy(output);
         return NULL;
@@ -359,5 +351,5 @@ pepper_wayland_output_create(pepper_wayland_t *conn, int32_t w, int32_t h, const
         return NULL;
     }
 
-    return base;
+    return output->base;
 }
similarity index 59%
rename from src/modules/wayland/wayland-shm-buffer.c
rename to wayland/src/wayland-shm-buffer.c
index 7248298..6edab3c 100644 (file)
@@ -1,8 +1,99 @@
 #include "wayland-internal.h"
-#include <pepper-os-compat.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
 
+static int
+set_cloexec_or_close(int fd)
+{
+    long flags;
+
+    if (fd == -1)
+        return -1;
+
+    flags = fcntl(fd, F_GETFD);
+    if (flags == -1)
+        goto err;
+
+    if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
+        goto err;
+
+    return fd;
+
+err:
+    close(fd);
+    return -1;
+}
+
+static int
+create_tmpfile_cloexec(char *tmpname)
+{
+    int fd;
+
+#ifdef HAVE_MKOSTEMP
+    fd = mkostemp(tmpname, O_CLOEXEC);
+    if (fd >= 0)
+        unlink(tmpname);
+#else
+    fd = mkstemp(tmpname);
+    if (fd >= 0) {
+        fd = set_cloexec_or_close(fd);
+        unlink(tmpname);
+    }
+#endif
+
+    return fd;
+}
+
+int
+create_anonymous_file(off_t size)
+{
+    static const char template[] = "/pepper-shared-XXXXXX";
+    const char *path;
+    char *name;
+    int fd;
+    int ret;
+
+    path = getenv("XDG_RUNTIME_DIR");
+    if (!path) {
+        errno = ENOENT;
+        return -1;
+    }
+
+    name = malloc(strlen(path) + sizeof(template));
+    if (!name)
+        return -1;
+
+    strcpy(name, path);
+    strcat(name, template);
+
+    fd = create_tmpfile_cloexec(name);
+
+    free(name);
+
+    if (fd < 0)
+        return -1;
+
+#ifdef HAVE_POSIX_FALLOCATE
+    ret = posix_fallocate(fd, 0, size);
+    if (ret != 0) {
+        close(fd);
+        errno = ret;
+        return -1;
+    }
+#else
+    ret = ftruncate(fd, size);
+    if (ret < 0) {
+        close(fd);
+        return -1;
+    }
+#endif
+
+    return fd;
+}
 static void
 buffer_release(void *data, struct wl_buffer *buf)
 {
@@ -33,7 +124,7 @@ wayland_shm_buffer_create(wayland_output_t *output)
     int                     fd;
     struct wl_shm_pool     *pool;
 
-    buffer = pepper_calloc(1, sizeof(wayland_shm_buffer_t));
+    buffer = calloc(1, sizeof(wayland_shm_buffer_t));
     if (!buffer)
         return NULL;
 
@@ -45,7 +136,7 @@ wayland_shm_buffer_create(wayland_output_t *output)
     buffer->stride  = buffer->w * 4;
     buffer->size    = buffer->stride * buffer->h;
 
-    fd = pepper_create_anonymous_file(buffer->size);
+    fd = create_anonymous_file(buffer->size);
 
     if (fd < 0)
     {
@@ -78,7 +169,7 @@ error:
         close(fd);
 
     if (buffer)
-        pepper_free(buffer);
+        free(buffer);
 
     return NULL;
 }
diff --git a/x11/Makefile.am b/x11/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/x11/autogen.sh b/x11/autogen.sh
new file mode 100755 (executable)
index 0000000..916169a
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/x11/configure.ac b/x11/configure.ac
new file mode 100644 (file)
index 0000000..2b58c70
--- /dev/null
@@ -0,0 +1,33 @@
+m4_define([pepper_x11_major], 0)
+m4_define([pepper_x11_minor], 0)
+m4_define([pepper_x11_micro], 0)
+
+m4_define([pepper_x11_version], [pepper_x11_major.pepper_x11_minor.pepper_x11_micro])
+
+AC_PREREQ([2.64])
+AC_INIT([pepper_x11], [pepper_x11_version], [tkq.kim@samsung.com])
+
+AC_SUBST([PEPPER_X11_VERSION_MAJOR], [pepper_x11_major_version])
+AC_SUBST([PEPPER_X11_VERSION_MINOR], [pepper_x11_minor_version])
+AC_SUBST([PEPPER_X11_VERSION_MICRO], [pepper_x11_micro_version])
+AC_SUBST([PEPPER_X11_VERSION], [pepper_x11_version])
+
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+PEPPER_X11_MODULES="pepper pepper-render x11 xcb-shm x11-xcb wayland-server pixman-1"
+PKG_CHECK_MODULES(PEPPER_X11, [$PEPPER_X11_MODULES])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/pepper-x11.pc
+])
+
+AC_OUTPUT
diff --git a/x11/src/Makefile.am b/x11/src/Makefile.am
new file mode 100644 (file)
index 0000000..504bf37
--- /dev/null
@@ -0,0 +1,14 @@
+lib_LTLIBRARIES = libpepper-x11.la
+include_HEADERS = pepper-x11.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-x11.pc
+
+libpepper_x11_la_CFLAGS = $(PEPPER_X11_CFLAGS) -Wall
+libpepper_x11_la_LIBADD = $(PEPPER_X11_LIBS)
+
+libpepper_x11_la_SOURCES =  pepper-x11.h    \
+                            x11-internal.h  \
+                            x11-common.c    \
+                            x11-output.c    \
+                            x11-input.c
diff --git a/x11/src/pepper-x11.pc.in b/x11/src/pepper-x11.pc.in
new file mode 100644 (file)
index 0000000..c5e533d
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+libexecdir=@libexecdir@
+pkglibexecdir=${libexecdir}/@PACKAGE@
+
+Name: Pepper X11 Backend Library
+Description: Pepper x11 backend library header and library files
+Version: @PEPPER_X11_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lpepper-x11
similarity index 96%
rename from src/modules/x11/x11-common.c
rename to x11/src/x11-common.c
index 8951177..bf48d97 100644 (file)
@@ -1,7 +1,5 @@
 #include <wayland-server.h>
-#include <common.h>
 #include "x11-internal.h"
-#include "pepper-internal.h"
 
 #include <stdlib.h>
 
@@ -195,7 +193,7 @@ pepper_x11_connect(pepper_compositor_t *compositor, const char *display_name)
         return NULL;
     }
 
-    connection = (pepper_x11_connection_t *)pepper_calloc(1, sizeof(pepper_x11_connection_t));
+    connection = (pepper_x11_connection_t *)calloc(1, sizeof(pepper_x11_connection_t));
     if (!connection)
     {
         PEPPER_ERROR("Memory allocation failed\n");
@@ -206,7 +204,7 @@ pepper_x11_connect(pepper_compositor_t *compositor, const char *display_name)
     if (!connection->display)
     {
         PEPPER_ERROR("XOpenDisplay failed\n");
-        pepper_free(connection);
+        free(connection);
         return NULL;
     }
 
@@ -216,7 +214,7 @@ pepper_x11_connect(pepper_compositor_t *compositor, const char *display_name)
     if (xcb_connection_has_error(connection->xcb_connection))
     {
         PEPPER_ERROR("xcb connection has error\n");
-        pepper_free(connection);
+        free(connection);
         return NULL;
     }
 
@@ -226,7 +224,7 @@ pepper_x11_connect(pepper_compositor_t *compositor, const char *display_name)
     connection->compositor = compositor;
     connection->fd = xcb_get_file_descriptor(connection->xcb_connection);
     if (display_name)
-        connection->display_name = pepper_string_copy(display_name);
+        connection->display_name = strdup(display_name);
     else
         connection->display_name = NULL;
 
similarity index 97%
rename from src/modules/x11/x11-cursor.c
rename to x11/src/x11-cursor.c
index f96057f..1e8ea9a 100644 (file)
@@ -1,4 +1,5 @@
-
+#include "x11-internal.h"
+#include <stdlib.h>
 
 static void *
 x11_output_cursor_set(void *o, void *c)
@@ -63,7 +64,7 @@ x11_output_cursor_create(void *output, int32_t w, int32_t h, void *image)
         return NULL;
     }
 
-    cursor = pepper_calloc(1, sizeof(x11_cursor_t));
+    cursor = calloc(1, sizeof(x11_cursor_t));
     if (!cursor)
     {
         PEPPER_ERROR("x11:cursor: memory allocation failed");
@@ -129,5 +130,5 @@ x11_output_cursor_destroy(void *o, void *c)
 
     xcb_free_cursor(conn, cursor->xcb_cursor);
     /* XXX: pepper_free(cursor->data); ??? */
-    pepper_free(cursor);
+    free(cursor);
 }
similarity index 99%
rename from src/modules/x11/x11-input.c
rename to x11/src/x11-input.c
index 8f236f7..db69537 100644 (file)
@@ -172,7 +172,7 @@ pepper_x11_seat_create(pepper_x11_connection_t* conn)
         return ;
     }
 
-    seat = pepper_calloc(1, sizeof(x11_seat_t));
+    seat = calloc(1, sizeof(x11_seat_t));
     if (!seat)
     {
         PEPPER_ERROR("failed to allocate memory\n");
@@ -199,4 +199,3 @@ pepper_x11_seat_create(pepper_x11_connection_t* conn)
     /* x-connection has only 1 seat */
     conn->seat = seat;
 }
-
similarity index 97%
rename from src/modules/x11/x11-internal.h
rename to x11/src/x11-internal.h
index ea7d1ed..ab1fe00 100644 (file)
@@ -3,16 +3,20 @@
 
 #include "pepper-x11.h"
 
-#include <common.h>
 #include <xcb/xcb.h>
 #include <xcb/shm.h>
 #include <X11/Xlib.h>
 #include <X11/Xlib-xcb.h>
 #include <string.h>
 #include <pixman.h>
+#include <pepper-render.h>
 
 #define X11_BACKEND_INPUT_ID    0x12345678
 
+/* TODO: Error logging. */
+#define PEPPER_ERROR(...)
+#define PEPPER_ASSERT(exp)
+
 typedef struct x11_output       x11_output_t;
 typedef struct x11_cursor       x11_cursor_t;
 typedef struct x11_seat         x11_seat_t;
similarity index 97%
rename from src/modules/x11/x11-output.c
rename to x11/src/x11-output.c
index 87fe6c4..a1a6ef0 100644 (file)
@@ -238,7 +238,6 @@ x11_shm_init(x11_output_t *output)
 
     output->depth = xcb_depth_get(scr_iter.data,
                                   scr_iter.data->root_visual);
-    PEPPER_TRACE("Visual depth is %d\n", output->depth);
 
     fmt_iter = xcb_setup_pixmap_formats_iterator(xcb_get_setup(xcb_conn));
     for (; fmt_iter.rem; xcb_format_next(&fmt_iter))
@@ -250,7 +249,6 @@ x11_shm_init(x11_output_t *output)
         }
     }
     output->bpp = bpp;
-    PEPPER_TRACE("Found format for depth %d, bpp: %d\n", output->depth, bpp);
 
     /* Init x11_shm_image */
     if (!x11_shm_image_init(&output->shm, xcb_conn, output->w, output->h, bpp))
@@ -276,7 +274,7 @@ pixman_renderer_init(x11_output_t *output)
     }
 
     /* Create pixman renderer */
-    output->renderer = pepper_pixman_renderer_create();
+    output->renderer = pepper_pixman_renderer_create(output->connection->compositor);
     if (!output->renderer)
     {
         PEPPER_ERROR("pixman_renderer_create failed\n");
@@ -327,7 +325,7 @@ x11_output_destroy(void *o)
 
     xcb_flush(conn->xcb_connection);
 
-    pepper_free(output);
+    free(output);
 }
 
 static int32_t
@@ -340,22 +338,18 @@ x11_output_get_subpixel_order(void *o)
 static const char *
 x11_output_get_maker_name(void *o)
 {
-    PEPPER_IGNORE(o);
     return "PePPer_x11";
 }
 
 static const char *
 x11_output_get_model_name(void *o)
 {
-    PEPPER_IGNORE(o);
     return "PePPer_x11";
 }
 
 static int
 x11_output_get_mode_count(void *o)
 {
-    PEPPER_IGNORE(o);
-
     /* There's only one available mode in x11 backend which is also the current mode. */
     return 1;
 }
@@ -500,7 +494,7 @@ x11_output_repaint(void *o)
 {
     x11_output_t *output = o;
 
-    output->renderer->draw(output->renderer, output->shm.image, NULL);
+    pepper_renderer_repaint_output(output->renderer, output->base);
 
     /* FIXME: hack, only pixman-render use shm.image */
     if (output->shm.image)
@@ -562,7 +556,7 @@ pepper_x11_output_create(pepper_x11_connection_t *connection,
     struct wl_display       *wldisplay;
     struct wl_event_loop    *loop;
 
-    output = pepper_calloc(1, sizeof(x11_output_t));
+    output = calloc(1, sizeof(x11_output_t));
     if (!output)
     {
         PEPPER_ERROR("memory allocation failed");