Skip to content

Commit

Permalink
Merge pull request xbmc#2978 from smspillaz/wayland-gsoc-1
Browse files Browse the repository at this point in the history
Implement support for display on Wayland compositors
  • Loading branch information
MartijnKaijser committed Oct 11, 2013
2 parents c2b4713 + 96102bf commit 9c9fdb3
Show file tree
Hide file tree
Showing 95 changed files with 10,989 additions and 50 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ lib/cmyth/Makefile
/xbmc/guilib/Profile
/xbmc/guilib/Profile_FastCap

# /xbmc/input
/xbmc/input/linux/Makefile

# /xbmc/interfaces/
/xbmc/interfaces/Makefile
/xbmc/interfaces/python/Makefile
Expand Down Expand Up @@ -722,6 +725,14 @@ lib/cmyth/Makefile
# no longer used
/xbmc/win32/git_rev.h

# /xbmc/windowing/
/xbmc/windowing/Makefile
/xbmc/windowing/egl/Makefile
/xbmc/windowing/tests/wayland/xbmc_wayland_test_client_protocol.h
/xbmc/windowing/tests/wayland/xbmc_wayland_test_protocol.c
/xbmc/windowing/tests/wayland/xbmc_wayland_test_server_protocol.h
/xbmc/windowing/tests/wayland/Makefile

# /lib/ffmpeg/
/lib/ffmpeg/config.h
/lib/ffmpeg/config.err
Expand Down
18 changes: 14 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,20 @@ CHECK_LIBS = xbmc/filesystem/test/filesystemTest.a \
xbmc/utils/test/utilsTest.a \
xbmc/threads/test/threadTest.a \
xbmc/interfaces/python/test/pythonSwigTest.a \
xbmc/windowing/tests/wayland/test_wayland.a \
xbmc/test/xbmc-test.a

ifeq (@USE_WAYLAND_TEST_EXTENSION@,1)
WAYLAND_TEST_MODULE = xbmc/windowing/tests/wayland/xbmc-wayland-test-extension.so
$(WAYLAND_TEST_MODULE): force
$(MAKE) -C $(@D) $(@F)
CHECK_EXTENSIONS = $(WAYLAND_TEST_MODULE)
CHECK_LIBADD=@WAYLAND_TEST_LIBS@
endif

CHECK_PROGRAMS = xbmc-test

CLEAN_FILES += $(CHECK_PROGRAMS)
CLEAN_FILES += $(CHECK_PROGRAMS) $(CHECK_EXTENSIONS)

all : $(FINAL_TARGETS)
@echo '-----------------------'
Expand Down Expand Up @@ -674,7 +684,7 @@ ifeq (1,@GTEST_CONFIGURED@)
check: testsuite
for check_program in $(CHECK_PROGRAMS); do $(CURDIR)/$$check_program; done

testsuite: $(CHECK_PROGRAMS)
testsuite: $(CHECK_EXTENSIONS) $(CHECK_PROGRAMS)

testframework: $(GTEST_LIBS)

Expand All @@ -688,9 +698,9 @@ $(CHECK_LIBS): force

xbmc-test: $(CHECK_LIBS) $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(GTEST_LIBS)
ifeq ($(findstring osx,@ARCH@), osx)
$(SILENT_LD) $(CXX) $(LDFLAGS) $(GTEST_INCLUDES) -o $@ -Wl,-all_load,-ObjC $(CHECK_LIBS) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(GTEST_LIBS) $(LIBS) -rdynamic
$(SILENT_LD) $(CXX) $(LDFLAGS) $(GTEST_INCLUDES) -o $@ -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(GTEST_LIBS) $(CHECK_LIBS) $(LIBS) $(CHECK_LIBADD) -rdynamic
else
$(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) $(GTEST_INCLUDES) -o $@ -Wl,--whole-archive $(CHECK_LIBS) $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--no-whole-archive $(NWAOBJSXBMC) $(GTEST_LIBS) $(LIBS) -rdynamic
$(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) $(GTEST_INCLUDES) -o $@ -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) $(GTEST_LIBS) $(CHECK_LIBS) -Wl,--no-whole-archive $(NWAOBJSXBMC) $(LIBS) $(CHECK_LIBADD) -rdynamic
endif
else
# Give a message that the framework is not configured, but don't fail.
Expand Down
84 changes: 84 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ fishbmc_enabled="== FishBMC enabled. =="
fishbmc_disabled="== FishBMC disabled. =="
projectm_enabled="== ProjectM enabled. =="
projectm_disabled="== ProjectM disabled. =="
wayland_enabled="== Wayland enabled. =="
wayland_disabled="== Wayland disabled. =="
x11_enabled="== X11 enabled. =="
x11_disabled="== X11 disabled. =="
pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
Expand Down Expand Up @@ -342,6 +344,12 @@ AC_ARG_ENABLE([projectm],
[use_projectm=$enableval],
[use_projectm=yes])

AC_ARG_ENABLE([wayland],
[AS_HELP_STRING([--enable-wayland],
[enable wayland (default is no) 'Linux Only'])],
[use_wayland=$enableval],
[use_wayland=no])

AC_ARG_ENABLE([x11],
[AS_HELP_STRING([--enable-x11],
[enable x11 (default is yes) 'Linux Only'])],
Expand Down Expand Up @@ -593,6 +601,7 @@ AC_PROG_LIBTOOL
AC_PROG_AWK
AC_PROG_LN_S
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
MAKE="${MAKE:-make}"
OBJDUMP="${OBJDUMP:-objdump}"

Expand Down Expand Up @@ -686,6 +695,7 @@ case $host in
use_gles=yes
use_sdl=no
use_x11=no
use_wayland=no
;;
arm*-*linux-android*)
target_platform=target_android
Expand All @@ -699,6 +709,7 @@ case $host in
use_optical_drive=no
use_sdl=no
use_x11=no
use_wayland=no
build_shared_lib=yes
;;
*)
Expand Down Expand Up @@ -953,6 +964,65 @@ else
AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
fi

# Wayland
if test "$use_wayland" = "yes" && test "$host_vendor" != "apple"; then
AC_MSG_NOTICE($wayland_enabled)
PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client],
[INCLUDES="$INCLUDES $WAYLAND_CLIENT_CFLAGS";
WAYLAND_CLIENT_LIBRARY_LINE=`LIBRARY=\`${PKG_CONFIG} --libs-only-l wayland-client\`; echo ${LIBRARY:2}`;
XB_FIND_SONAME([WAYLAND_CLIENT_LIBRARY], ${WAYLAND_CLIENT_LIBRARY_LINE})],
AC_MSG_ERROR($missing_library))
PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl],
[INCLUDES="$INCLUDES $WAYLAND_EGL_CFLAGS";
WAYLAND_EGL_LIBRARY_LINE=`LIBRARY=\`${PKG_CONFIG} --libs-only-l wayland-egl\`; echo ${LIBRARY:2}`
XB_FIND_SONAME([WAYLAND_EGL_LIBRARY], ${WAYLAND_EGL_LIBRARY_LINE})],
AC_MSG_ERROR($missing_library))
PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
[INCLUDES="$INCLUDES $XKBCOMMON_CFLAGS";
XKBCOMMON_LIBRARY_LINE=`LIBRARY=\`${PKG_CONFIG} --libs-only-l xkbcommon\`; echo ${LIBRARY:2}`;
XB_FIND_SONAME([XKBCOMMON_LIBRARY], $XKBCOMMON_LIBRARY_LINE)],
AC_MSG_ERROR($missing_library))
AC_DEFINE([HAVE_WAYLAND], [1], [Define to 1 if you have Wayland libs installed.])
AC_DEFINE([HAVE_XKBCOMMON], [1], [Define to 1 if you have libxkbcommon installed.])

# If we are also building with tests then we want to build
# wayland tests as well
if test "$configure_gtest" = "yes"; then
have_weston_sdk=no;
PKG_CHECK_MODULES([PIXMAN],
[pixman-1],have_pixman=yes,
[AC_MSG_WARN($missing_library); have_pixman=no])
PKG_CHECK_MODULES([WESTON],
[weston >= 1.1.90],[have_weston_sdk=yes],
[have_weston_sdk=no; AC_MSG_WARN($missing_library)])

AC_CHECK_PROG(WAYLAND_SCANNER, wayland-scanner, "wayland-scanner", "no")
if test "x$WAYLAND_SCANNER" == "xno"; then
AC_MSG_WARN($missing_program)
else
if test "x$have_weston_sdk" == "xyes" && test "x$have_pixman" = "xyes"; then
AC_SUBST(WAYLAND_TEST_INCLUDES,"$WAYLAND_CLIENT_CFLAGS $XKBCOMMON_CFLAGS $PIXMAN_CFLAGS $WESTON_CFLAGS")
AC_SUBST(WAYLAND_TEST_LIBS,"$WAYLAND_CLIENT_LIBS $XKBCOMMON_LIBS $PIXMAN_LIBS $WESTON_LIBS")
AC_DEFINE([HAVE_WESTON_SDK], [1], [Define to 1 if Weston SDK is installed.])
AC_SUBST(USE_WAYLAND_TEST_EXTENSION, 1)
fi
AC_SUBST(WAYLAND_SCANNER)
AC_DEFINE([HAVE_WAYLAND_XBMC_PROTO],[1],["Define to 1 if the wayland test-protocol will be built"])
fi
fi

# Disable SDL and X11 builds
use_sdl=no
use_joystick=no
use_x11=no

# Wayland requires the EGL "window system" which in turn only supports
# the OpenGL ES API, so enable gles support
use_gles=yes
else
AC_MSG_RESULT($wayland_disabled)
fi

# Checks for platforms libraries.
if test "$use_gles" = "yes"; then
use_gl="no"
Expand Down Expand Up @@ -2116,6 +2186,14 @@ else
final_message="$final_message\n X11:\t\tNo"
fi

if test "$use_wayland" = "yes"; then
final_message="$final_message\n Wayland:\tYes"
USE_WAYLAND=1
USE_XKBCOMMON=1
else
final_message="$final_message\n Wayland:\tNo"
fi

if test "$use_libbluray" = "yes"; then
final_message="$final_message\n Bluray:\tYes"
else
Expand Down Expand Up @@ -2436,6 +2514,7 @@ OUTPUT_FILES="Makefile \
xbmc/music/karaoke/Makefile \
xbmc/osx/Makefile \
xbmc/guilib/Makefile \
xbmc/input/linux/Makefile \
xbmc/interfaces/Makefile \
xbmc/network/Makefile \
xbmc/network/upnp/Makefile \
Expand All @@ -2458,6 +2537,8 @@ OUTPUT_FILES="Makefile \
xbmc/visualizations/OpenGLSpectrum/Makefile \
xbmc/visualizations/fishBMC/Makefile \
xbmc/visualizations/WaveForm/Makefile \
xbmc/windowing/Makefile \
xbmc/windowing/egl/Makefile \
lib/addons/library.xbmc.addon/Makefile \
lib/addons/library.xbmc.codec/Makefile \
lib/addons/library.xbmc.gui/Makefile \
Expand All @@ -2474,6 +2555,7 @@ OUTPUT_FILES="Makefile \
xbmc/android/jni/Makefile \
xbmc/utils/Makefile \
xbmc/main/Makefile \
xbmc/windowing/tests/wayland/Makefile \
project/cmake/xbmc-config.cmake"

if test "$use_skin_touched" = "yes"; then
Expand Down Expand Up @@ -2545,8 +2627,10 @@ AC_SUBST(USE_LIBUDEV)
AC_SUBST(USE_LIBUSB)
AC_SUBST(USE_LIBCEC)
AC_SUBST(USE_MYSQL)
AC_SUBST(USE_WAYLAND)
AC_SUBST(USE_WEB_SERVER)
AC_SUBST(USE_UPNP)
AC_SUBST(USE_XKBCOMMON)
AC_SUBST(USE_OMXLIB)
AC_SUBST(USE_ANDROID)
AC_SUBST(GTEST_CONFIGURED)
Expand Down
7 changes: 7 additions & 0 deletions xbmc/DllPaths_generated.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,11 @@
/* libbluray */
#define DLL_PATH_LIBBLURAY "@BLURAY_SONAME@"

/* wayland */
#define DLL_PATH_WAYLAND_CLIENT "@WAYLAND_CLIENT_LIBRARY_SONAME@"
#define DLL_PATH_WAYLAND_EGL "@WAYLAND_EGL_LIBRARY_SONAME@"

/* xkbcommon */
#define DLL_PATH_XKBCOMMON "@XKBCOMMON_LIBRARY_SONAME@"

#endif
40 changes: 31 additions & 9 deletions xbmc/DynamicDll.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once

/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
Expand Down Expand Up @@ -356,12 +355,10 @@ public: \
#define BEGIN_METHOD_RESOLVE() \
protected: \
virtual bool ResolveExports() \
{ \
return (
{

#define END_METHOD_RESOLVE() \
1 \
); \
return true; \
}

///////////////////////////////////////////////////////////
Expand All @@ -374,10 +371,33 @@ public: \
// or DEFINE_METHOD_LINKAGE
//
#define RESOLVE_METHOD(method) \
m_dll->ResolveExport( #method , & m_##method##_ptr ) &&
if (!m_dll->ResolveExport( #method , & m_##method##_ptr )) \
return false;

#define RESOLVE_METHOD_FP(method) \
m_dll->ResolveExport( #method , & method##_ptr ) &&
if (!m_dll->ResolveExport( #method , & method##_ptr )) \
return false;


///////////////////////////////////////////////////////////
//
// RESOLVE_METHOD_OPTIONAL
//
// Resolves a method from a dll. does not abort if the
// method is missing
//
// method: Name of the method defined with DEFINE_METHOD
// or DEFINE_METHOD_LINKAGE
//

#define RESOLVE_METHOD_OPTIONAL(method) \
m_dll->ResolveExport( #method , & m_##method##_ptr );

#define RESOLVE_METHOD_OPTIONAL_FP(method) \
method##_ptr = NULL; \
m_dll->ResolveExport( #method , & method##_ptr );



///////////////////////////////////////////////////////////
//
Expand All @@ -390,10 +410,12 @@ public: \
// or DEFINE_METHOD_LINKAGE
//
#define RESOLVE_METHOD_RENAME(dllmethod, method) \
m_dll->ResolveExport( #dllmethod , & m_##method##_ptr ) &&
if (!m_dll->ResolveExport( #dllmethod , & m_##method##_ptr )) \
return false;

#define RESOLVE_METHOD_RENAME_FP(dllmethod, method) \
m_dll->ResolveExport( #dllmethod , & method##_ptr ) &&
if (!m_dll->ResolveExport( #dllmethod , & method##_ptr )) \
return false;


////////////////////////////////////////////////////////////////////
Expand Down
36 changes: 36 additions & 0 deletions xbmc/input/linux/Keymap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

/*
* Copyright (C) 2011-2013 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "system.h"

class ILinuxKeymap
{
public:

virtual ~ILinuxKeymap() {};

virtual uint32_t KeysymForKeycode(uint32_t code) const = 0;
virtual void UpdateMask(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) = 0;
virtual uint32_t CurrentModifiers() const = 0;

virtual uint32_t XBMCKeysymForKeycode(uint32_t code) const = 0;
virtual uint32_t ActiveXBMCModifiers() const = 0;
};
5 changes: 5 additions & 0 deletions xbmc/input/linux/Makefile → xbmc/input/linux/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
SRCS=LIRC.cpp \
LinuxInputDevices.cpp

# xkbcommon detail
ifeq (@USE_XKBCOMMON@,1)
SRCS += XKBCommonKeymap.cpp
endif

LIB=input_linux.a

include ../../../Makefile.include
Expand Down
Loading

0 comments on commit 9c9fdb3

Please sign in to comment.