+++ /dev/null
-SRC_DIR = ./src
-SO_NAME = libgbm.so.$(major_ver)
-BIN_NAME = $(SO_NAME).$(minor_ver)
-
-#CROSS_COMPILE ?= arm-none-linux-gnueabi-
-TARGET_CC ?= $(CROSS_COMPILE)gcc
-TARGET_AR ?= $(CROSS_COMPILE)ar
-CFLAGS += -Wall -ludev -fPIC
-
-#gbm backend sources
-GBM_BACKENDS_DIR = $(SRC_DIR)/backends
-
-#gbm backend module location
-CFLAGS += -DMODULEDIR='"$(libdir)/gbm"'
-
-#gbm main source
-GBM_SRCS += \
- $(SRC_DIR)/gbm.c \
- $(SRC_DIR)/common.c \
- $(SRC_DIR)/backend.c
-
-%.o: %.c
- $(TARGET_CC) -c -o $@ $< $(CFLAGS)
-
-GBM_OBJS := $(GBM_SRCS:.c=.o)
-
-$(BIN_NAME): $(GBM_OBJS)
- $(TARGET_CC) -shared -Wl,-soname,$(SO_NAME) -o $@ $(GBM_OBJS) $(CFLAGS)
-backend:
- @for dir in $(GBM_BACKENDS_DIR) ; do \
- $(MAKE) -C $$dir ; \
- done
-
-.DEFAULT_GOAL = all
-all: $(BIN_NAME) backend
-
-clean:
- -rm -f $(GBM_OBJS) $(BIN_NAME)
- @for dir in $(GBM_BACKENDS_DIR) ; do \
- $(MAKE) $@ -C $$dir ; \
- done
-
-install: all
- cp $(SRC_DIR)/gbm.h $(includedir)/
- -mkdir $(includedir)/gbm/
- cp $(SRC_DIR)/backend.h $(includedir)/gbm/
- cp $(SRC_DIR)/common.h $(includedir)/gbm/
- cp $(SRC_DIR)/gbmint.h $(includedir)/gbm/
- cp pkgconfig/gbm.pc $(libdir)/pkgconfig/
- cp $(BIN_NAME) $(libdir)/
- @for dir in $(GBM_BACKENDS_DIR) ; do \
- $(MAKE) $@ -C $$dir ; \
- done
-
-uninstall:
- -rm -f $(includedir)/gbm.h
- -rm -f $(includedir)/gbm/backend.h
- -rm -f $(includedir)/gbm/common.h
- -rm -f $(includedir)/gbm/gbmint.h
- -rm -f $(libdir)/pkgconfig/gbm.pc
- -rm -f $(libdir)/$(BIN_NAME)
- @for dir in $(GBM_BACKENDS_DIR) ; do \
- $(MAKE) $@ -C $$dir ; \
- done
--- /dev/null
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gbm.pc
+
+AM_CFLAGS = \
+ -D_OS_UNIX=1 \
+ -DMODULEDIR='"$(libdir)/gbm"' \
+ -I$(top_srcdir)/src
+
+lib_LTLIBRARIES = libgbm.la
+include_HEADERS = src/gbm.h
+
+libgbm_la_SOURCES = \
+ src/backend.c \
+ src/backend.h \
+ src/gbm.c \
+ src/gbm.h \
+ src/gbmint.h
+
+libgbm_la_LDFLAGS = \
+ -no-undefined \
+ -version-info 1:0
+
+libgbm_la_LIBADD =
+
+libgbmincludedir=$(includedir)
+libgbminclude_HEADERS = \
+ src/gbm.h \
+ src/gbmint.h
+
+if HAVE_TBM
+libgbm_la_SOURCES += \
+ backends/tbm/gbm_tbm.c \
+ backends/tbm/gbm_tbmint.h
+
+AM_CFLAGS += \
+ $(TBM_CFALGS)
+
+libgbm_la_LIBADD += \
+ $(TBM_LIBS)
+
+libgbmtbmincludedir=$(includedir)/gbm
+libgbmtbminclude_HEADERS = \
+ backends/tbm/gbm_tbm.h \
+ backends/tbm/gbm_tbmint.h
+
+endif
+
+CLEANFILES =
--- /dev/null
+#!/bin/sh
+
+rm -rf autom4te.cache
+rm -f aclocal.m4 ltmain.sh
+
+echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
+echo "Running autoheader..." ; autoheader || exit 1
+echo "Running autoconf..." ; autoconf || exit 1
+echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
+echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
+
+if [ -z "$NOCONFIGURE" ]; then
+ ./configure "$@"
+fi
+
--- /dev/null
+/**************************************************************************
+
+Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: Sangjin Lee <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+#include <limits.h>
+
+#include "gbm_tbmint.h"
+#include <tbm_surface_internal.h>
+#include <wayland-tbm-server.h>
+
+GBM_EXPORT tbm_bo
+gbm_tbm_bo_get_tbm_bo(struct gbm_tbm_bo *bo)
+{
+ tbm_bo tbo;
+ tbo = tbm_surface_internal_get_bo(bo->tbm_surf, 0);
+ return tbo;
+}
+
+GBM_EXPORT uint32_t
+gbm_tbm_surface_get_width(struct gbm_tbm_surface *surf)
+{
+ return surf->base.width;
+}
+
+GBM_EXPORT uint32_t
+gbm_tbm_surface_get_height(struct gbm_tbm_surface *surf)
+{
+ return surf->base.height;
+}
+
+GBM_EXPORT uint32_t
+gbm_tbm_surface_get_format(struct gbm_tbm_surface *surf)
+{
+ return surf->base.format;
+}
+
+GBM_EXPORT uint32_t
+gbm_tbm_surface_get_flags(struct gbm_tbm_surface *surf)
+{
+ return surf->base.flags;
+}
+
+GBM_EXPORT void
+gbm_tbm_surface_set_user_data(struct gbm_tbm_surface *surf, void *data)
+{
+ surf->tbm_private = data;
+}
+
+GBM_EXPORT void *
+gbm_tbm_surface_get_user_data(struct gbm_tbm_surface *surf)
+{
+ return surf->tbm_private;
+}
+
+GBM_EXPORT void
+gbm_tbm_device_set_callback_surface_has_free_buffers(struct gbm_tbm_device *gbm_tbm, int (*callback)(struct gbm_surface *))
+{
+ gbm_tbm->base.surface_has_free_buffers = callback;
+}
+
+GBM_EXPORT void
+gbm_tbm_device_set_callback_surface_lock_front_buffer(struct gbm_tbm_device *gbm_tbm, struct gbm_bo *(*callback)(struct gbm_surface *))
+{
+ gbm_tbm->base.surface_lock_front_buffer = callback;
+}
+
+GBM_EXPORT void
+gbm_tbm_device_set_callback_surface_release_buffer(struct gbm_tbm_device *gbm_tbm, void (*callback)(struct gbm_surface *, struct gbm_bo *))
+{
+ gbm_tbm->base.surface_release_buffer = callback;
+}
+
+static int
+__gbm_tbm_is_format_supported(struct gbm_device *gbm,
+ uint32_t format,
+ uint32_t usage)
+{
+ switch (format)
+ {
+ case GBM_BO_FORMAT_XRGB8888:
+ case GBM_FORMAT_XRGB8888:
+ break;
+ case GBM_BO_FORMAT_ARGB8888:
+ case GBM_FORMAT_ARGB8888:
+ if (usage & GBM_BO_USE_SCANOUT)
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+
+ if (usage & GBM_BO_USE_CURSOR_64X64 &&
+ usage & GBM_BO_USE_RENDERING)
+ return 0;
+
+ return 1;
+}
+
+static int
+__gbm_tbm_bo_write(struct gbm_bo *_bo, const void *buf, size_t count)
+{
+ struct gbm_tbm_bo *bo = gbm_tbm_bo(_bo);
+ tbm_surface_info_s info;
+
+ if (TBM_SURFACE_ERROR_NONE == tbm_surface_map(bo->tbm_surf, TBM_OPTION_WRITE, &info))
+ {
+ memcpy(info.planes[0].ptr, buf, count);
+ tbm_surface_unmap(bo->tbm_surf);
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+__gbm_tbm_bo_get_fd(struct gbm_bo *_bo)
+{
+ struct gbm_tbm_bo *bo = gbm_tbm_bo(_bo);
+ tbm_bo tbo;
+ tbm_bo_handle handle;
+
+ tbo = tbm_surface_internal_get_bo(bo->tbm_surf, 0);
+ if (!tbo)
+ {
+ fprintf(stderr, "%s::tbm_surface_internal_get_bo() failed.\n", __FUNCTION__);
+ return 0;
+ }
+ handle = tbm_bo_get_handle(tbo, TBM_DEVICE_MM);
+
+ return handle.s32;
+}
+
+static void
+__gbm_tbm_bo_destroy(struct gbm_bo *_bo)
+{
+ struct gbm_tbm_bo *bo = gbm_tbm_bo(_bo);
+
+ if(bo->tbm_surf)
+ {
+ tbm_surface_destroy(bo->tbm_surf);
+ bo->tbm_surf = NULL;
+ }
+
+ free(bo);
+}
+
+struct gbm_bo *
+__gbm_tbm_bo_import(struct gbm_device *gbm, uint32_t type,
+ void *buffer, uint32_t usage)
+{
+ struct gbm_tbm_bo *bo;
+ tbm_surface_h tbm_surf = NULL;
+ tbm_bo tbo;
+ tbm_bo_handle handle;
+ uint32_t size, offset, stride;
+
+ bo = calloc(1, sizeof *bo);
+ if (bo == NULL)
+ return NULL;
+
+ switch (type)
+ {
+ case GBM_BO_IMPORT_WL_BUFFER:
+ tbm_surf = wayland_tbm_server_get_surface(NULL, (struct wl_resource*)buffer);
+ tbo = tbm_surface_internal_get_bo(tbm_surf, 0);
+ break;
+ default:
+ free(bo);
+ return NULL;
+ }
+
+ if (!tbm_surf)
+ {
+ free(bo);
+ return NULL;
+ }
+
+ tbm_surface_internal_get_plane_data(tbm_surf, 0, &size, &offset, &stride);
+ bo->base.gbm = gbm;
+ bo->base.width = tbm_surface_get_width(tbm_surf);
+ bo->base.height = tbm_surface_get_height(tbm_surf);
+ bo->base.format = tbm_surface_get_format(tbm_surf);
+ bo->base.stride = stride;
+ bo->usage = usage;
+
+ handle = tbm_bo_get_handle(tbo, TBM_DEVICE_DEFAULT);
+ bo->base.handle.u64 = handle.u64;
+
+ return &bo->base;
+}
+
+static struct gbm_bo *
+__gbm_tbm_bo_create(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t usage)
+{
+ struct gbm_tbm_bo *bo;
+ uint32_t size, offset, pitch;
+ int flags = TBM_BO_DEFAULT;
+ int surface_format;
+ tbm_bo_handle handle;
+ tbm_bo tbo;
+
+ bo = calloc(1, sizeof *bo);
+ if (bo == NULL)
+ return NULL;
+
+ bo->base.gbm = gbm;
+ bo->base.width = width;
+ bo->base.height = height;
+ bo->base.format = format;
+ bo->usage = usage;
+
+ switch (format)
+ {
+ case GBM_FORMAT_RGB565:
+ surface_format = TBM_FORMAT_BGR565;
+ break;
+ case GBM_FORMAT_XRGB8888:
+ case GBM_BO_FORMAT_XRGB8888:
+ surface_format = TBM_FORMAT_XRGB8888;
+ break;
+ case GBM_FORMAT_ARGB8888:
+ case GBM_BO_FORMAT_ARGB8888:
+ case GBM_FORMAT_ABGR8888:
+ surface_format = TBM_FORMAT_ABGR8888;
+ break;
+ default:
+ free(bo);
+ return NULL;
+ }
+
+ if ((usage & GBM_BO_USE_SCANOUT) || (usage & GBM_BO_USE_CURSOR_64X64))
+ {
+ flags |= TBM_BO_SCANOUT;
+ }
+
+ bo->tbm_surf = tbm_surface_internal_create_with_flags(width, height, surface_format, flags);
+ if (!bo->tbm_surf)
+ {
+ free(bo);
+ return NULL;
+ }
+
+ if (!tbm_surface_internal_get_plane_data(bo->tbm_surf, 0, &size, &offset, &pitch))
+ {
+ tbm_surface_destroy(bo->tbm_surf);
+ free(bo);
+ return NULL;
+ }
+
+ bo->base.stride = pitch;
+ tbo = tbm_surface_internal_get_bo(bo->tbm_surf, 0);
+ handle = tbm_bo_get_handle(tbo, TBM_DEVICE_DEFAULT);
+ bo->base.handle.u64 = handle.u64;
+
+ return &bo->base;
+}
+
+static struct gbm_surface *
+__gbm_tbm_surface_create(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t flags)
+{
+ struct gbm_tbm_surface *surf;
+
+ surf = calloc(1, sizeof *surf);
+ if (surf == NULL)
+ return NULL;
+
+ surf->base.gbm = gbm;
+ surf->base.width = width;
+ surf->base.height = height;
+ surf->base.format = format;
+ surf->base.flags = flags;
+
+ return &surf->base;
+}
+
+static void
+__gbm_tbm_surface_destroy(struct gbm_surface *_surf)
+{
+ struct gbm_tbm_surface *surf = gbm_tbm_surface(_surf);
+
+ free(surf);
+}
+
+static void
+__tbm_destroy(struct gbm_device *gbm)
+{
+ struct gbm_tbm_device *dri = gbm_tbm_device(gbm);
+
+ if (dri->bufmgr)
+ tbm_bufmgr_deinit(dri->bufmgr);
+
+ if (dri->driver_name)
+ free(dri->driver_name);
+
+ free(dri);
+}
+
+static struct gbm_device *
+__tbm_device_create(int fd)
+{
+ struct gbm_tbm_device *dri;
+
+ dri = calloc(1, sizeof *dri);
+
+ dri->bufmgr = tbm_bufmgr_init(fd);
+ if (dri->bufmgr == NULL)
+ goto fail;
+
+ dri->base.fd = fd;
+ dri->base.bo_create = __gbm_tbm_bo_create;
+ dri->base.bo_import = __gbm_tbm_bo_import;
+ dri->base.is_format_supported = __gbm_tbm_is_format_supported;
+ dri->base.bo_write = __gbm_tbm_bo_write;
+ dri->base.bo_get_fd = __gbm_tbm_bo_get_fd;
+ dri->base.bo_destroy = __gbm_tbm_bo_destroy;
+ dri->base.destroy = __tbm_destroy;
+ dri->base.surface_create = __gbm_tbm_surface_create;
+ dri->base.surface_destroy = __gbm_tbm_surface_destroy;
+ dri->base.name = "gbm_tbm";
+
+ return &dri->base;
+
+fail:
+ if (dri->bufmgr)
+ tbm_bufmgr_deinit(dri->bufmgr);
+
+ if (dri->driver_name)
+ free(dri->driver_name);
+
+ free(dri);
+ return NULL;
+}
+
+struct gbm_backend gbm_tbm_backend = {
+ .backend_name = "gbm_tbm",
+ .create_device = __tbm_device_create,
+};
--- /dev/null
+#ifndef _GBM_TBM_H_
+#define _GBM_TBM_H_
+
+#include <gbm.h>
+#include <tbm_bufmgr.h>
+
+struct gbm_tbm_device;
+struct gbm_tbm_bo;
+struct gbm_tbm_surface;
+
+
+void
+gbm_tbm_device_set_callback_surface_has_free_buffers(struct gbm_tbm_device *gbm_tbm, int (*callback)(struct gbm_surface *));
+
+void
+gbm_tbm_device_set_callback_surface_lock_front_buffer(struct gbm_tbm_device *gbm_tbm, struct gbm_bo *(*callback)(struct gbm_surface *));
+
+void
+gbm_tbm_device_set_callback_surface_release_buffer(struct gbm_tbm_device *gbm_tbm, void (*callback)(struct gbm_surface *, struct gbm_bo *));
+
+uint32_t
+gbm_tbm_surface_get_width(struct gbm_tbm_surface *surf);
+
+uint32_t
+gbm_tbm_surface_get_height(struct gbm_tbm_surface *surf);
+
+uint32_t
+gbm_tbm_surface_get_format(struct gbm_tbm_surface *surf);
+
+uint32_t
+gbm_tbm_surface_get_flags(struct gbm_tbm_surface *surf);
+
+void
+gbm_tbm_surface_set_user_data(struct gbm_tbm_surface *surf, void *data);
+
+void *
+gbm_tbm_surface_get_user_data(struct gbm_tbm_surface *surf);
+
+tbm_bo
+gbm_tbm_bo_get_tbm_bo(struct gbm_tbm_bo *bo);
+
+#endif
--- /dev/null
+/**************************************************************************
+
+Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: Sangjin Lee <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _GBM_TBM_INTERNAL_H_
+#define _GBM_TBM_INTERNAL_H_
+
+#include <tbm_bufmgr.h>
+#include <tbm_surface.h>
+#include "gbm_tbm.h"
+#include "gbmint.h"
+
+struct gbm_tbm_device {
+ struct gbm_device base;
+ tbm_bufmgr bufmgr;
+ char *driver_name;
+};
+
+struct gbm_tbm_bo {
+ struct gbm_bo base;
+ tbm_surface_h tbm_surf;
+ uint32_t usage;
+};
+
+struct gbm_tbm_surface {
+ struct gbm_surface base;
+ void *tbm_private;
+};
+
+static inline struct gbm_tbm_device *
+gbm_tbm_device(struct gbm_device *gbm)
+{
+ return (struct gbm_tbm_device *) gbm;
+}
+
+static inline struct gbm_tbm_bo *
+gbm_tbm_bo(struct gbm_bo *bo)
+{
+ return (struct gbm_tbm_bo *) bo;
+}
+
+static inline struct gbm_tbm_surface *
+gbm_tbm_surface(struct gbm_surface *surface)
+{
+ return (struct gbm_tbm_surface *) surface;
+}
+
+#endif
--- /dev/null
+AC_INIT(libgbm, [1.0.0], lsj119@samsung.com)
+
+AC_CONFIG_SRCDIR(configure.ac)
+AC_CONFIG_HEADERS([config.h])
+
+AM_INIT_AUTOMAKE(1.6 foreign subdir-objects)
+AM_SILENT_RULES([yes])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+PKG_CHECK_MODULES([TBM], [libtbm wayland-tbm-server], [have_tbm=yes], [have_tbm=no])
+if test x$have_tbm = xyes; then
+ AC_DEFINE([HAVE_TBM], [1], [Build the tbm backend])
+fi
+
+AM_CONDITIONAL(HAVE_TBM, test "x$have_tbm" = "xyes")
+AC_CONFIG_FILES([
+ Makefile
+ gbm.pc
+])
+AC_OUTPUT
+
Name: gbm
Description: Wayland Generic Buffer Management for TIZEN (from Mesa)
-Version: 10.2.0
-Requires.private: libudev >= 151
+Version: 1.0.0
Libs: -L${libdir} -lgbm
Libs.private: -ldl
Cflags: -I${includedir}
%define MAJOR_VER 1
-%define MINOR_VER 0s
+%define MINOR_VER 0
Summary: Wayland GBM for TIZEN
Name: libgbm
License: MIT
Source: %{name}-%{version}.tar.gz
-BuildRequires: autoconf
-BuildRequires: libtool
-BuildRequires: systemd-devel
-BuildRequires: pkgconfig(libudev)
-BuildRequires: libdrm-devel
+BuildRequires: autoconf
+BuildRequires: libtool
+BuildRequires: systemd-devel
+BuildRequires: pkgconfig(libtbm)
+BuildRequires: pkgconfig(wayland-tbm-server)
%description
Wayland Generic Buffer Management for TIZEN
%setup -q -n %{name}
%build
-make clean
+%reconfigure --disable-static
make libdir=%{_libdir} major_ver=%{MAJOR_VER} minor_ver=%{MINOR_VER}
%install
-mkdir -p %{buildroot}%{_includedir}
-mkdir -p %{buildroot}%{_libdir}/pkgconfig
-
%makeinstall major_ver=%{MAJOR_VER} minor_ver=%{MINOR_VER}
+rm -f %{buildroot}/%{_libdir}/*.la
-ln -sf libgbm.so.%{MAJOR_VER}.%{MINOR_VER} %{buildroot}%{_libdir}/libgbm.so.%{MAJOR_VER}
+ln -sf libgbm.so.%{MAJOR_VER}.%{MINOR_VER}.0 %{buildroot}%{_libdir}/libgbm.so.%{MAJOR_VER}
ln -sf libgbm.so.%{MAJOR_VER} %{buildroot}%{_libdir}/libgbm.so
%post -p /sbin/ldconfig
%defattr(-,root,root,-)
%{_libdir}/libgbm.so
%{_libdir}/libgbm.so.%{MAJOR_VER}
-%{_libdir}/libgbm.so.%{MAJOR_VER}.%{MINOR_VER}
+%{_libdir}/libgbm.so.%{MAJOR_VER}.%{MINOR_VER}.0
%files devel
%defattr(-,root,root,-)
%{_includedir}/gbm.h
+%{_includedir}/gbmint.h
%{_includedir}/gbm/*
%{_libdir}/pkgconfig/gbm.pc
#include <limits.h>
#include <dlfcn.h>
+#include "config.h"
#include "backend.h"
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
+#if HAVE_TBM
+extern const struct gbm_backend gbm_tbm_backend;
+#endif
+
struct backend_desc {
const char *name;
const struct gbm_backend *builtin;
};
static const struct backend_desc backends[] = {
- { "gbm_dri.so", NULL },
- { "gbm_gallium_drm.so", NULL },
- { "gbm_tbm.so", NULL },
+#if HAVE_TBM
+ { "gbm_tbm.so", &gbm_tbm_backend },
+#endif
};
static const void *
+++ /dev/null
-#SUBDIRS =
-
-default: subdirs
-
-subdirs:
- @for dir in $(SUBDIRS) ; do \
- $(MAKE) -C $$dir ; \
- done
-
-clean:
- @for dir in $(SUBDIRS) ; do \
- $(MAKE) $@ -C $$dir ; \
- done
-
-install: subdirs
- @for dir in $(SUBDIRS) ; do \
- $(MAKE) $@ -C $$dir ; \
- done
-
-uninstall:
- @for dir in $(SUBDIRS) ; do \
- $(MAKE) $@ -C $$dir ; \
- done
+++ /dev/null
-/*
- * Copyright © 2011 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Benjamin Franzke <benjaminfranzke@googlemail.com>
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#include <libudev.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "gbmint.h"
-
-GBM_EXPORT struct udev_device *
-_gbm_udev_device_new_from_fd(struct udev *udev, int fd)
-{
- struct udev_device *device;
- struct stat buf;
-
- if (fstat(fd, &buf) < 0) {
- fprintf(stderr, "gbm: failed to stat fd %d", fd);
- return NULL;
- }
-
- device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
- if (device == NULL) {
- fprintf(stderr,
- "gbm: could not create udev device for fd %d", fd);
- return NULL;
- }
-
- return device;
-}
-
-GBM_EXPORT char *
-_gbm_fd_get_device_name(int fd)
-{
- struct udev *udev;
- struct udev_device *device;
- const char *const_device_name;
- char *device_name = NULL;
-
- udev = udev_new();
- device = _gbm_udev_device_new_from_fd(udev, fd);
- if (device == NULL)
- return NULL;
-
- const_device_name = udev_device_get_devnode(device);
- if (!const_device_name)
- goto out;
- device_name = strdup(const_device_name);
-
-out:
- udev_device_unref(device);
- udev_unref(udev);
-
- return device_name;
-}
-
-GBM_EXPORT void
-_gbm_log(const char *fmt_str, ...)
-{
-}
+++ /dev/null
-/*
- * Copyright © 2011 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Benjamin Franzke <benjaminfranzke@googlemail.com>
- */
-
-#ifndef _COMMON_H_
-#define _COMMON_H_
-
-#include <libudev.h>
-
-struct udev_device *
-_gbm_udev_device_new_from_fd(struct udev *udev, int fd);
-
-char *
-_gbm_fd_get_device_name(int fd);
-
-void
-_gbm_log(const char *fmt_str, ...);
-
-#endif
* Benjamin Franzke <benjaminfranzke@googlemail.com>
*/
-#define _BSD_SOURCE
-
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>