i-rinat / libvdpau-va-gl

VDPAU driver with OpenGL/VAAPI backend
MIT License
161 stars 26 forks source link

Unable to compile #55

Closed extinctpotato closed 8 years ago

extinctpotato commented 8 years ago

My OS is Ubuntu 14.04.2 LTS and my machine is Acer Travelmate 240/250. I'm unable to compile libvdpau-va-gl.

adam@acer:~/Other2/libvdpau-va-gl/libvdpau-va-gl-master/build$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/i386-linux-gnu/libX11.so
-- checking for module 'vdpau'
--   found vdpau, version 0.7
-- checking for module 'glib-2.0'
--   found glib-2.0, version 2.40.2
-- checking for module 'libva-x11'
--   found libva-x11, version 0.35.0
-- checking for module 'libswscale'
--   found libswscale, version 3.1.101
-- checking for modules 'gl;glu'
--   found gl, version 11.0.4
--   found glu, version 9.0.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/build
adam@acer:~/Other2/libvdpau-va-gl/libvdpau-va-gl-master/build$ sudo make installScanning dependencies of target shader-bundle-tool
[  4%] Building C object glsl/CMakeFiles/shader-bundle-tool.dir/shader-bundle-tool.c.o
Linking C executable shader-bundle-tool
[  4%] Built target shader-bundle-tool
Scanning dependencies of target shader-bundle-src
[  9%] Generating shaders.c, shaders.h
[  9%] Built target shader-bundle-src
Scanning dependencies of target shader-bundle
[ 13%] Building C object glsl/CMakeFiles/shader-bundle.dir/shaders.c.o
Linking C static library libshader-bundle.a
[ 18%] Built target shader-bundle
Scanning dependencies of target vdpau_va_gl_obj
[ 22%] Building C object src/CMakeFiles/vdpau_va_gl_obj.dir/api-bitmap-surface.c.o
[ 27%] Building C object src/CMakeFiles/vdpau_va_gl_obj.dir/api-csc-matrix.c.o
[ 31%] Building C object src/CMakeFiles/vdpau_va_gl_obj.dir/api-device.c.o
[ 36%] Building C object src/CMakeFiles/vdpau_va_gl_obj.dir/api-output-surface.c.o
[ 40%] Building C object src/CMakeFiles/vdpau_va_gl_obj.dir/api-presentation-queue.c.o
[ 45%] Building C object src/CMakeFiles/vdpau_va_gl_obj.dir/api-video-decoder.c.o
/home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/src/api-video-decoder.c: In function ‘vdpDecoderCreate’:
/home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/src/api-video-decoder.c:78:14: error: ‘VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE’ undeclared (first use in this function)
         case VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE:
              ^
/home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/src/api-video-decoder.c:78:14: note: each undeclared identifier is reported only once for each function it appears in
/home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/src/api-video-decoder.c: In function ‘vdpDecoderQueryCapabilities’:
/home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/src/api-video-decoder.c:383:10: error: ‘VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE’ undeclared (first use in this function)
     case VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE:
          ^
/home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/src/api-video-decoder.c: In function ‘vdpDecoderRender’:
/home/adam/Other2/libvdpau-va-gl/libvdpau-va-gl-master/src/api-video-decoder.c:711:33: error: ‘VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE’ undeclared (first use in this function)
     if (decoderData->profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE ||
                                 ^
make[2]: **\* [src/CMakeFiles/vdpau_va_gl_obj.dir/api-video-decoder.c.o] Error 1
make[1]: **\* [src/CMakeFiles/vdpau_va_gl_obj.dir/all] Error 2
make: **\* [all] Error 2
i-rinat commented 8 years ago

VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE was added only in the recent version of libvdpau, that's why it's absent on 0.7. I've added compatibility macros' in 3fc29a50ad134551a8cf5424f93ce123d71cbb74. Could you check whenever source from master branch compiles now?

There were also other changes in code, so it would be nice if you check whenever it also works, not only compiles.

extinctpotato commented 8 years ago
adam@acer ~/O/l/build> cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/i386-linux-gnu/libX11.so
-- checking for module 'vdpau'
--   found vdpau, version 0.7
-- checking for module 'glib-2.0'
--   found glib-2.0, version 2.40.2
-- checking for module 'libva-x11'
--   found libva-x11, version 0.35.0
-- checking for modules 'gl;glu'
--   found gl, version 11.0.4
--   found glu, version 9.0.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/adam/Other2/libvdpau-va-gl/build
adam@acer ~/O/l/build> sudo make install
Scanning dependencies of target shader-bundle-tool
[  4%] Building C object glsl/CMakeFiles/shader-bundle-tool.dir/shader-bundle-tool.c.o
Linking C executable shader-bundle-tool
[  4%] Built target shader-bundle-tool
Scanning dependencies of target shader-bundle-src
[  9%] Generating shaders.c, shaders.h
[  9%] Built target shader-bundle-src
Scanning dependencies of target shader-bundle
[ 13%] Building C object glsl/CMakeFiles/shader-bundle.dir/shaders.c.o
Linking C static library libshader-bundle.a
[ 18%] Built target shader-bundle
Scanning dependencies of target vdpau_va_gl
[ 22%] Building CXX object src/CMakeFiles/vdpau_va_gl.dir/api-bitmap-surface.cc.o
[ 27%] Building CXX object src/CMakeFiles/vdpau_va_gl.dir/api-csc-matrix.cc.o
[ 31%] Building CXX object src/CMakeFiles/vdpau_va_gl.dir/api-decoder.cc.o
/home/adam/Other2/libvdpau-va-gl/src/api-decoder.cc: In function ‘VdpStatus vdp::Decoder::Render_h264(std::shared_ptr<vdp::Decoder::Resource>, std::shared_ptr<vdp::VideoSurface::Resource>, void* const*, uint32_t, const VdpBitstreamBuffer*)’:
/home/adam/Other2/libvdpau-va-gl/src/api-decoder.cc:531:77: error: invalid static_cast from type ‘void* const*’ to type ‘const VdpPictureInfoH264*’
     const auto *vdppi = static_cast<VdpPictureInfoH264 const *>(picture_info);
                                                                             ^
make[2]: *** [src/CMakeFiles/vdpau_va_gl.dir/api-decoder.cc.o] Error 1
make[1]: *** [src/CMakeFiles/vdpau_va_gl.dir/all] Error 2
make: *** [all] Error 2

It fails again.

i-rinat commented 8 years ago

There were another change in libvdpau: VdpPictureInfo type was changed from void * to void, which made C++ compiler unhappy.

I see no sane way to make compatibility wrappers for that change, so I've changed code to use bundled VDPAU headers instead (4f53876cce65e3fc79312f13c697f83bef226480 and a8cd82fe4dd86fde30f362febfe298d1639b79c3). Should be better now.

extinctpotato commented 8 years ago

Now it compiles with any problem, but I don't think it works:

adam@acer:/media/adam-theta/Video/Youtube$ VDPAU_DRIVER=va_gl
adam@acer:/media/adam-theta/Video/Youtube$ mpv -vo=vdpau How_To_Stop_Procrastinating-Joe_Jo.mp4 
Playing: How_To_Stop_Procrastinating-Joe_Jo.mp4
 (+) Video --vid=1 (_) (h264)
 (+) Audio --aid=1 --alang=eng (_) (aac)
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/i386-linux-gnu/dri/i915_drv_video.so
libva info: va_openDriver() returns -1
[VS] error (vdpDeviceCreateX11): gl error 1280
[vo/vdpau] Error when calling vdp_device_create_x11: 25
Error opening/initializing the selected video_out (-vo) device.
Video: no video

Exiting... (Errors when loading file)
i-rinat commented 8 years ago

Are you sure you are using recent version? I think I removed all occurrences of string "vdpDeviceCreateX11" from the code. There is no even a function named that anymore.

It could be there are another version of libvdpau-va-gl built, and libvdpau uses it. There is a list of paths that are checked, and first found library is loaded.

Try to set environment variable VDPAU_DRIVER_PATH to the path where newly built libvdpau_va_gl.so.1 resides.

i-rinat commented 8 years ago

I've just tried to test on Ubuntu 12.04, and found that libvdpau it has, doesn't know about VDPAU_DRIVER_PATH variable yet. You need either to place libvdpau_va_gl.so to some library path, or add its directory to the library search path. You could do the latter by export LD_LIBRARY_PATH=$PWD. That will add current directory.

extinctpotato commented 8 years ago
adam@acer:~/Other2/libvdpau-va-gl/build$ VDPAU_DRIVER_PATH=/home/adam/Other2/libvdpau-va-gl/build/
adam@acer:~/Other2/libvdpau-va-gl/build$ LD_LIBRARY_PATH=$PWD
adam@acer:~/Other2/libvdpau-va-gl/build$ VDPAU_DRIVER=va_gl
adam@acer:~/Other2/libvdpau-va-gl/build$ mpv -vo=vdpau /media/adam-theta/Video/Youtube/How_To_Stop_Procrastinating-Joe_Jo.mp4 
Playing: /media/adam-theta/Video/Youtube/How_To_Stop_Procrastinating-Joe_Jo.mp4
 (+) Video --vid=1 (_) (h264)
 (+) Audio --aid=1 --alang=eng (_) (aac)
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/i386-linux-gnu/dri/i915_drv_video.so
libva info: va_openDriver() returns -1
[VS] error (vdpDeviceCreateX11): gl error 1280
[vo/vdpau] Error when calling vdp_device_create_x11: 25
Error opening/initializing the selected video_out (-vo) device.
Video: no video

Exiting... (Errors when loading file)

Still no avail :/

i-rinat commented 8 years ago

$ LD_LIBRARY_PATH=$PWD

That only sets variable for current shell session, but not for child processes. Try to use

$ export LD_LIBRARY_PATH=$PWD
extinctpotato commented 8 years ago

Nope, still the same. I think it might be some sort of a problem with i915 driver though.

i-rinat commented 8 years ago

Do you have another compiled libvdpau_va_gl.so anywhere in the filesystem?

i-rinat commented 8 years ago

I think it might be some sort of a problem with i915 driver though.

It could be. Function vdpDeviceCreateX11() tries to compile couple of GPU shaders that used for colorspace conversion. As far as I know, Mesa falls back to software emulation of shaders if hardware have no appropriate support. But it could be that particular version used is returning error instead.

i-rinat commented 8 years ago

As the initially reported bug was solved, I'm going to close this issue.

As for "Acer Travelmate 240/250" machine, I did a quick search and found that's it has a Pentium 4 processor. It doesn't have a hardware video decoder, which was only introduced in Core family since about 2010.

Without VA-API support, libvdpau-va-gl will be slower and more CPU time consuming than using Xv output in video players like MPlayer or mpv, since it does data format conversion in a non-optimal way.