Bug 6248

Summary: [regression] libva error: /usr/lib64/dri/iHD_drv_video.so init failed
Product: Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: intel-media-driverAssignee: Nicolas Chauvet <kwizart>
Status: RESOLVED FIXED    
Severity: normal CC: at694, leigh123linux, tim
Priority: P1    
Version: f36   
Hardware: x86_64   
OS: GNU/Linux   
URL: https://github.com/intel/media-driver/issues/1366
namespace:

Description Dominik 'Rathann' Mierzejewski 2022-03-28 10:52:30 CEST
After upgrading from F35, I'm unable to use VA-API:
$ lspci -nn |grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] [8086:9a49] (rev 01)

This GPU is supported by intel-media-driver only (iHD_drv_video).

$ LIBVA_DRIVER_NAME=iHD vainfo
libva info: VA-API version 1.14.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva error: /usr/lib64/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
vaInitialize failed with error code 1 (operation failed),exit

$ rpm -q intel-gmmlib intel-media-driver libva
intel-gmmlib-22.1.0-1.fc36
intel-media-driver-22.1.1-2.fc36.x86_64
libva-2.14.0-1.fc36.x86_64

This used to work in F35 with intel-media-driver-21.4.3 and downgrading to:
intel-media-driver-21.4.3-1.fc36.x86_64
intel-gmmlib-21.3.5-1.fc36.x86_64
makes things work again.
Comment 1 Dominik 'Rathann' Mierzejewski 2022-03-28 11:51:28 CEST
Upstream bug report: https://github.com/intel/media-driver/issues/1366 .
Comment 2 leigh scott 2022-03-28 17:28:00 CEST
(In reply to Dominik 'Rathann' Mierzejewski from comment #1)
> Upstream bug report: https://github.com/intel/media-driver/issues/1366 .

I believe a simple rebuild will fix the issue caused by the fedora beta freeze, try

https://koji.rpmfusion.org/koji/taskinfo?taskID=536501
Comment 3 Dominik 'Rathann' Mierzejewski 2022-03-28 23:16:06 CEST
Indeed, VA-API works again with:
intel-gmmlib-22.1.0-1.fc36.x86_64
intel-media-driver-22.1.1-3.fc36.x86_64

Thanks!

What was the issue here and why a rebuild fixed it?
Comment 4 leigh scott 2022-03-29 02:41:07 CEST
(In reply to Dominik 'Rathann' Mierzejewski from comment #3)
> Indeed, VA-API works again with:
> intel-gmmlib-22.1.0-1.fc36.x86_64
> intel-media-driver-22.1.1-3.fc36.x86_64
> 
> Thanks!
> 
> What was the issue here and why a rebuild fixed it?

I believe it was this update which broke it, maybe upstream changed something in the ABI.

https://bodhi.fedoraproject.org/updates/FEDORA-2022-2c4ac31286
Comment 5 Andreas 2022-04-01 18:15:21 CEST
Hello,

I noticed that after upgrading to F36 beta from F35 vaapi doesn't work on my Intel 11th gen laptop. For some reason the rebuilt intel-media-driver doesn't work for me:

$ lspci -nn |grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] [8086:9a49] (rev 01)

vainfo gives the following error:

vainfo
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva error: /usr/lib64/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva error: /usr/lib64/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

$ rpm -q intel-gmmlib intel-media-driver libva
intel-gmmlib-22.1.2-1.fc36.x86_64
intel-media-driver-22.1.1-3.fc36.x86_64
libva-2.14.0-1.fc36.x86_64

Now the strange thing is if I downgrade intel-media-driver to intel-media-driver-22.1.1-2.fc36.x86_64, then vaapi works.

$ vainfo
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.14 (libva 2.14.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypoin
...
Comment 6 Tim Richardson 2022-04-05 07:30:50 CEST
I have same problem. On my Thinkpad X1 G9 Tigerlake laptop, I have found no solution.
I manually installed the rebuilt .rpm but it made no difference.
Comment 7 Tim Richardson 2022-04-05 07:36:27 CEST
[tim@fedora ~]$ rpm -q intel-gmmlib
intel-gmmlib-22.1.2-1.fc36.x86_64
[tim@fedora ~]$ rpm -q intel-media-driver 
intel-media-driver-22.1.1-3.fc36.x86_64
[tim@fedora ~]$ 


[tim@fedora ~]$ lspci -nn |grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] [8086:9a49] (rev 01)
[tim@fedora ~]$ 


[tim@fedora ~]$ vainfo
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva error: /usr/lib64/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva error: /usr/lib64/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
[tim@fedora ~]$
Comment 8 Dominik 'Rathann' Mierzejewski 2022-04-05 10:54:43 CEST
Same here, but I noticed intel-gmmlib was upgraded again (to 22.1.2-1.fc36). Downgrading back to 22.1.0-1.fc36 makes VA-API work again.

intel-media-driver-22.1.1-4.fc36 from koji doesn't help here, either. It's broken with intel-gmmlib-22.1.2-1.fc36 and works with intel-gmmlib-22.1.0-1.fc36.

I guess that's not surprising, considering it was built with intel-gmmlib-22.1.0-1.fc36 in the buildroot: https://koji.rpmfusion.org/koji/buildinfo?buildID=22154 .

Rebuilding locally in mock with gmmlib-22.1.2-1.fc36 in buildroot helps, so it looks like there are ABI changes between minor gmmlib versions that require rebuilding the media-driver.
Comment 9 Dominik 'Rathann' Mierzejewski 2022-04-05 10:56:18 CEST
Leigh, Nicolas, shall we add something along the lines of:

BuildRequires: intel-gmmlib-devel = 22.1.2
Requires: intel-gmmlib%{_isa} = 22.1.2

to the intel-media-driver package?
Comment 10 Dominik 'Rathann' Mierzejewski 2022-04-05 10:59:55 CEST
Here's what abipkgdiff says:
$ abipkgdiff --d1 intel-gmmlib-debuginfo-22.1.0-1.fc36.x86_64.rpm --d2 intel-gmmlib-debuginfo-22.1.2-1.fc36.x86_64.rpm --devel1 intel-gmmlib-devel-22.1.0-1.fc36.x86_64.rpm --devel2 intel-gmmlib-devel-22.1.2-1.fc36.x86_64.rpm intel-gmmlib-22.1.0-1.fc36.x86_64.rpm intel-gmmlib-22.1.2-1.fc36.x86_64.rpm 
================ changes of 'libigdgmm.so.12.1.0'===============
  Functions changes summary: 0 Removed, 2 Changed (48 filtered out), 0 Added functions
  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

  2 functions with some indirect sub-type change:

    [C] 'function void GmmAdapterDestroy(GMM_INIT_OUT_ARGS*)' at GmmLibDllMain.cpp:76:1 has some indirect sub-type changes:
      parameter 1 of type 'GMM_INIT_OUT_ARGS*' has sub-type changes:
        in pointed to type 'typedef GMM_INIT_OUT_ARGS' at GmmLibDll.h:40:1:
          underlying type 'struct _GMM_INIT_OUT_ARGS_' at GmmLibDll.h:37:1 changed:
            type size hasn't changed
            1 data member change:
              type of 'GMM_CLIENT_CONTEXT* pGmmClientContext' changed:
                in pointed to type 'typedef GMM_CLIENT_CONTEXT' at GmmClientContext.h:180:1:
                  underlying type 'class GmmLib::GmmClientContext' at GmmClientContext.h:79:1 changed:
                    type size hasn't changed
                    2 member function changes (43 filtered):
                      'method virtual MEMORY_OBJECT_CONTROL_STATE GmmLib::GmmClientContext::CachePolicyGetMemoryObject(GMM_RESOURCE_INFO*, GMM_RESOURCE_USAGE_TYPE)' has some sub-type changes:
                        parameter 1 of type 'GMM_RESOURCE_INFO*' has sub-type changes:
                          in pointed to type 'typedef GMM_RESOURCE_INFO' at GmmResourceInfoExt.h:180:1:
                            underlying type 'typedef GmmLib::GmmResourceInfo' at GmmResourceInfoExt.h:177:1 changed:
                              underlying type 'class GmmLib::GmmResourceInfoLin' at GmmResourceInfoLin.h:36:1 changed:
                                type size changed from 13760 to 13376 (in bits)
                                2 member function insertions:
                                  'method virtual GmmLib::GmmResourceInfoLin::~GmmResourceInfoLin(int)' at GmmResourceInfoLin.h:51:1
                                  'method virtual GmmLib::GmmResourceInfoLin::~GmmResourceInfoLin(int)' at GmmResourceInfoLin.h:51:1
                                no member function changes (3 filtered);
                      'method virtual GMM_PLATFORM_INFO& GmmLib::GmmClientContext::GetPlatformInfo()' has some sub-type changes:
                        return type changed:
                          in referenced type 'typedef GMM_PLATFORM_INFO' at GmmPlatformExt.h:454:1:
                            underlying type 'struct __GMM_PLATFORM_RESOURCE_REC' at GmmPlatformExt.h:374:1 changed:
                              type size changed from 110016 to 109888 (in bits)
                              50 data member changes:
                                type of 'PLATFORM Platform' changed:
                                  underlying type 'struct PLATFORM_STR' at igfxfmid.h:212:1 changed:
                                    type size changed from 384 to 256 (in bits)
                                    4 data member deletions:
                                      'GFXCORE_FAMILY eMediaCoreFamily', at offset 256 (in bits) at igfxfmid.h:229:1
                                      'GFX_GMD_ID sDisplayBlockID', at offset 288 (in bits) at igfxfmid.h:230:1
                                      'GFX_GMD_ID sRenderBlockID', at offset 320 (in bits) at igfxfmid.h:231:1
                                      'GFX_GMD_ID sMediaBlockID', at offset 352 (in bits) at igfxfmid.h:232:1
                                '__GMM_BUFFER_TYPE Vertex' offset changed from 384 to 256 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Index' offset changed from 1152 to 1024 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Constant' offset changed from 1920 to 1792 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE StateDx9ConstantBuffer' offset changed from 2688 to 2560 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Texture2DSurface' offset changed from 3456 to 3328 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Texture2DLinearSurface' offset changed from 4224 to 4096 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Texture3DSurface' offset changed from 4992 to 4864 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE CubeSurface' offset changed from 5760 to 5632 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE BufferType' offset changed from 6528 to 6400 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Color' offset changed from 7296 to 7168 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Depth' offset changed from 8064 to 7936 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Stencil' offset changed from 8832 to 8704 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE HiZ' offset changed from 9600 to 9472 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Stream' offset changed from 10368 to 10240 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Video' offset changed from 11136 to 11008 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE MotionComp' offset changed from 11904 to 11776 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Overlay' offset changed from 12672 to 12544 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Nndi' offset changed from 13440 to 13312 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE ASyncFlipSurface' offset changed from 14208 to 14080 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE HardwareMBM' offset changed from 14976 to 14848 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE InterlacedScan' offset changed from 15744 to 15616 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE TextApi' offset changed from 16512 to 16384 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Linear' offset changed from 17280 to 17152 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE Cursor' offset changed from 18048 to 17920 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE NoRestriction' offset changed from 18816 to 18688 (in bits) (by -128 bits)
                                '__GMM_BUFFER_TYPE XAdapter' offset changed from 19584 to 19456 (in bits) (by -128 bits)
                                'GMM_TEXTURE_ALIGN TexAlign' offset changed from 20352 to 20224 (in bits) (by -128 bits)
                                'GMM_TILE_INFO TileInfo[99]' offset changed from 21248 to 21120 (in bits) (by -128 bits)
                                'uint32_t NumberFenceRegisters' offset changed from 46592 to 46464 (in bits) (by -128 bits)
                                'uint32_t MinFenceSize' offset changed from 46624 to 46496 (in bits) (by -128 bits)
                                'uint32_t FenceLowBoundShift' offset changed from 46656 to 46528 (in bits) (by -128 bits)
                                'uint32_t FenceLowBoundMask' offset changed from 46688 to 46560 (in bits) (by -128 bits)
                                'uint32_t PageTableSteer' offset changed from 46720 to 46592 (in bits) (by -128 bits)
                                'uint32_t PagingBufferPrivateDataSize' offset changed from 46752 to 46624 (in bits) (by -128 bits)
                                'uint32_t MaxLod' offset changed from 46784 to 46656 (in bits) (by -128 bits)
                                'uint32_t FBCRequiredStolenMemorySize' offset changed from 46816 to 46688 (in bits) (by -128 bits)
                                'GMM_FORMAT_ENTRY FormatTable[385]' offset changed from 46848 to 46720 (in bits) (by -128 bits)
                                'uint32_t ResAllocTag[31]' offset changed from 108448 to 108320 (in bits) (by -128 bits)
                                'uint32_t SurfaceStateYOffsetGranularity' offset changed from 109440 to 109312 (in bits) (by -128 bits)
                                'uint32_t SamplerFetchGranularityWidth' offset changed from 109472 to 109344 (in bits) (by -128 bits)
                                'uint32_t SamplerFetchGranularityHeight' offset changed from 109504 to 109376 (in bits) (by -128 bits)
                                'int64_t SurfaceMaxSize' offset changed from 109568 to 109440 (in bits) (by -128 bits)
                                'uint32_t MaxGpuVirtualAddressBitsPerResource' offset changed from 109632 to 109504 (in bits) (by -128 bits)
                                'uint32_t MaxSLMSize' offset changed from 109664 to 109536 (in bits) (by -128 bits)
                                'uint8_t HiZPixelsPerByte' offset changed from 109696 to 109568 (in bits) (by -128 bits)
                                'uint64_t ReconMaxHeight' offset changed from 109760 to 109632 (in bits) (by -128 bits)
                                'uint64_t ReconMaxWidth' offset changed from 109824 to 109696 (in bits) (by -128 bits)
                                'uint8_t NoOfBitsSupported' offset changed from 109888 to 109760 (in bits) (by -128 bits)
                                'uint64_t HighestAcceptablePhysicalAddress' offset changed from 109952 to 109824 (in bits) (by -128 bits)

    [C] 'function GMM_STATUS InitializeGmm(GMM_INIT_IN_ARGS*, GMM_INIT_OUT_ARGS*)' at GmmLibDllMain.cpp:41:1 has some indirect sub-type changes:
      parameter 1 of type 'GMM_INIT_IN_ARGS*' has sub-type changes:
        in pointed to type 'typedef GMM_INIT_IN_ARGS' at GmmLibDll.h:35:1:
          underlying type 'struct _GMM_INIT_IN_ARGS_' at GmmLibDll.h:27:1 changed:
            type size changed from 640 to 512 (in bits)
            6 data member changes:
              'PLATFORM Platform' size changed from 384 to 256 (in bits) (by -128 bits)
              'void* pSkuTable' offset changed from 384 to 256 (in bits) (by -128 bits)
              'void* pWaTable' offset changed from 448 to 320 (in bits) (by -128 bits)
              'void* pGtSysInfo' offset changed from 512 to 384 (in bits) (by -128 bits)
              'uint32_t FileDescriptor' offset changed from 576 to 448 (in bits) (by -128 bits)
              'GMM_CLIENT ClientType' offset changed from 608 to 480 (in bits) (by -128 bits)

================ end of changes of 'libigdgmm.so.12.1.0'===============
Comment 11 Dominik 'Rathann' Mierzejewski 2022-04-05 11:15:54 CEST
Ok, found the right upstream report: https://github.com/intel/gmmlib/issues/95 . It says 22.0.3 broke ABI and 22.1.2 restores it. I've just confirmed that intel-media-driver built against either gmmlib 22.0.3 or 22.1.2 on my machine works.

The following will ensure people don't end up with broken VA-API:

# ABI was broken in 22.0.3 and fixed in 22.1.2
# https://github.com/intel/gmmlib/issues/95
BuildRequires: intel-gmmlib-devel >= 22.1.2
Requires: intel-gmmlib%{_isa} >= 22.1.2

Nicolas, Leigh, what do you think?
Comment 12 Nicolas Chauvet 2022-04-05 11:30:48 CEST
(In reply to Dominik 'Rathann' Mierzejewski from comment #11)
...
> BuildRequires: intel-gmmlib-devel >= 22.1.2
> Requires: intel-gmmlib%{_isa} >= 22.1.2
Only the latest 22.1.2 will end in the f36 GA repository, so enforcing version looks spurious to me.


I plan to push 22.3.x in f36+ once the former hit the stable repository.
Comment 13 Tim Richardson 2022-04-05 23:16:13 CEST
What should I do to fix vaapi during Beta?
Comment 14 Nicolas Chauvet 2022-04-06 08:25:03 CEST
(In reply to Tim Richardson from comment #13)
> What should I do to fix vaapi during Beta?

get intel-gmmlib-22.1.2 from updates-testing (if still not yet in stable).

get: intel-media-driver 22.3.1 (once rebuilt with the former).
https://koji.rpmfusion.org/koji/taskinfo?taskID=537601
Comment 15 Tim Richardson 2022-04-06 09:20:06 CEST
thanks. The koji -2 build of intel-media-driver 22.3.1  worked for me.