*.so
*.pc
*.in
+!*.pc.in
aclocal.m4
autom4te.cache/
config.guess
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
+++ /dev/null
-SUBDIRS = shared src test
+++ /dev/null
-# -*- 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
--- /dev/null
+SUBDIRS = src
--- /dev/null
+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
--- /dev/null
+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
#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
--- /dev/null
+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
#include "desktop-shell-internal.h"
+#include <stdlib.h>
static void
remove_ping_timer(shell_surface_t *shsurf)
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;
#include "desktop-shell-internal.h"
+#include <stdlib.h>
shell_t *
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);
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+bin_PROGRAMS = doctor
+doctor_CFLAGS = $(DOCTOR_CFLAGS) -Wall
+doctor_LDADD = $(DOCTOR_LIBS)
+doctor_SOURCES = server.c
-#include "../common.h"
#include <pepper.h>
int
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+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
#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__);
}
if (drm->crtcs)
- pepper_free(drm->crtcs);
+ free(drm->crtcs);
if (drm->drm_fd)
close(drm->drm_fd);
if (drm->udev)
udev_unref(drm->udev);
- pepper_free(drm);
+ free(drm);
return;
}
#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;
fini_renderer(output);
if (output->modes)
- pepper_free(output->modes);
+ free(output->modes);
- pepper_free(output);
+ free(output);
}
static void
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";
}
if (fb->id)
drmModeRmFB(fb->fd, fb->id);
- pepper_free(fb);
+ free(fb);
}
static drm_fb_t *
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__);
{
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)
{
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
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__);
drmIoctl(drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg);
err_fb:
- pepper_free(fb);
+ free(fb);
return NULL;
}
destroy_arg.handle = fb->handle;
drmIoctl(fb->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg);
- pepper_free(fb);
+ free(fb);
}
static void
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 */
}
}
- 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__);
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);
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__);
/* 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)
{
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__);
--- /dev/null
+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
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+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
#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
wl_list_remove(&seat->link);
if (seat->name)
- pepper_string_free(seat->name);
+ free(seat->name);
- pepper_free(seat);
+ free(seat);
}
static void
{
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__);
error:
if (seat)
- pepper_free(seat);
+ free(seat);
return NULL;
}
if (!seat->name)
{
- seat->name = pepper_string_copy(seat_name);
+ seat->name = strdup(seat_name);
wl_signal_emit(&seat->name_signal, seat);
}
}
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__);
if (input->libinput_event_source)
wl_event_source_remove(input->libinput_event_source);
- pepper_free(input);
+ free(input);
}
--- /dev/null
+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
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
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
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
%make_install
%files
-%{_bindir}/pepper
+%{_libdir}/libpepper.so*
%post
--- /dev/null
+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
}
}
-void
+PEPPER_API void
pepper_output_schedule_repaint(pepper_output_t *output)
{
struct wl_event_loop *loop;
};
void
-pepper_output_schedule_repaint(pepper_output_t *output);
-
-void
pepper_output_repaint(pepper_output_t *output);
struct pepper_buffer
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;
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
{
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);
--- /dev/null
+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
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+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
#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;
struct gl_renderer
{
pepper_renderer_t base;
- pepper_compositor_t *compositor;
void *native_display;
void *native_window;
};
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. */
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
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;
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;
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)
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;
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);
if (!buffer)
{
+ *w = 0;
+ *h = 0;
+
surface_state_release_buffer(state);
- return;
+ return PEPPER_FALSE;
}
surface_state_destroy_images(state);
/* Assert not reached. */
PEPPER_ASSERT(PEPPER_FALSE);
- return;
+ return PEPPER_FALSE;
done:
pepper_buffer_reference(buffer);
/* Output buffer size info. */
*w = state->buffer_width;
*h = state->buffer_height;
+
+ return PEPPER_TRUE;
}
static void
/* 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;
}
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)
{
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
{
#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
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
}
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);
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;
}
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;
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);
{
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;
}
}
- pepper_free(configs);
+ free(configs);
configs = NULL;
if (!config)
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;
eglTerminate(display);
if (configs)
- pepper_free(configs);
+ free(configs);
return PEPPER_FALSE;
}
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))
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;
}
#ifndef PEPPER_GL_RENDERER_H
#define PEPPER_GL_RENDERER_H
-#include "pepper.h"
+#include <pepper-render.h>
#ifdef __cplusplus
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
}
--- /dev/null
+#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 */
--- /dev/null
+#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 */
--- /dev/null
+#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 */
--- /dev/null
+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
#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;
struct pixman_renderer
{
pepper_renderer_t base;
+ pixman_image_t *target;
};
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)
}
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. */
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
if (!state)
{
- state = pepper_calloc(1, sizeof(pixman_surface_state_t));
+ state = calloc(1, sizeof(pixman_surface_state_t));
if (!state)
return NULL;
format = PIXMAN_r5g6b5;
break;
default:
- PEPPER_ERROR("Unknown shm buffer format.\n");
return PEPPER_FALSE;
}
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)
{
if (!buffer)
{
+ *w = 0;
+ *h = 0;
+
surface_state_release_buffer(state);
- return;
+ return PEPPER_TRUE;
}
if (surface_state_attach_shm(state, buffer))
/* 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);
/* 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;
+}
--- /dev/null
+#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);
+}
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+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
#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)
{ /* for gdb attach */
char cc;
- scanf("%c", &cc);
+ int ret;
+
+ ret = scanf("%c", &cc);
}
compositor = pepper_compositor_create("wayland-0");
#include <signal.h>
#include <wayland-client.h>
-#include "../shared/pepper-os-compat.h"
+#include <pepper-utils.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <wayland-client.h>
-#include "../shared/pepper-os-compat.h"
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
#include <pepper.h>
#include <pepper-wayland.h>
-#include <common.h>
+
+/* TODO: */
+#define PEPPER_ASSERT(exp)
int
main(int argc, char **argv)
#include <pepper.h>
#include <pepper-x11.h>
-#include <common.h>
+
+/* TODO: */
+#define PEPPER_ASSERT(exp)
int
main(int argc, char **argv)
+++ /dev/null
-noinst_LTLIBRARIES = libshared.la
-libshared_la_SOURCES = pepper-os-compat.h \
- pepper-os-compat.c
+++ /dev/null
-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
+++ /dev/null
-#include "pepper-internal.h"
+++ /dev/null
-#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 */
+++ /dev/null
-#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);
-}
+++ /dev/null
-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)
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+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
#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 */
--- /dev/null
+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
-#include "pepper-os-compat.h"
+#include "pepper-utils.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
return fd;
}
-int
+PEPPER_API int
pepper_create_anonymous_file(off_t size)
{
static const char template[] = "/pepper-shared-XXXXXX";
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
#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,
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 =
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);
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);
if (conn->shell)
wl_shell_destroy(conn->shell);
+
+ free(conn);
}
#include "wayland-internal.h"
+#include <stdlib.h>
static void
pointer_handle_enter(void *data, struct wl_pointer *pointer,
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
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
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
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 =
if (seat->seat != s) /* FIXME */
return;
- seat->name = pepper_string_copy(name);
+ seat->name = string_copy(name);
wl_signal_emit(&seat->name_signal, seat);
}
{
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__);
#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;
struct wayland_output
{
pepper_wayland_t *conn;
+ pepper_output_t *base;
struct wl_signal destroy_signal;
struct wl_signal mode_change_signal;
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);
#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
wayland_output_t *output = data;
wayland_shm_buffer_t *buffer, *next;
- PEPPER_IGNORE(shell_surface);
- PEPPER_IGNORE(edges);
-
output->w = w;
output->h = h;
wl_surface_destroy(output->surface);
wl_shell_surface_destroy(output->shell_surface);
- pepper_free(output);
+ free(output);
}
static void
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;
}
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);
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)
{
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;
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;
return NULL;
}
- return base;
+ return output->base;
}
#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)
{
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;
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)
{
close(fd);
if (buffer)
- pepper_free(buffer);
+ free(buffer);
return NULL;
}
--- /dev/null
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
#include <wayland-server.h>
-#include <common.h>
#include "x11-internal.h"
-#include "pepper-internal.h"
#include <stdlib.h>
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");
if (!connection->display)
{
PEPPER_ERROR("XOpenDisplay failed\n");
- pepper_free(connection);
+ free(connection);
return NULL;
}
if (xcb_connection_has_error(connection->xcb_connection))
{
PEPPER_ERROR("xcb connection has error\n");
- pepper_free(connection);
+ free(connection);
return NULL;
}
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;
-
+#include "x11-internal.h"
+#include <stdlib.h>
static void *
x11_output_cursor_set(void *o, void *c)
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");
xcb_free_cursor(conn, cursor->xcb_cursor);
/* XXX: pepper_free(cursor->data); ??? */
- pepper_free(cursor);
+ free(cursor);
}
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");
/* x-connection has only 1 seat */
conn->seat = seat;
}
-
#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;
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))
}
}
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))
}
/* 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");
xcb_flush(conn->xcb_connection);
- pepper_free(output);
+ free(output);
}
static int32_t
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;
}
{
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)
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");