From fad01b4d2e5a56fe9370b5074f3043275ddbb9d8 Mon Sep 17 00:00:00 2001 From: Marcel Saegebarth Date: Fri, 6 Mar 2015 23:31:47 +0700 Subject: [PATCH] libraries/libvdpau-va-gl: Added (VDPAU driver with VA-API/OpenGL). Signed-off-by: Willy Sudiarto Raharjo --- libraries/libvdpau-va-gl/README | 30 +++++ libraries/libvdpau-va-gl/doinst.sh | 15 +++ .../libvdpau-va-gl/libvdpau-va-gl.SlackBuild | 103 ++++++++++++++++++ libraries/libvdpau-va-gl/libvdpau-va-gl.info | 10 ++ .../libvdpau-va-gl/profile.d/vdpau-va-gl.csh | 3 + .../libvdpau-va-gl/profile.d/vdpau-va-gl.sh | 4 + libraries/libvdpau-va-gl/slack-desc | 19 ++++ 7 files changed, 184 insertions(+) create mode 100644 libraries/libvdpau-va-gl/README create mode 100644 libraries/libvdpau-va-gl/doinst.sh create mode 100644 libraries/libvdpau-va-gl/libvdpau-va-gl.SlackBuild create mode 100644 libraries/libvdpau-va-gl/libvdpau-va-gl.info create mode 100644 libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.csh create mode 100644 libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.sh create mode 100644 libraries/libvdpau-va-gl/slack-desc diff --git a/libraries/libvdpau-va-gl/README b/libraries/libvdpau-va-gl/README new file mode 100644 index 0000000000..628ba5215a --- /dev/null +++ b/libraries/libvdpau-va-gl/README @@ -0,0 +1,30 @@ +Briefly, this is the VDPAU driver with VA-API/OpenGL backend. + +There are applications exists that can use VDPAU. Amongst them are +Adobe Flash Player and Mplayer. They both can use VDPAU, but since +there is no VDPAU available on Intel chips, they fall back to +different drawing techniques. And while Mplayer can use XVideo +extension to offload scaling to GPU, Flash Player can not and does +all scaling in software. If there was VDPAU available, CPU usage +could be significantly lower. + +VDPAU is not vendor-locked technology. Even official documentation +mentions possibility of other drivers. They should be named as +libvdpau_drivername.so.1 and placed where linker could find them. +/usr/lib usually works fine. Which driver to use is determined by +asking X server about current driver name or by using VDPAU_DRIVER +environment variable. + +Here is one. Named libvdpau_va_gl.so.1, it uses OpenGL under the +hood to accelerate drawing and scaling and VA-API (if available) +to accelerate video decoding. For now VA-API is available on some +Intel chips, and on some AMD video adapters with help of +xvba-va-driver. OpenGL is available, you know, on systems with +OpenGL available. + +Note: + +This SlackBuild creates scripts in /etc/profile.d for enabling +the backend. This may conflicts with the dependent `libvdpau' +package. Whilst `libvdpau' has the VDPAU_DRIVER variable disabled +per default it may conflicts if you changed anything in there. diff --git a/libraries/libvdpau-va-gl/doinst.sh b/libraries/libvdpau-va-gl/doinst.sh new file mode 100644 index 0000000000..76c6259a2d --- /dev/null +++ b/libraries/libvdpau-va-gl/doinst.sh @@ -0,0 +1,15 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/profile.d/vdpau-va-gl.sh.new +config etc/profile.d/vdpau-va-gl.csh.new diff --git a/libraries/libvdpau-va-gl/libvdpau-va-gl.SlackBuild b/libraries/libvdpau-va-gl/libvdpau-va-gl.SlackBuild new file mode 100644 index 0000000000..28549f1327 --- /dev/null +++ b/libraries/libvdpau-va-gl/libvdpau-va-gl.SlackBuild @@ -0,0 +1,103 @@ +#!/bin/sh + +# Slackware build script for "libvdpau-va-gl". + +# Copyright 2015 Marcel Saegebarth +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=libvdpau-va-gl +VERSION=${VERSION:-0.3.4} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +mkdir -p build +cd build + cmake \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLIB_SUFFIX=${LIBDIRSUFFIX} \ + -DCMAKE_BUILD_TYPE=Release .. + make + make install/strip DESTDIR=$PKG +cd .. + +mkdir -p $PKG/etc/profile.d +cp -a $CWD/profile.d/vdpau-va-gl.sh $PKG/etc/profile.d/vdpau-va-gl.sh.new +cp -a $CWD/profile.d/vdpau-va-gl.csh $PKG/etc/profile.d/vdpau-va-gl.csh.new +chown root:root $PKG/etc/profile.d/* +chmod 755 $PKG/etc/profile.d/* + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + COPYING COPYING.GPLv3 COPYING.LGPLv3 ChangeLog README.md \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/libraries/libvdpau-va-gl/libvdpau-va-gl.info b/libraries/libvdpau-va-gl/libvdpau-va-gl.info new file mode 100644 index 0000000000..cc4d7b3338 --- /dev/null +++ b/libraries/libvdpau-va-gl/libvdpau-va-gl.info @@ -0,0 +1,10 @@ +PRGNAM="libvdpau-va-gl" +VERSION="0.3.4" +HOMEPAGE="https://github.com/i-rinat/libvdpau-va-gl/" +DOWNLOAD="https://github.com/i-rinat/libvdpau-va-gl/releases/download/v0.3.4/libvdpau-va-gl-0.3.4.tar.gz" +MD5SUM="09ceb2f75eafccc9b002d35ede0de6a5" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="libvdpau ffmpeg libva" +MAINTAINER="Marcel Saegebarth" +EMAIL="marc@mos6581.de" diff --git a/libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.csh b/libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.csh new file mode 100644 index 0000000000..e5904d5fbe --- /dev/null +++ b/libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.csh @@ -0,0 +1,3 @@ +#!/bin/csh + +setenv VDPAU_DRIVER=va_gl diff --git a/libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.sh b/libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.sh new file mode 100644 index 0000000000..d39e5d69e5 --- /dev/null +++ b/libraries/libvdpau-va-gl/profile.d/vdpau-va-gl.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +VDPAU_DRIVER=va_gl +export VDPAU_DRIVER=va_gl diff --git a/libraries/libvdpau-va-gl/slack-desc b/libraries/libvdpau-va-gl/slack-desc new file mode 100644 index 0000000000..e4d0b18f6f --- /dev/null +++ b/libraries/libvdpau-va-gl/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +libvdpau-va-gl: libvdpau-va-gl (VDPAU driver with VA-API/OpenGL backend) +libvdpau-va-gl: +libvdpau-va-gl: VDPAU driver with VA-API/OpenGL backend. +libvdpau-va-gl: +libvdpau-va-gl: Homepage: https://github.com/i-rinat/libvdpau-va-gl/ +libvdpau-va-gl: +libvdpau-va-gl: +libvdpau-va-gl: +libvdpau-va-gl: +libvdpau-va-gl: +libvdpau-va-gl: