AC_ARG_WITH(bufmgr-module-path, AS_HELP_STRING([--with-bufmgr-module-path=PATH], [tbm bufmgr module dir]),
[ BUFMGR_MODULE_PATH="$withval" ],
[ BUFMGR_MODULE_PATH="${DEFAULT_BUFMGR_MODULE_PATH}" ])
+
+# set the window system platform where the bufmgr initializes
+AC_ARG_WITH(tbm-platform, AS_HELP_STRING([--with-tbm-platform=WINSYS], [tbm platform (default: X11)]),
+ [ TBM_PLATFORM="$withval" ],
+ [ TBM_PLATFORM="X11" ])
+AC_SUBST(TBM_PLATFORM)
+
#AC_DEFINE(BUFMGR_MODULE_DIR, "${BUFMGR_MODULE_PATH}", [Directory for the modules of tbm_bufmgr])
AC_DEFINE_UNQUOTED(BUFMGR_MODULE_DIR, "${BUFMGR_MODULE_PATH}", [Directory for the modules of tbm_bufmgr])
AC_SUBST(LIBTBM_CFLAGS)
AC_SUBST(LIBTBM_LIBS)
+if test "x$TBM_PLATFORM" = "xX11"; then
+ AC_DEFINE(HAVE_X11,1,[The window system is X11.])
+else
+ AC_DEFINE(HAVE_WAYLAND,1,[The window system is WAYLAND.])
+fi
+
AC_OUTPUT([
src/Makefile
drm_slp/Makefile
echo "LIBTBM_CFLAGS : $LIBTBM_CFLAGS"
echo "LIBTBM_LIBS : $LIBTBM_LIBS"
echo "BUFMGR_MODULE_DIR : $BUFMGR_MODULE_PATH"
+echo "TBM_PLATFORM : $TBM_PLATFORM"
echo ""
+#%bcond_with x
+%bcond_with wayland
+
Name: libtbm
Version: 1.1.0
Release: 3
BuildRequires: pkgconfig(pthread-stubs)
BuildRequires: pkgconfig(libdrm)
+%if %{with wayland}
+%else
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(libdri2)
+%endif
BuildRequires: pkgconfig(capi-base-common)
%description
%build
-%reconfigure --prefix=%{_prefix} \
+%if %{with wayland}
+%reconfigure --prefix=%{_prefix} --with-tbm-platform=WAYLAND \
+ CFLAGS="${CFLAGS} -Wall -Werror" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
+%else
+%reconfigure --prefix=%{_prefix} --with-tbm-platform=X11 \
CFLAGS="${CFLAGS} -Wall -Werror" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
+%endif
make %{?_smp_mflags}
%defattr(-,root,root,-)
/usr/share/license/%{name}
%{_libdir}/libtbm.so.*
+%if %{with wayland}
+%else
%{_libdir}/libdrm_slp.so.*
+%endif
%files devel
%defattr(-,root,root,-)
%{_includedir}/tbm_bufmgr_backend.h
%{_includedir}/tbm_type.h
%{_libdir}/libtbm.so
+%if %{with wayland}
+%else
%{_libdir}/libdrm_slp.so
+%endif
%{_libdir}/pkgconfig/libtbm.pc
#include "tbm_bufmgr_backend.h"
#include "tbm_bufmgr_tgl.h"
#include "list.h"
+#ifdef HAVE_X11
#include <X11/Xmd.h>
#include <dri2.h>
#include <xf86drm.h>
+#endif
#define DEBUG
#ifdef DEBUG
return ret;
}
+#ifdef HAVE_X11
static int
-_tbm_bufmgr_get_drm_fd()
+_tbm_bufmgr_get_drm_fd_x11()
{
int screen;
Display *display;
XCloseDisplay(display);
return fd;
}
+#endif
tbm_bufmgr
tbm_bufmgr_init (int fd)
if (fd < 0)
{
- fd = _tbm_bufmgr_get_drm_fd();
+#ifdef HAVE_X11
+ fd = _tbm_bufmgr_get_drm_fd_x11();
+#endif
if (fd < 0)
{
TBM_LOG ("[libtbm:%d] Fail get drm fd\n", getpid());