Merge branch 'master' of code.vuplus.com:/opt/repository/openvuplus_3.0
[vuplus_openvuplus_3.0] / meta-bsp / recipes-multimedia / kodi / files / xbmc-17.0-vuplus-patch.diff
1 diff --git a/.gitignore b/.gitignore
2 index c0631de..8392f6b 100644
3 --- a/.gitignore
4 +++ b/.gitignore
5 @@ -371,6 +371,7 @@ lib/cpluff/stamp-h1
6  
7  # /tools/Linux/
8  /tools/Linux/kodi.sh
9 +/tools/Linux/kodi.run
10  /tools/Linux/kodi-standalone.sh
11  /tools/Linux/kodi-xsession.desktop
12  
13 diff --git a/Makefile.in b/Makefile.in
14 index 0d70e9b..a6ee74b 100644
15 --- a/Makefile.in
16 +++ b/Makefile.in
17 @@ -237,7 +237,7 @@ INCLUDES=$(sort @INCLUDES@)
18  
19  CLEAN_FILES=@APP_NAME_LC@.bin @APP_NAME_LC@-xrandr lib@APP_NAME_LC@.so
20  
21 -DISTCLEAN_FILES=config.h config.log config.status tools/Linux/kodi.sh \
22 +DISTCLEAN_FILES=config.h config.log config.status tools/Linux/kodi.sh tools/Linux/kodi.run \
23          tools/Linux/kodi-standalone.sh autom4te.cache config.h.in~ \
24          system/libcpluff-@ARCH@.so
25  
26 @@ -273,9 +273,12 @@ CHECK_LIBS = xbmc/addons/test/addonsTest.a \
27               xbmc/video/test/videoTest.a \
28               xbmc/threads/test/threadTest.a \
29               xbmc/interfaces/python/test/pythonSwigTest.a \
30 -             xbmc/cores/AudioEngine/Sinks/test/AESinkTest.a \
31               xbmc/test/xbmc-test.a
32  
33 +ifneq (@VUPLUS_COMPILE@,yes)
34 +CHECK_LIBS += xbmc/cores/AudioEngine/Sinks/test/AESinkTest.a
35 +endif
36 +
37  ifeq (@HAVE_SSE4@,1)
38  LIBSSE4+=sse4
39  sse4 : force
40 @@ -407,6 +410,10 @@ FFMPEGOBJS = @FFMPEG_LIBDIR@/libavcodec.a \
41  DYNOBJSXBMC+= $(FFMPEGOBJS)
42  LIBS+= @GNUTLS_ALL_LIBS@
43  
44 +ifeq (@VUPLUS_COMPILE@,yes)
45 +LIBS+= -lKodiGLESPL -ldvb_base -lnxpl -ldvb_client
46 +endif
47 +
48  $(FFMPEGOBJS): dvdpcodecs
49  endif
50  
51 @@ -522,6 +529,9 @@ install-scripts:
52         @install -d $(DESTDIR)$(datarootdir)/xsessions
53         @install -m 0644 tools/Linux/kodi-xsession.desktop $(DESTDIR)$(datarootdir)/xsessions/@APP_NAME_LC@.desktop
54         @cd $(DESTDIR)$(datarootdir)/xsessions; [ -L xbmc.desktop ] || [ -f xbmc.desktop ] || ln -s @APP_NAME_LC@.desktop xbmc.desktop
55 +       @install -d $(DESTDIR)$(libdir)
56 +       @install -d $(DESTDIR)$(libdir)/@APP_NAME_LC@
57 +       @install tools/Linux/@APP_NAME_LC@.run $(DESTDIR)$(libdir)/@APP_NAME_LC@/@APP_NAME_LC@.run
58  
59  install-datas: install-scripts
60         @echo "Copying support and legal files..."
61 diff --git a/addons/skin.estouchy/xml/Home.xml b/addons/skin.estouchy/xml/Home.xml
62 index 971f04b..4d96119 100644
63 --- a/addons/skin.estouchy/xml/Home.xml
64 +++ b/addons/skin.estouchy/xml/Home.xml
65 @@ -181,7 +181,7 @@
66                                 <content>
67                                         <item>
68                                                 <label>13012</label>
69 -                                               <onclick>Shutdown</onclick>
70 +                                               <onclick>XBMC.Quit()</onclick>
71                                                 <icon>icon_button_shutdown.png</icon>
72                                         </item>
73                                         <item>
74 diff --git a/addons/skin.estuary/xml/Home.xml b/addons/skin.estuary/xml/Home.xml
75 index 16187cc..89feb5b 100644
76 --- a/addons/skin.estuary/xml/Home.xml
77 +++ b/addons/skin.estuary/xml/Home.xml
78 @@ -915,7 +915,7 @@
79                                         <align>justify</align>
80                                         <include content="IconButton">
81                                                 <param name="control_id" value="804" />
82 -                                               <param name="onclick" value="ActivateWindow(shutdownmenu)" />
83 +                                               <param name="onclick" value="XBMC.Quit()" />
84                                                 <param name="icon" value="icons/power.png" />
85                                                 <param name="label" value="$LOCALIZE[33060]" />
86                                         </include>
87 diff --git a/configure.ac b/configure.ac
88 index 0609390..f223baf 100644
89 --- a/configure.ac
90 +++ b/configure.ac
91 @@ -681,6 +681,16 @@ case $use_platform in
92       use_neon=yes
93       use_cpu=cortex-a7
94       ;;
95 +  vuplus-arm)
96 +     target_platform=target_vuplus
97 +     ARCH="arm"
98 +     use_arch="arm"
99 +     ;;
100 +  vuplus-mips)
101 +     target_platform=target_vuplus
102 +     ARCH="mips"
103 +     use_arch="mips"
104 +     ;;
105  esac
106  
107  if test "$target_platform" = "target_raspberry_pi" ; then
108 @@ -696,6 +706,22 @@ if test "$target_platform" = "target_raspberry_pi" ; then
109       CXXFLAGS="$CXXFLAGS"
110  fi
111  
112 +if test "$target_platform" = "target_vuplus" ; then
113 +     ffmpeg_target_os=linux
114 +     use_joystick=no
115 +     use_gles=yes
116 +     use_sdl=no
117 +     use_x11=no
118 +     use_wayland=no
119 +     use_wayland=no
120 +     use_optical_drive=no
121 +     USE_STATIC_FFMPEG=1
122 +     AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
123 +     VUPLUS_COMPILE=yes
124 +     CFLAGS="$CFLAGS"
125 +     CXXFLAGS="$CXXFLAGS"
126 +fi
127 +
128  if test "$host_vendor" = "apple"; then
129    use_avahi=no
130    use_alsa=no
131 @@ -1056,7 +1082,7 @@ int main() {
132    )])
133  AC_LANG_POP([C++])
134  
135 -if test "${target_platform}" = "target_linux" || test "${target_platform}" = "target_raspberry_pi" || test "${target_platform}" = "target_android"; then
136 +if test "${target_platform}" = "target_linux" || test "${target_platform}" = "target_raspberry_pi" || test "${target_platform}" = "target_android" || test "${target_platform}" = "target_vuplus"; then
137    PKG_CHECK_MODULES([UUID], [uuid],, AC_MSG_ERROR(libuuid not found))
138  fi
139  
140 @@ -1556,7 +1582,21 @@ if test "${USE_STATIC_FFMPEG}" = "1"; then
141        pkg_cfg_prefix=${SYSROOT}
142    fi
143  
144 -  if test "$cross_compiling" != "yes"; then
145 +  if test "${target_platform}" = "target_vuplus"; then
146 +    # always build our ffmpeg
147 +    if test "$use_debug" != "yes"; then
148 +      FFMPEG_OPTS="-r"
149 +    fi
150 +    if test "$use_optimizations" != "yes"; then
151 +      FFMPEG_OPTS="${FFMPEG_OPTS} --disable-optimizations"
152 +    fi
153 +    AC_MSG_NOTICE("FFmpeg installation forced by user - installing our version")
154 +    CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" NM="$NM" AR="$AR" \
155 +      AS="$AS" STRIP="$STRIP" CC="$CC" CXX="$CXX" LD="$CCLD" RANLIB="$RANLIB" \
156 +      ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS} ${PARALLEL_MAKE} --arch=generic
157 +    export PKG_CONFIG_PATH="${ffmpeg_build}/ffmpeg-install/lib/pkgconfig:$PKG_CONFIG_PATH"
158 +
159 +  elif test "$cross_compiling" != "yes"; then
160      if test "$use_debug" != "yes"; then
161        FFMPEG_OPTS="-r"
162      fi
163 @@ -1589,14 +1629,18 @@ if test "${USE_STATIC_FFMPEG}" = "1"; then
164        if test "$with_ffmpeg" = "yes" || test "$FFMPEG_FOUND" = "false"; then
165          # ffmpeg not found with pkg-config, lets install it
166          AC_MSG_NOTICE("Installing FFmpeg")
167 -        CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS}
168 +        CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" NM="$NM" AR="$AR" \
169 +          AS="$AS" STRIP="$STRIP" CC="$CC" CXX="$CXX" LD="$CCLD" RANLIB="$RANLIB" \
170 +          ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS}
171          export PKG_CONFIG_PATH="${ffmpeg_build}/ffmpeg-install/lib/pkgconfig:$PKG_CONFIG_PATH"
172        fi
173  
174      elif test "$with_ffmpeg" = "force"; then
175        # always build our ffmpeg
176        AC_MSG_NOTICE("FFmpeg installation forced by user - installing our version")
177 -      CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS}
178 +      CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" NM="$NM" AR="$AR" \
179 +        AS="$AS" STRIP="$STRIP" CC="$CC" CXX="$CXX" LD="$CCLD" RANLIB="$RANLIB" \
180 +        ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS}
181        export PKG_CONFIG_PATH="${ffmpeg_build}/ffmpeg-install/lib/pkgconfig:$PKG_CONFIG_PATH"
182  
183      elif test "$with_ffmpeg" != "no"; then
184 @@ -1609,13 +1653,17 @@ fi
185  
186  if test "$FFMPEG_FOUND" != "true"; then
187    PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
188 -    [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"; FFMPEG_FOUND="true"],
189 +    [FFMPEG_FOUND="true"],
190      [AC_MSG_ERROR("ffmpeg not found")])
191 +  FFMPEG_LIBS=$(PKG_CONFIG_SYSROOT_DIR="" ${PKG_CONFIG} --libs libavcodec 2>/dev/null)
192 +  FFMPEG_CFLAGS=$(PKG_CONFIG_SYSROOT_DIR="" ${PKG_CONFIG} --cflags libavcodec 2>/dev/null)
193 +  INCLUDES="$INCLUDES $FFMPEG_CFLAGS"
194 +  LIBS="$LIBS $FFMPEG_LIBS"
195  fi
196  
197  if test "${USE_STATIC_FFMPEG}" = "1"; then
198    # get the libdir for static linking
199 -  FFMPEG_LIBDIR=${pkg_cfg_prefix}$(PKG_CONFIG_SYSROOT_DIR="" ${PKG_CONFIG} --static --variable=libdir libavcodec)
200 +  FFMPEG_LIBDIR=$(PKG_CONFIG_SYSROOT_DIR="" ${PKG_CONFIG} --static --variable=libdir libavcodec)
201    GNUTLS_ALL_LIBS=$(${PKG_CONFIG} --static --libs-only-l --silence-errors gnutls)
202  
203    # check if static libs are available
204 @@ -2200,6 +2248,7 @@ OUTPUT_FILES="Makefile \
205      lib/addons/library.kodi.inputstream/Makefile \
206      tools/Linux/kodi.sh \
207      tools/Linux/kodi-standalone.sh \
208 +    tools/Linux/kodi.run \
209      tools/Linux/kodi-xsession.desktop \
210      tools/EventClients/Makefile \
211      tools/EventClients/Clients/OSXRemote/Makefile \
212 @@ -2329,6 +2378,7 @@ AC_SUBST(HAVE_SSE4)
213  AC_SUBST(USE_MMAL)
214  AC_SUBST(USE_X11)
215  AC_SUBST(USE_OPTICAL_DRIVE)
216 +AC_SUBST(VUPLUS_COMPILE)
217  
218  # pushd and popd are not available in other shells besides bash, so implement
219  # our own pushd/popd functions
220 diff --git a/lib/libdvd/Makefile.in b/lib/libdvd/Makefile.in
221 index 5a4508b..11cb139 100644
222 --- a/lib/libdvd/Makefile.in
223 +++ b/lib/libdvd/Makefile.in
224 @@ -4,6 +4,12 @@ ARCH=@ARCH@
225  CC=@CC@
226  CXX=@CXX@
227  
228 +ifeq (@VUPLUS_COMPILE@,yes)
229 +  DVDNAV_A = @abs_top_srcdir@/tools/depends/target/libdvdnav/dvdnav-install/lib/libdvdnav.a
230 +  DVDREAD_A = @abs_top_srcdir@/tools/depends/target/libdvdread/dvdread-install/lib/libdvdread.a
231 +  DVDCSS_A = @abs_top_srcdir@/tools/depends/target/libdvdcss/dvdcss-install/lib/libdvdcss.a
232 +else
233 +
234  ifeq (@CROSS_COMPILING@,yes)
235    DEPENDS_DIR = $(shell grep "^PREFIX=/" @abs_top_srcdir@/tools/depends/Makefile.include | sed 's/PREFIX=//g')
236    DVDNAV_A = $(DEPENDS_DIR)/lib/libdvdnav.a
237 @@ -15,6 +21,8 @@ else
238    DVDCSS_A = @abs_top_srcdir@/tools/depends/target/libdvdcss/dvdcss-install/lib/libdvdcss.a
239  endif
240  
241 +endif
242 +
243  SYSDIR = @abs_top_srcdir@/system/players/VideoPlayer
244  SOS = libdvdnav-$(ARCH).so
245  
246 diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4
247 index d28f263..a51286d 100644
248 --- a/m4/xbmc_arch.m4
249 +++ b/m4/xbmc_arch.m4
250 @@ -80,4 +80,14 @@ fi
251  if test "$target_platform" = "target_raspberry_pi" ; then
252    AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI")
253  fi
254 +
255 +case $use_platform in
256 +  vuplus-arm)
257 +     AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_VUPLUS")
258 +     ;;
259 +  vuplus-mips)
260 +     AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_VUPLUS -D_MIPSEL")
261 +     ;;
262 +esac
263 +
264  ])
265 diff --git a/system/playercorefactory.xml b/system/playercorefactory.xml
266 index be6b721..3e50877 100644
267 --- a/system/playercorefactory.xml
268 +++ b/system/playercorefactory.xml
269 @@ -8,6 +8,13 @@
270      <player name="VideoPlayer" /> placeholder for MPlayer
271      <player name="PAPlayer" audio="true" />
272      -->
273 +    <player name="E2Player" type="ExternalPlayer" audio="false" video="true">
274 +      <filename>xbmc.helper</filename>
275 +      <args>--url="{1}" --owner="$PPID"</args>
276 +      <hidexbmc>true</hidexbmc>
277 +      <hideconsole>true</hideconsole>
278 +      <warpcursor>none</warpcursor>
279 +    </player>
280    </players>
281  
282    <rules name="system rules">
283 @@ -36,5 +43,7 @@
284  
285      <!-- pvr radio channels should be played by VideoPlayer because they need buffering -->
286      <rule name="radio" filetypes="pvr" filename=".*/radio/.*" player="VideoPlayer" />
287 +
288 +    <rule name="dgb" filetypes="*" player="E2Player"/>
289    </rules>
290  </playercorefactory>
291 diff --git a/tools/Linux/kodi.run.in b/tools/Linux/kodi.run.in
292 new file mode 100644
293 index 0000000..f1091ca
294 --- /dev/null
295 +++ b/tools/Linux/kodi.run.in
296 @@ -0,0 +1,4 @@
297 +#!/bin/sh
298 +
299 +/usr/bin/kodi > /dev/null 2>&1 &
300 +
301 diff --git a/tools/Linux/kodi.sh.in b/tools/Linux/kodi.sh.in
302 index 9fc75dd..66946fe 100644
303 --- a/tools/Linux/kodi.sh.in
304 +++ b/tools/Linux/kodi.sh.in
305 @@ -25,7 +25,23 @@ prefix="@prefix@"
306  exec_prefix="@exec_prefix@"
307  datarootdir="@datarootdir@"
308  LIBDIR="@libdir@"
309 -CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME}
310 +
311 +HDD_MOUNT_POINT="$(grep '/media/hdd' /proc/mounts)"
312 +if [ "$HDD_MOUNT_POINT" != "" ]; then
313 +    export HOME="/media/hdd"
314 +else
315 +    export HOME="/home/root"
316 +fi
317
318 +export KODI_TEMP="/tmp/kodi"
319 +CRASHLOG_DIR=${CRASHLOG_DIR:-$KODI_TEMP}
320 +
321 +echo "-----------------+ XBMC ENVIRONMENTS +"
322 +echo "  + CRASHLOG_DIR    : "$CRASHLOG_DIR
323 +echo "  + HOME            : "$HOME
324 +echo "  + HDD_MOUNT_POINT : "$HDD_MOUNT_POINT
325 +echo ""
326 +
327  USERDATA_DIR="${HOME}/.${bin_name}"
328  
329  
330 @@ -161,14 +177,14 @@ while [ $(( $LOOP )) = "1" ]
331  do
332    LOOP=0
333    "$LIBDIR/${bin_name}/${bin_name}.bin" $SAVED_ARGS
334 -  RET=$?
335 -  if [ $(( $RET == 65 )) = "1" ]
336 -  then # User requested to restart app
337 -    LOOP=1
338 -  elif [ $(( ($RET >= 131 && $RET <= 136) || $RET == 139 )) = "1" ]
339 -  then # Crashed with core dump
340 -    print_crash_report
341 -  fi
342 +#  RET=$?
343 +#  if [ $(( $RET == 65 )) = "1" ]
344 +#  then # User requested to restart app
345 +#    LOOP=1
346 +#  elif [ $(( ($RET >= 131 && $RET <= 136) || $RET == 139 )) = "1" ]
347 +#  then # Crashed with core dump
348 +#    print_crash_report
349 +#  fi
350  done
351  
352  exit $RET
353 diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac
354 index 3626ea5..0da8d18 100644
355 --- a/tools/depends/configure.ac
356 +++ b/tools/depends/configure.ac
357 @@ -186,6 +186,14 @@ case $host in
358      #android builds are always cross
359      cross_compiling="yes"
360    ;;
361 +  mipsel-*-linux*)
362 +    use_cpu=$host_cpu
363 +    use_toolchain="${use_toolchain:-/usr}"
364 +    platform_cflags="-Os -fPIC -DPIC"
365 +    platform_ldflags="-Wl,-rpath-link=$prefix/$deps_dir/lib"
366 +    platform_cxxflags="$platform_cflags"
367 +    platform_os="linux"
368 +    ;;
369    arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
370      if test "$use_platform" = "auto"; then
371        if test "x$use_cpu" = "xauto"; then
372 diff --git a/tools/depends/native/JsonSchemaBuilder/Makefile b/tools/depends/native/JsonSchemaBuilder/Makefile
373 index cf5d20b..0bca981 100644
374 --- a/tools/depends/native/JsonSchemaBuilder/Makefile
375 +++ b/tools/depends/native/JsonSchemaBuilder/Makefile
376 @@ -1,3 +1,7 @@
377 +LD=ld
378 +CC=gcc
379 +CXX=g++
380 +
381  ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
382  -include ../../Makefile.include
383  
384 @@ -21,6 +25,7 @@ APPBIN=$(PREFIX)/bin/JsonSchemaBuilder
385  
386  all: .installed-$(PLATFORM)
387  
388 +.PHONY:$(PLATFORM)
389  $(PLATFORM):
390         -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
391         cd $(PLATFORM); cp -a $(SOURCE)/* .
392 diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh
393 index 5c29762..a3e7806 100755
394 --- a/tools/depends/target/ffmpeg/autobuild.sh
395 +++ b/tools/depends/target/ffmpeg/autobuild.sh
396 @@ -134,6 +134,20 @@ tar --strip-components=1 -xf $MYDIR/${ARCHIVE}
397  
398  CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \
399  ./configure --prefix=$FFMPEG_PREFIX \
400 +       --bindir="$FFMPEG_PREFIX/bin" \
401 +       --libdir="$FFMPEG_PREFIX/lib" \
402 +       --incdir="$FFMPEG_PREFIX/include" \
403 +       --pkgconfigdir="$FFMPEG_PREFIX/lib/pkgconfig" \
404 +       --target-os=linux \
405 +       --enable-cross-compile \
406 +       --nm="$NM" \
407 +       --ar="$AR" \
408 +       --as="$AS" \
409 +       --strip="$STRIP" \
410 +       --cc="$CC" \
411 +       --cxx="$CXX" \
412 +       --ld="$CCLD" \
413 +       --ranlib="$RANLIB" \
414         --extra-version="kodi-${VERSION}" \
415         --disable-devices \
416         --disable-ffplay \
417 diff --git a/tools/depends/target/libdvdcss/Makefile b/tools/depends/target/libdvdcss/Makefile
418 index 518ce2b..6a66382 100644
419 --- a/tools/depends/target/libdvdcss/Makefile
420 +++ b/tools/depends/target/libdvdcss/Makefile
421 @@ -3,7 +3,7 @@ include DVDCSS-VERSION
422  DEPS= DVDCSS-VERSION Makefile
423  
424  ifeq ($(CROSS_COMPILING), yes)
425 -  DEPS += ../../Makefile.include
426 +
427  else
428    ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
429    PREFIX := $(ROOT_DIR)/dvdcss-install
430 @@ -19,8 +19,7 @@ RETRIEVE_TOOL := curl -Ls --create-dirs --retry 10 --retry-delay 3
431  ARCHIVE_TOOL := tar --strip-components=1 -xf
432  
433  # configuration settings
434 -config = --prefix=$(PREFIX) --disable-shared --enable-static --with-pic
435 -
436 +config = --build=$(BUILD_SYS) --host=$(HOST_SYS) --prefix=$(PREFIX) --disable-shared --enable-static --with-pic
437  CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
438  
439  GITREV=$(shell git ls-remote $(BASE_URL) $(VERSION) | awk '{print $$1}')
440 diff --git a/tools/depends/target/libdvdnav/Makefile b/tools/depends/target/libdvdnav/Makefile
441 index cd44351..1a27e12 100644
442 --- a/tools/depends/target/libdvdnav/Makefile
443 +++ b/tools/depends/target/libdvdnav/Makefile
444 @@ -3,11 +3,11 @@ include DVDNAV-VERSION
445  DEPS = DVDNAV-VERSION Makefile
446  
447  # configuration settings
448 -config = --prefix=$(PREFIX) --disable-shared --enable-static --with-pic
449 +config = --build=$(BUILD_SYS) --host=$(HOST_SYS) --prefix=$(PREFIX) --disable-shared --enable-static --with-pic
450  EXTRA_CFLAGS = -D_XBMC -DHAVE_DVDCSS_DVDCSS_H
451  
452  ifeq ($(CROSS_COMPILING), yes)
453 -  DEPS += ../../Makefile.include
454 +
455  else
456    ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
457    PREFIX := $(ROOT_DIR)/dvdnav-install
458 diff --git a/tools/depends/target/libdvdread/Makefile b/tools/depends/target/libdvdread/Makefile
459 index 3652f1b..4ef12ac 100644
460 --- a/tools/depends/target/libdvdread/Makefile
461 +++ b/tools/depends/target/libdvdread/Makefile
462 @@ -3,11 +3,11 @@ include DVDREAD-VERSION
463  DEPS = DVDREAD-VERSION Makefile
464  
465  # configuration settings
466 -config = --prefix=$(PREFIX) --disable-shared --enable-static --with-pic
467 +config = --build=$(BUILD_SYS) --host=$(HOST_SYS) --prefix=$(PREFIX) --disable-shared --enable-static --with-pic
468  EXTRA_CFLAGS = -D_XBMC
469  
470  ifeq ($(CROSS_COMPILING), yes)
471 -  DEPS += ../../Makefile.include
472 +
473  else
474    ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
475    PREFIX := $(ROOT_DIR)/dvdread-install
476 diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
477 index 2ad960c..7d273ff 100644
478 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
479 +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
480 @@ -672,8 +672,11 @@ void CActiveAESink::EnumerateSinkList(bool force)
481  {
482    if (!m_sinkInfoList.empty() && !force)
483      return;
484 -
485 +#if defined(TARGET_VUPLUS)
486 +  unsigned int c_retry = 0;
487 +#else
488    unsigned int c_retry = 4;
489 +#endif
490    m_sinkInfoList.clear();
491    CAESinkFactory::EnumerateEx(m_sinkInfoList);
492    while(m_sinkInfoList.empty() && c_retry > 0)
493 diff --git a/xbmc/cores/DllLoader/ldt_keeper.h b/xbmc/cores/DllLoader/ldt_keeper.h
494 index 8f14576..b0fcf06 100644
495 --- a/xbmc/cores/DllLoader/ldt_keeper.h
496 +++ b/xbmc/cores/DllLoader/ldt_keeper.h
497 @@ -32,9 +32,14 @@ typedef struct {
498    int fd;
499  } ldt_fs_t;
500  
501 +
502 +#if !defined(__mips__)
503  void      Setup_FS_Segment(void);
504  ldt_fs_t* Setup_LDT_Keeper(void);
505  void      Restore_LDT_Keeper(ldt_fs_t* ldt_fs);
506 +#endif
507 +
508 +
509  #ifdef __cplusplus
510  }
511  #endif
512 diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/OpenMaxVideo.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/OpenMaxVideo.cpp
513 index 3d5744b..011316a 100644
514 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/OpenMaxVideo.cpp
515 +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/OpenMaxVideo.cpp
516 @@ -68,8 +68,10 @@ using namespace KODI::MESSAGING;
517  #define OMX_VC1_DECODER         "OMX.Nvidia.vc1.decode"
518  
519  // EGL extension functions
520 +#ifndef EGL_EGLEXT_PROTOTYPES
521  static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
522  static PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
523 +#endif
524  
525  #if defined(EGL_KHR_reusable_sync)
526  static PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR;
527 @@ -77,6 +79,7 @@ static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR;
528  static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
529  #endif
530  
531 +#ifndef EGL_EGLEXT_PROTOTYPES
532  #define GETEXTENSION(type, ext) \
533  do \
534  { \
535 @@ -86,6 +89,7 @@ do \
536          CLog::Log(LOGERROR, "%s::%s - ERROR getting proc addr of " #ext "\n", CLASSNAME, __func__); \
537      } \
538  } while (0);
539 +#endif
540  
541  #define OMX_INIT_STRUCTURE(a) \
542    memset(&(a), 0, sizeof(a)); \
543 @@ -718,10 +722,12 @@ void OpenMaxDeleteTextures(void *userdata)
544    EGLDisplay eglDisplay = eglGetCurrentDisplay();
545    EGLContext eglContext = eglGetCurrentContext();
546  
547 +#ifndef EGL_EGLEXT_PROTOTYPES
548    if (!eglDestroyImageKHR)
549    {
550      GETEXTENSION(PFNEGLDESTROYIMAGEKHRPROC, eglDestroyImageKHR);
551    }
552 +#endif
553  
554    DeleteImageInfo *deleteInfo = (DeleteImageInfo*)userdata;
555  
556 @@ -784,6 +790,7 @@ OMX_ERRORTYPE COpenMaxVideo::AllocOMXOutputEGLTextures(void)
557  {
558    OMX_ERRORTYPE omx_err;
559  
560 +#ifndef EGL_EGLEXT_PROTOTYPES
561    if (!eglCreateImageKHR)
562    {
563      GETEXTENSION(PFNEGLCREATEIMAGEKHRPROC,  eglCreateImageKHR);
564 @@ -793,6 +800,7 @@ OMX_ERRORTYPE COpenMaxVideo::AllocOMXOutputEGLTextures(void)
565      GETEXTENSION(PFNEGLCLIENTWAITSYNCKHRPROC, eglClientWaitSyncKHR);
566  #endif
567    }
568 +#endif
569  
570    EGLint attrib = EGL_NONE;
571    OpenMaxVideoBuffer *egl_buffer;
572 @@ -1213,7 +1221,9 @@ void OpenMaxVideoBuffer::ReleaseTexture()
573    // add egl resources to deletion info
574    //! @todo delete from constructor!
575    deleteInfo->egl_image = egl_image;
576 +#if defined(EGL_KHR_reusable_sync)
577    deleteInfo->egl_sync = eglSync;
578 +#endif
579    deleteInfo->texture_id = texture_id;
580  
581    if ( g_application.IsCurrentThread() )
582 diff --git a/xbmc/filesystem/FileCache.h b/xbmc/filesystem/FileCache.h
583 index cd3b5c2..082ac33 100644
584 --- a/xbmc/filesystem/FileCache.h
585 +++ b/xbmc/filesystem/FileCache.h
586 @@ -24,7 +24,6 @@
587  #include "threads/CriticalSection.h"
588  #include "File.h"
589  #include "threads/Thread.h"
590 -#include <atomic>
591  
592  namespace XFILE
593  {
594 @@ -78,7 +77,7 @@ namespace XFILE
595      unsigned     m_writeRate;
596      unsigned     m_writeRateActual;
597      int64_t      m_forwardCacheSize;
598 -    std::atomic<int64_t> m_fileSize;
599 +    int64_t      m_fileSize;
600      unsigned int m_flags;
601      CCriticalSection m_sync;
602    };
603 diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp
604 index 80c89f0..3957144 100644
605 --- a/xbmc/input/InputManager.cpp
606 +++ b/xbmc/input/InputManager.cpp
607 @@ -511,6 +511,18 @@ bool CInputManager::OnKey(const CKey& key)
608            useKeyboard = true;
609        }
610      }
611 +#if defined(TARGET_VUPLUS)
612 +    switch(key.GetVKey()) {
613 +      case 0x0d:
614 +      case 0x80:
615 +      case 0x81:
616 +      case 0x82:
617 +      case 0x83:
618 +        if (iWin == WINDOW_DIALOG_KEYBOARD)
619 +          useKeyboard = false;
620 +        break;
621 +    }
622 +#endif
623      if (useKeyboard)
624      {
625        // use the virtualkeyboard section of the keymap, and send keyboard-specific or navigation
626 diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp
627 index 3875138..e3397d2 100644
628 --- a/xbmc/input/linux/LinuxInputDevices.cpp
629 +++ b/xbmc/input/linux/LinuxInputDevices.cpp
630 @@ -275,6 +275,27 @@ KeyMap keyMap[] = {
631    { 378               , XBMCK_RIGHT       }, // Green
632    { 381               , XBMCK_UP          }, // Yellow
633    { 366               , XBMCK_DOWN        }, // Blue
634 +#if defined(TARGET_VUPLUS)
635 +  { KEY_OK            , XBMCK_RETURN      }, // Ok
636 +  { KEY_EXIT          , XBMCK_ESCAPE      }, // EXIT
637 +  { 139               , XBMCK_MENU        }, // Menu
638 +  { 358               , XBMCK_e           }, // EPG
639 +  { 370               , XBMCK_l           }, // Subtitle
640 +  { 377               , XBMCK_z           }, // TV
641 +  { 385               , XBMCK_j           }, // Radio
642 +  { 388               , XBMCK_y           }, // Teletext
643 +  { 392               , XBMCK_o           }, // Audio
644 +  { 393               , XBMCK_x           }, // Unknown
645 +  { 398               , XBMCK_F1          }, // Red
646 +  { 399               , XBMCK_F2          }, // Green
647 +  { 400               , XBMCK_F3          }, // Yellow
648 +  { 401               , XBMCK_F4          }, // Blue
649 +  { 402               , XBMCK_PAGEUP      }, // PageUP
650 +  { 403               , XBMCK_PAGEDOWN    }, // PageDown
651 +  { 407               , XBMCK_MEDIA_NEXT_TRACK }, // Next
652 +  { 412               , XBMCK_MEDIA_PREV_TRACK }, // Prev
653 +#endif
654 +
655  };
656  
657  typedef enum
658 @@ -416,13 +437,14 @@ unsigned short CLinuxInputDevice::KeyboardReadValue(unsigned char table, unsigne
659    entry.kb_index = index;
660    entry.kb_value = 0;
661  
662 +#if !defined(TARGET_VUPLUS)
663    if (ioctl(m_vt_fd, KDGKBENT, &entry))
664    {
665      CLog::Log(LOGWARNING, "CLinuxInputDevice::KeyboardReadValue: KDGKBENT (table: %d, index: %d) "
666          "failed!\n", table, index);
667      return 0;
668    }
669 -
670 +#endif
671    return entry.kb_value;
672  }
673  
674 @@ -552,6 +574,15 @@ bool CLinuxInputDevice::KeyEvent(const struct input_event& levt, XBMC_Event& dev
675  
676      KeymapEntry entry;
677      entry.code = code;
678 +
679 +    int keyMapValue;
680 +#if defined(TARGET_VUPLUS)
681 +    if (devt.key.keysym.mod & (XBMCKMOD_SHIFT | XBMCKMOD_CAPS)) keyMapValue = entry.shift;
682 +    else if (devt.key.keysym.mod & XBMCKMOD_ALT) keyMapValue = entry.alt;
683 +    else if (devt.key.keysym.mod & XBMCKMOD_META) keyMapValue = entry.altShift;
684 +    else keyMapValue = entry.base;
685 +    devt.key.keysym.unicode = devt.key.keysym.sym;
686 +#else
687      if (GetKeymapEntry(entry))
688      {
689        int keyMapValue;
690 @@ -569,6 +600,7 @@ bool CLinuxInputDevice::KeyEvent(const struct input_event& levt, XBMC_Event& dev
691          }
692        }
693      }
694 +#endif
695    }
696  
697    return true;
698 @@ -857,6 +889,12 @@ XBMC_Event CLinuxInputDevice::ReadEvent()
699          break;
700        }
701  
702 +#if defined(TARGET_VUPLUS)
703 +      if (access("/tmp/playing.lock", F_OK) == 0) {
704 +       break;
705 +      }
706 +#endif
707 +
708        //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str());
709  
710        // sanity check if we realy read the event
711 @@ -1194,6 +1232,7 @@ bool CLinuxInputDevices::CheckDevice(const char *device)
712      return false;
713    }
714  
715 +#if !defined(TARGET_VUPLUS)
716    if (ioctl(fd, EVIOCGRAB, 1) && errno != EINVAL)
717    {
718      close(fd);
719 @@ -1201,6 +1240,7 @@ bool CLinuxInputDevices::CheckDevice(const char *device)
720    }
721  
722    ioctl(fd, EVIOCGRAB, 0);
723 +#endif
724  
725    close(fd);
726  
727 @@ -1293,6 +1333,7 @@ bool CLinuxInputDevice::Open()
728      return false;
729    }
730  
731 +#if !defined(TARGET_VUPLUS)
732    /* grab device */
733    ret = ioctl(fd, EVIOCGRAB, 1);
734    if (ret && errno != EINVAL)
735 @@ -1301,6 +1342,7 @@ bool CLinuxInputDevice::Open()
736      close(fd);
737      return false;
738    }
739 +#endif
740  
741    // Set the socket to non-blocking
742    int opts = 0;
743 @@ -1327,7 +1369,7 @@ bool CLinuxInputDevice::Open()
744  
745    m_fd = fd;
746    m_vt_fd = -1;
747 -
748 +#if !defined(TARGET_VUPLUS)
749    if (m_deviceMinKeyCode >= 0 && m_deviceMaxKeyCode >= m_deviceMinKeyCode)
750    {
751      if (m_vt_fd < 0)
752 @@ -1339,7 +1381,7 @@ bool CLinuxInputDevice::Open()
753      if (m_vt_fd < 0)
754        CLog::Log(LOGWARNING, "no keymap support (requires /dev/tty0 - CONFIG_VT)");
755    }
756 -
757 +#endif
758    /* check if the device has LEDs */
759    ret = ioctl(fd, EVIOCGBIT(EV_LED, sizeof(ledbit)), ledbit);
760    if (ret < 0)
761 @@ -1367,13 +1409,14 @@ bool CLinuxInputDevice::Open()
762    return true;
763  
764  driver_open_device_error:
765 -
766 +#if !defined(TARGET_VUPLUS)
767    ioctl(fd, EVIOCGRAB, 0);
768    if (m_vt_fd >= 0)
769    {
770      close(m_vt_fd);
771      m_vt_fd = -1;
772    }
773 +#endif
774    close(fd);
775    m_fd = -1;
776  
777 @@ -1442,11 +1485,12 @@ bool CLinuxInputDevice::GetKeymapEntry(KeymapEntry& entry)
778   */
779  void CLinuxInputDevice::Close()
780  {
781 +#if !defined(TARGET_VUPLUS)
782    /* release device */
783    ioctl(m_fd, EVIOCGRAB, 0);
784 -
785    if (m_vt_fd >= 0)
786      close(m_vt_fd);
787 +#endif
788  
789    /* close file */
790    close(m_fd);
791 diff --git a/xbmc/platform/xbmc.cpp b/xbmc/platform/xbmc.cpp
792 index 34e5ea6..52cb33a 100644
793 --- a/xbmc/platform/xbmc.cpp
794 +++ b/xbmc/platform/xbmc.cpp
795 @@ -117,5 +117,9 @@ extern "C" int XBMC_Run(bool renderGUI, CFileItemList &playlist)
796    g_RBP.Deinitialize();
797  #endif
798  
799 +#if defined(TARGET_VUPLUS)
800 +  system("xbmc.helper --stop");
801 +#endif
802 +
803    return status;
804  }
805 diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp
806 index 5e2ebbd..89aecbd 100644
807 --- a/xbmc/utils/CPUInfo.cpp
808 +++ b/xbmc/utils/CPUInfo.cpp
809 @@ -272,8 +272,11 @@ CCPUInfo::CCPUInfo(void)
810      m_fProcTemperature = fopen("/sys/class/hwmon/hwmon0/temp1_input", "r");
811    if (m_fProcTemperature == NULL)   
812      m_fProcTemperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r");  // On Raspberry PIs
813 -
814 +#if defined(TARGET_VUPLUS)
815 +  m_fCPUFreq = fopen ("/sys/devices/platform/brcmstb/cpu_khz", "r");
816 +#else
817    m_fCPUFreq = fopen ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r");
818 +#endif
819    if (!m_fCPUFreq)
820    {
821      m_cpuInfoForFreq = true;
822 @@ -325,6 +328,29 @@ CCPUInfo::CCPUInfo(void)
823            StringUtils::Trim(m_cores[nCurrId].m_strModel);
824          }
825        }
826 +#if defined(TARGET_VUPLUS)
827 +      else if (strncmp(buffer, "system type", strlen("system type"))==0)
828 +      {
829 +        char *needle = strstr(buffer, ":");
830 +        if (needle && strlen(needle)>3)
831 +        {
832 +          needle+=2;
833 +          m_cpuModel = needle;
834 +          m_cores[nCurrId].m_strModel = m_cpuModel;
835 +          StringUtils::Trim(m_cores[nCurrId].m_strModel);
836 +        }
837 +      }
838 +      else if (strncmp(buffer, "cpu model", strlen("cpu model"))==0)
839 +      {
840 +        char *needle = strstr(buffer, ":");
841 +        if (needle && strlen(needle)>3)
842 +        {
843 +          needle+=2;
844 +          m_cores[nCurrId].m_strVendor = needle;
845 +          StringUtils::Trim(m_cores[nCurrId].m_strVendor);
846 +        }
847 +      }
848 +#endif
849        else if (strncmp(buffer, "BogoMIPS", strlen("BogoMIPS"))==0)
850        {
851          char *needle = strstr(buffer, ":");
852 diff --git a/xbmc/utils/posix/PosixInterfaceForCLog.cpp b/xbmc/utils/posix/PosixInterfaceForCLog.cpp
853 index a3d4983..0daee19 100644
854 --- a/xbmc/utils/posix/PosixInterfaceForCLog.cpp
855 +++ b/xbmc/utils/posix/PosixInterfaceForCLog.cpp
856 @@ -48,11 +48,19 @@ bool CPosixInterfaceForCLog::OpenLogFile(const std::string &logFilename, const s
857  {
858    if (m_file)
859      return false; // file was already opened
860 +#if defined(TARGET_VUPLUS)
861 +  if (getenv("SUPPORT_CONSOLE_LOG")) {
862 +       m_file = (FILEWRAP*) stdout;
863 +  }
864 +  else {
865 +#endif
866 +    (void)remove(backupOldLogToFilename.c_str()); // if it's failed, try to continue
867 +    (void)rename(logFilename.c_str(), backupOldLogToFilename.c_str()); // if it's failed, try to continue
868 +       m_file = (FILEWRAP*)fopen(logFilename.c_str(), "wb");
869 +#if defined(TARGET_VUPLUS)
870 +  }
871 +#endif
872  
873 -  (void)remove(backupOldLogToFilename.c_str()); // if it's failed, try to continue
874 -  (void)rename(logFilename.c_str(), backupOldLogToFilename.c_str()); // if it's failed, try to continue
875 -
876 -  m_file = (FILEWRAP*)fopen(logFilename.c_str(), "wb");
877    if (!m_file)
878      return false; // error, can't open log file
879  
880 diff --git a/xbmc/windowing/egl/EGLNativeTypeVuplus.cpp b/xbmc/windowing/egl/EGLNativeTypeVuplus.cpp
881 new file mode 100644
882 index 0000000..84e72af
883 --- /dev/null
884 +++ b/xbmc/windowing/egl/EGLNativeTypeVuplus.cpp
885 @@ -0,0 +1,181 @@
886 +/*
887 + *      Copyright (C) 2011-2017 Team XBMC
888 + *      http://xbmc.org
889 + *
890 + *  This Program is free software; you can redistribute it and/or modify
891 + *  it under the terms of the GNU General Public License as published by
892 + *  the Free Software Foundation; either version 2, or (at your option)
893 + *  any later version.
894 + *
895 + *  This Program is distributed in the hope that it will be useful,
896 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
897 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
898 + *  GNU General Public License for more details.
899 + *
900 + *  You should have received a copy of the GNU General Public License
901 + *  along with XBMC; see the file COPYING.  If not, see
902 + *  <http://www.gnu.org/licenses/>.
903 + *
904 + */
905 +
906 +#if defined(TARGET_VUPLUS)
907 +
908 +#include "system.h"
909 +#include "EGLNativeTypeVuplus.h"
910 +#include "utils/StringUtils.h"
911 +#include "utils/log.h"
912 +#include "guilib/gui3d.h"
913 +#include "linux/DllBCM.h"
914 +
915 +#include <stdio.h>
916 +#include <malloc.h>
917 +#include <assert.h>
918 +#include <stdio.h>
919 +#include <stdlib.h>
920 +#include <string.h>
921 +
922 +#include "KodiGLESPL.h"
923 +
924 +using namespace std;
925 +
926 +bool CEGLNativeTypeVuplus::CheckCompatibility()
927 +{
928 +  return true;
929 +}
930 +
931 +void CEGLNativeTypeVuplus::Initialize()
932 +{
933 +}
934 +
935 +void CEGLNativeTypeVuplus::Destroy()
936 +{
937 +}
938 +
939 +bool CEGLNativeTypeVuplus::CreateNativeDisplay()
940 +{
941 +  GLES_Native_Init();
942 +  return GLES_Native_CreateNativeDisplay(&m_nativeDisplay);
943 +}
944 +
945 +bool CEGLNativeTypeVuplus::CreateNativeWindow()
946 +{
947 +  m_nativeWindow = GLES_Native_CreateNativeWindow();
948 +  if (!m_nativeWindow) {
949 +         return false;
950 +  }
951 +  return true;
952 +}
953 +
954 +bool CEGLNativeTypeVuplus::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const
955 +{
956 +  *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay;
957 +  return true;
958 +}
959 +
960 +bool CEGLNativeTypeVuplus::GetNativeWindow(XBNativeDisplayType **nativeWindow) const
961 +{
962 +  *nativeWindow = (XBNativeWindowType*) &m_nativeWindow;
963 +  return true;
964 +}  
965 +
966 +bool CEGLNativeTypeVuplus::DestroyNativeDisplay()
967 +{
968 +  GLES_Native_DestroyNativeDisplay();
969 +  return true;
970 +}
971 +
972 +bool CEGLNativeTypeVuplus::DestroyNativeWindow()
973 +{
974 +  GLES_Native_DestroyNativeWindow();
975 +  return true;
976 +}
977 +
978 +bool CEGLNativeTypeVuplus::GetNativeResolution(RESOLUTION_INFO *res) const
979 +{
980 +  *res = m_desktopRes;
981 +  return true;
982 +}
983 +
984 +bool CEGLNativeTypeVuplus::SetNativeResolution(const RESOLUTION_INFO &res)
985 +{
986 +  m_desktopRes = res;
987 +  return true;
988 +}
989 +
990 +bool CEGLNativeTypeVuplus::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions)
991 +{
992 +  resolutions.clear();
993 +
994 +  m_desktopResAll[0].iScreen      = 0;
995 +  m_desktopResAll[0].bFullScreen  = true;
996 +  m_desktopResAll[0].iWidth       = 1280;
997 +  m_desktopResAll[0].iHeight      = 720;
998 +  m_desktopResAll[0].iScreenWidth = 1280;
999 +  m_desktopResAll[0].iScreenHeight= 720;
1000 +  m_desktopResAll[0].dwFlags      =  D3DPRESENTFLAG_PROGRESSIVE;
1001 +  m_desktopResAll[0].fRefreshRate = 50;
1002 +  m_desktopResAll[0].strMode = StringUtils::Format("%dx%d", 1280, 720);
1003 +  m_desktopResAll[0].strMode = StringUtils::Format("%s @ %.2f%s - Full Screen", m_desktopRes.strMode.c_str(), (float)50,m_desktopRes.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
1004 +
1005 +  m_desktopResAll[0].iSubtitles   = (int)(0.965 * m_desktopResAll[0].iHeight);
1006 +
1007 +  CLog::Log(LOGDEBUG, "EGL initial desktop resolution %s\n", m_desktopResAll[0].strMode.c_str());
1008 +
1009 +  resolutions.push_back(m_desktopResAll[0]);
1010 +
1011 +  m_desktopResAll[1].iScreen      = 0;
1012 +  m_desktopResAll[1].bFullScreen  = true;
1013 +  m_desktopResAll[1].iWidth       = 1280;
1014 +  m_desktopResAll[1].iHeight      = 720;
1015 +  m_desktopResAll[1].iScreenWidth = 1280;
1016 +  m_desktopResAll[1].iScreenHeight= 720;
1017 +  m_desktopResAll[1].dwFlags      =  D3DPRESENTFLAG_PROGRESSIVE;
1018 +
1019 +  m_desktopResAll[1].dwFlags      |=  D3DPRESENTFLAG_MODE3DSBS;
1020 +  m_desktopResAll[1].fRefreshRate = 50;
1021 +  m_desktopResAll[1].strMode = StringUtils::Format("%dx%d", 1280, 720);
1022 +  m_desktopResAll[1].strMode = StringUtils::Format("%s @ %.2f%s - Full Screen 3DSBS", m_desktopResAll[1].strMode.c_str(), (float)50,m_desktopResAll[1].dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
1023 +
1024 +  m_desktopResAll[1].iSubtitles   = (int)(0.965 * m_desktopResAll[1].iHeight);
1025 +
1026 +  CLog::Log(LOGDEBUG, "EGL initial desktop resolution %s\n", m_desktopResAll[1].strMode.c_str());
1027 +
1028 +  resolutions.push_back(m_desktopResAll[1]);
1029 +
1030 +  m_desktopResAll[2].iScreen      = 0;
1031 +  m_desktopResAll[2].bFullScreen  = true;
1032 +  m_desktopResAll[2].iWidth       = 1280;
1033 +  m_desktopResAll[2].iHeight      = 720;
1034 +  m_desktopResAll[2].iScreenWidth = 1280;
1035 +  m_desktopResAll[2].iScreenHeight= 720;
1036 +  m_desktopResAll[2].dwFlags      =  D3DPRESENTFLAG_PROGRESSIVE;
1037 +
1038 +  m_desktopResAll[2].dwFlags      |=  D3DPRESENTFLAG_MODE3DTB;
1039 +  m_desktopResAll[2].fRefreshRate = 50;
1040 +  m_desktopResAll[2].strMode = StringUtils::Format("%dx%d", 1280, 720);
1041 +  m_desktopResAll[2].strMode = StringUtils::Format("%s @ %.2f%s - Full Screen 3DTB", m_desktopResAll[2].strMode.c_str(), (float)50,m_desktopResAll[2].dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
1042 +
1043 +  m_desktopResAll[2].iSubtitles   = (int)(0.965 * m_desktopResAll[2].iHeight);
1044 +
1045 +  CLog::Log(LOGDEBUG, "EGL initial desktop resolution %s\n", m_desktopResAll[2].strMode.c_str());
1046 +
1047 +  resolutions.push_back(m_desktopResAll[2]);
1048 +
1049 +  m_desktopRes = m_desktopResAll[0];
1050 +
1051 +  return true;
1052 +}
1053 +
1054 +bool CEGLNativeTypeVuplus::GetPreferredResolution(RESOLUTION_INFO *res) const
1055 +{
1056 +  *res = m_desktopResAll[0];
1057 +  return true;
1058 +}
1059 +
1060 +bool CEGLNativeTypeVuplus::ShowWindow(bool show)
1061 +{
1062 +  return false;
1063 +}
1064 +
1065 +#endif /*TARGET_VUPLUS*/
1066 +
1067 diff --git a/xbmc/windowing/egl/EGLNativeTypeVuplus.h b/xbmc/windowing/egl/EGLNativeTypeVuplus.h
1068 new file mode 100644
1069 index 0000000..aa65dc8
1070 --- /dev/null
1071 +++ b/xbmc/windowing/egl/EGLNativeTypeVuplus.h
1072 @@ -0,0 +1,65 @@
1073 +#pragma once
1074 +
1075 +/*
1076 + *      Copyright (C) 2011-2017 Team XBMC
1077 + *      http://xbmc.org
1078 + *
1079 + *  This Program is free software; you can redistribute it and/or modify
1080 + *  it under the terms of the GNU General Public License as published by
1081 + *  the Free Software Foundation; either version 2, or (at your option)
1082 + *  any later version.
1083 + *
1084 + *  This Program is distributed in the hope that it will be useful,
1085 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
1086 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1087 + *  GNU General Public License for more details.
1088 + *
1089 + *  You should have received a copy of the GNU General Public License
1090 + *  along with XBMC; see the file COPYING.  If not, see
1091 + *  <http://www.gnu.org/licenses/>.
1092 + *
1093 + */
1094 +
1095 +#if defined(TARGET_VUPLUS)
1096 +
1097 +#include "EGLNativeType.h"
1098 +
1099 +#include <vector>
1100 +#include <string>
1101 +
1102 +class CEGLNativeTypeVuplus : public CEGLNativeType
1103 +{
1104 +public:
1105 +  CEGLNativeTypeVuplus()
1106 +  {
1107 +         m_nativeWindow = 0;
1108 +         m_nativeDisplay = 0;
1109 +  };
1110 +  virtual ~CEGLNativeTypeVuplus() {};
1111 +  virtual std::string GetNativeName() const { return "vuplus"; };
1112 +  virtual bool  CheckCompatibility();
1113 +  virtual void  Initialize();
1114 +  virtual void  Destroy();
1115 +  virtual int   GetQuirks() { return EGL_QUIRK_NONE; };
1116 +
1117 +  virtual bool  CreateNativeDisplay();
1118 +  virtual bool  CreateNativeWindow();
1119 +  virtual bool  GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const;
1120 +  virtual bool  GetNativeWindow(XBNativeWindowType **nativeWindow) const;
1121 +
1122 +  virtual bool  DestroyNativeWindow();
1123 +  virtual bool  DestroyNativeDisplay();
1124 +
1125 +  virtual bool  GetNativeResolution(RESOLUTION_INFO *res) const;
1126 +  virtual bool  SetNativeResolution(const RESOLUTION_INFO &res);
1127 +  virtual bool  ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions);
1128 +  virtual bool  GetPreferredResolution(RESOLUTION_INFO *res) const;
1129 +
1130 +  virtual bool  ShowWindow(bool show);
1131 +private:
1132 +  RESOLUTION_INFO m_desktopRes;
1133 +  RESOLUTION_INFO m_desktopResAll[3];
1134 +};
1135 +
1136 +#endif /*TARGET_VUPLUS*/
1137 +
1138 diff --git a/xbmc/windowing/egl/EGLWrapper.cpp b/xbmc/windowing/egl/EGLWrapper.cpp
1139 index 30f5757..ca05ae7 100644
1140 --- a/xbmc/windowing/egl/EGLWrapper.cpp
1141 +++ b/xbmc/windowing/egl/EGLWrapper.cpp
1142 @@ -37,6 +37,9 @@
1143  #if defined(TARGET_LINUX) && defined(HAS_LIBAMCODEC)
1144  #include "EGLNativeTypeAmlogic.h"
1145  #endif
1146 +#if defined(TARGET_VUPLUS)
1147 +  #include "EGLNativeTypeVuplus.h"
1148 +#endif
1149  #include "EGLWrapper.h"
1150  
1151  #define CheckError() m_result = eglGetError(); if(m_result != EGL_SUCCESS) CLog::Log(LOGERROR, "EGL error in %s: %x",__FUNCTION__, m_result);
1152 @@ -101,6 +104,8 @@ bool CEGLWrapper::Initialize(const std::string &implementation)
1153        (nativeGuess = CreateEGLNativeType<CEGLNativeTypeIMX>(implementation))
1154  #elif defined(TARGET_LINUX) && defined(HAS_LIBAMCODEC)
1155        (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlogic>(implementation))
1156 +#elif defined(TARGET_VUPLUS)
1157 +      (nativeGuess = CreateEGLNativeType<CEGLNativeTypeVuplus>(implementation))
1158  #endif
1159        )
1160    {
1161 diff --git a/xbmc/windowing/egl/Makefile.in b/xbmc/windowing/egl/Makefile.in
1162 index 68f7862..7fc6144 100644
1163 --- a/xbmc/windowing/egl/Makefile.in
1164 +++ b/xbmc/windowing/egl/Makefile.in
1165 @@ -12,6 +12,9 @@ endif
1166  ifeq (@USE_IMXVPU@,1)
1167  SRCS+= EGLNativeTypeIMX.cpp
1168  endif
1169 +ifeq (@VUPLUS_COMPILE@,yes)
1170 +SRCS+= EGLNativeTypeVuplus.cpp
1171 +endif
1172  SRCS+= EGLWrapper.cpp
1173  
1174  LIB = windowing_egl.a