Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
118 Views

How can I use gstreamer plugin to use intel iGPU and NVIDIA 1080 GPU simultaneously? Error:DRM_IOCTL_I915_GEM_APERTURE failed:

Dear ALL:
 
     My computer's CPU is  intel  i7-8700K (12 cores), and also has a Nvidia  GPU: GTX 1080 card, and the OS is Ubuntu1604 LTS。
    
     I want to use gstreamer gst to test hardware accelerated decoding using intel integrated GPU and  nvidia GTX 1080 simultaneously.
 
     First, I can use  nivida deepstream  plugin for gst  to decode vedio files using gtx1080 successfully.
     The command as this:  
     #gst-launch-1.0 filesrc location=./Clip_1080_5sec_10mbps_h264.mp4  ! qtdemux ! h264parse  ! nvdec_h264 ! fakesink
 
     Second , I installed intel media sdk and gstreamer media sdk and vaapi driver from sources. 
     gst can find the mfx plugins:     
     #gst-inspect-1.0 | grep mfx  
     mfx:  mfxh264dec: MFX H264 decoder
     mfx:  mfxhevcdec: MFX HEVC decoder
     mfx:  mfxmpeg2dec: MFX MPEG2 decoder
     mfx:  mfxvc1dec: MFX VC1 decoder
     mfx:  mfxvp8dec: MFX VP8 decoder
     mfx:  mfxjpegdec: MFX JPEG decoder
     mfx:  mfxdecode: MFX Video Decoder
     mfx:  mfxvpp: MFX video postprocessing
     mfx:  mfxsinkelement: MFX sink
     mfx:  mfxsink: MFX Sink Bin
     mfx:  mfxh264enc: MFX H.264 encoder
     mfx:  mfxhevcenc: MFX H.265 encoder
     mfx:  mfxjpegenc: MFX JPEG encoder
     mfx:  mfxvc1parse: VC1 parser
          
 
     However , when I tested  gst using mfxh264dec , I got following error, I googled the error but got no useful info for this. 
     The command as this: 
     # gst-launch-1.0 filesrc location=./Clip_1080_5sec_10mbps_h264.mp4  ! qtdemux ! h264parse  ! mfxh264dec ! fakesink
 
     Error Output:
     # gst-launch-1.0 filesrc location=./Clip_1080_5sec_10mbps_h264.mp4  ! qtdemux ! h264parse  ! mfxh264dec ! fakesink
     Setting pipeline to PAUSED ...
     libva info: VA-API version 1.3.0
     libva info: va_getDriverName() returns -1
     libva info: User requested driver 'iHD'
     libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
     libva info: Found init function __vaDriverInit_1_3
     DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
     Assuming 131072kB available aperture size.
     May lead to reduced performance or incorrect rendering.
     get chip id failed: -1 [22]
     param: 4, val: 0
     libva error: /usr/local/lib/dri/iHD_drv_video.so init failed
     libva info: va_openDriver() returns 1
     ERROR: Pipeline doesn't want to pause.
     ERROR: from element /GstPipeline:pipeline0/GstMfxDec_h264:mfxdec_h264-0: Could not initialize supporting library.
     Additional debug info:
     gstvideodecoder.c(2492): gst_video_decoder_change_state (): /GstPipeline:pipeline0/GstMfxDec_h264:mfxdec_h264-0:
     Failed to open decoder
     Setting pipeline to NULL ...
     Freeing pipeline ...
     
     
    
     Following info  is  command "inxi -G  and clinfo" outputs  and /etc/X11/xorg.conf  content。
     #inxi -G
     Graphics:  Card-1: Intel Device 3e92
                Card-2: NVIDIA Device 1b80
                Display Server: N/A driver: nvidia tty size: 231x59 Advanced Data: N/A out of X
     
     #clinfo        
      DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
      Assuming 131072kB available aperture size.
      May lead to reduced performance or incorrect rendering.
      get chip id failed: -1 [22]
      param: 4, val: 0
      Number of platforms                               2
        Platform Name                                   NVIDIA CUDA
        Platform Vendor                                 NVIDIA Corporation
        Platform Version                                OpenCL 1.2 CUDA 9.2.210
        Platform Profile                                FULL_PROFILE
        Platform Extensions                             cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store 
      
      cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer
        Platform Extensions function suffix             NV
      
        Platform Name                                   Intel Gen OCL Driver
        Platform Vendor                                 Intel
        Platform Version                                OpenCL 1.2 beignet 1.1.1
        Platform Profile                                FULL_PROFILE
        Platform Extensions                             cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir 
      
        cl_khr_icd
        Platform Extensions function suffix             Intel
      DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
      Assuming 131072kB available aperture size.
      May lead to reduced performance or incorrect rendering.
      get chip id failed: -1 [22]
      param: 4, val: 0
      beignet-opencl-icd: no supported GPU found, this is probably the wrong opencl-icd package for this hardware
      (If you have multiple ICDs installed and OpenCL works, you can ignore this message)
      
        Platform Name                                   NVIDIA CUDA
        Number of devices                                 1
        Device Name                                     GeForce GTX 1080
        Device Vendor                                   NVIDIA Corporation
        Device Vendor ID                                0x10de
        Device Version                                  OpenCL 1.2 CUDA
        Driver Version                                  396.54
        Device OpenCL C Version                         OpenCL C 1.2 
        Device Type                                     GPU
        Device Profile                                  FULL_PROFILE
        Device Topology (NV)                            PCI-E, 01:00.0
        Max compute units                               20
        Max clock frequency                             1809MHz
        Compute Capability (NV)                         6.1
        Device Partition                                (core)
          Max number of sub-devices                     1
          Supported partition types                     None
        Max work item dimensions                        3
        Max work item sizes                             1024x1024x64
        Max work group size                             1024
        Preferred work group size multiple              32
        Warp size (NV)                                  32
        Preferred / native vector sizes                 
          char                                                 1 / 1       
          short                                                1 / 1       
          int                                                  1 / 1       
          long                                                 1 / 1       
          half                                                 0 / 0        (n/a)
          float                                                1 / 1       
          double                                               1 / 1        (cl_khr_fp64)
        Half-precision Floating-point support           (n/a)
        Single-precision Floating-point support         (core)
          Denormals                                     Yes
          Infinity and NANs                             Yes
          Round to nearest                              Yes
          Round to zero                                 Yes
          Round to infinity                             Yes
          IEEE754-2008 fused multiply-add               Yes
          Support is emulated in software               No
          Correctly-rounded divide and sqrt operations  Yes
        Double-precision Floating-point support         (cl_khr_fp64)
          Denormals                                     Yes
          Infinity and NANs                             Yes
          Round to nearest                              Yes
          Round to zero                                 Yes
          Round to infinity                             Yes
          IEEE754-2008 fused multiply-add               Yes
          Support is emulated in software               No
          Correctly-rounded divide and sqrt operations  No
        Address bits                                    64, Little-Endian
        Global memory size                              8510701568 (7.926GiB)
        Error Correction support                        No
        Max memory allocation                           2127675392 (1.982GiB)
        Unified memory for Host and Device              No
        Integrated memory (NV)                          No
        Minimum alignment for any data type             128 bytes
        Alignment of base address                       4096 bits (512 bytes)
        Global Memory cache type                        Read/Write
        Global Memory cache size                        327680
        Global Memory cache line                        128 bytes
        Image support                                   Yes
          Max number of samplers per kernel             32
          Max size for 1D images from buffer            134217728 pixels
          Max 1D or 2D image array size                 2048 images
          Max 2D image size                             16384x32768 pixels
          Max 3D image size                             16384x16384x16384 pixels
          Max number of read image args                 256
          Max number of write image args                16
        Local memory type                               Local
        Local memory size                               49152 (48KiB)
        Registers per block (NV)                        65536
        Max constant buffer size                        65536 (64KiB)
        Max number of constant args                     9
        Max size of kernel argument                     4352 (4.25KiB)
        Queue properties                                
          Out-of-order execution                        Yes
          Profiling                                     Yes
        Prefer user sync for interop                    No
        Profiling timer resolution                      1000ns
        Execution capabilities                          
          Run OpenCL kernels                            Yes
          Run native kernels                            No
          Kernel execution timeout (NV)                 Yes
        Concurrent copy and kernel execution (NV)       Yes
          Number of async copy engines                  2
        printf() buffer size                            1048576 (1024KiB)
        Built-in kernels                                
        Device Available                                Yes
        Compiler Available                              Yes
        Linker Available                                Yes
        Device Extensions                               cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store 
      
      cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer
      
        Platform Name                                   Intel Gen OCL Driver
      Number of devices                                 0
      
      NULL platform behavior
        clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
        clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
        clCreateContext(NULL, ...) [default]            No platform
        clCreateContext(NULL, ...) [other]              Success [NV]
        clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No platform
        clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No platform
        clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No platform
        clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No platform
        clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No platform
      
      
        # cat /etc/X11/xorg.conf
      Section "ServerLayout"
          Identifier "layout"
          Screen 0 "nvidia"
          Inactive "intel"
      EndSection
      
      Section "Device"
          Identifier "intel"
          Driver "modesetting"
          BusID "PCI:0@0:2:0"
          Option "AccelMethod" "None"
      EndSection
      
      Section "Screen"
          Identifier "intel"
          Device "intel"
      EndSection
      
      Section "Device"
          Identifier "nvidia"
          Driver "nvidia"
          BusID "PCI:1@0:0:0"
          Option "ConstrainCursor" "off"
      EndSection
      
      Section "Screen"
          Identifier "nvidia"
          Device "nvidia"
          Option "AllowEmptyInitialConfiguration" "on"
          Option "IgnoreDisplayDevices" "CRT"
      EndSection
      
  
    #lspci 
00:00.0 Host bridge: Intel Corporation Device 3ec2 (rev 07)
00:01.0 PCI bridge: Intel Corporation Sky Lake PCIe Controller (x16) (rev 07)
00:02.0 Display controller: Intel Corporation Device 3e92
00:08.0 System peripheral: Intel Corporation Sky Lake Gaussian Mixture Model
00:14.0 USB controller: Intel Corporation Device a2af
00:14.2 Signal processing controller: Intel Corporation Device a2b1
00:16.0 Communication controller: Intel Corporation Device a2ba
00:17.0 SATA controller: Intel Corporation Device a282
00:1c.0 PCI bridge: Intel Corporation Device a290 (rev f0)
00:1c.3 PCI bridge: Intel Corporation Device a293 (rev f0)
00:1f.0 ISA bridge: Intel Corporation Device a2c9
00:1f.2 Memory controller: Intel Corporation Device a2a1
00:1f.3 Audio device: Intel Corporation Device a2f0
00:1f.4 SMBus: Intel Corporation Device a2a3
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1b80 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 10f0 (rev a1)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
  
        #ll /sys/class/graphics/
        total 0
        drwxr-xr-x  2 root root 0 10月  9 21:49 ./
        drwxr-xr-x 66 root root 0 10月  9 21:41 ../
        lrwxrwxrwx  1 root root 0 10月  9 21:41 fb0 -> ../../devices/platform/efi-framebuffer.0/graphics/fb0/
        lrwxrwxrwx  1 root root 0 10月  9 21:44 fb1 -> ../../devices/pci0000:00/0000:00:02.0/graphics/fb1/
        lrwxrwxrwx  1 root root 0 10月  9 21:41 fbcon -> ../../devices/virtual/graphics/fbcon/
              
      
        Please help me , what should I do ?  
        Could it be that BIOS  not configured or driver not right  or something else? 
        I found someone said that's opencl render error about x11 because I have two GPUs. I dont know what that mean.
        How can i use intel iGPU and nvidia GPU simultaneously?  
0 Kudos
4 Replies
Highlighted
118 Views

Hi AjS,

Thanks for reporting your experience on gstreamer.

I'd recommend searching for more information on the Intel Media Sdk forums. https://software.intel.com/en-us/forums/intel-media-sdk

I've used Intel Media SDK briefly, the quickest and best comment I can provide is that if this is the gstreamer plugin interface provided via media sdk... please ensure the system meets Media SDK platform requirements for libraries and kernel. The correct libva and i915 kernel module are critical for Intel® Graphics Technology usage. The error is suggestive of a runtime and kernel module mismatch.

The releases page on github does a good job of explaining media sdk requirements. https://github.com/Intel-Media-SDK/Media-SDK/releases

For gstreamer reference: https://github.com/intel/gstreamer-media-sdk

 

-MichaelC

0 Kudos
Highlighted
Beginner
118 Views

Hi MICHAEL:

     Thanks for your recommendation. I will try.

 

MICHAEL C. (Intel) wrote:

Hi AjS,

Thanks for reporting your experience on gstreamer.

I'd recommend searching for more information on the Intel Media Sdk forums. https://software.intel.com/en-us/forums/intel-media-sdk

I've used Intel Media SDK briefly, the quickest and best comment I can provide is that if this is the gstreamer plugin interface provided via media sdk... please ensure the system meets Media SDK platform requirements for libraries and kernel. The correct libva and i915 kernel module are critical for Intel® Graphics Technology usage. The error is suggestive of a runtime and kernel module mismatch.

The releases page on github does a good job of explaining media sdk requirements. https://github.com/Intel-Media-SDK/Media-SDK/releases

For gstreamer reference: https://github.com/intel/gstreamer-media-sdk

 

-MichaelC

0 Kudos
Highlighted
118 Views

For libva, iHD_drv_video.so from mediasdk installed by OpenVINO should be used. try:

export LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64

 

--

Shaoqiang

0 Kudos
Highlighted
118 Views

Hi AjS,

If you observe something clunky or restrictive about libva usage, any comments would be appreciated here. Happy to pass them on to media stakeholders.

Thanks,

 

-MichaelC

0 Kudos