Coder Social home page Coder Social logo

gmmlib's Introduction

Intel(R) Graphics Memory Management Library

Introduction

The Intel(R) Graphics Memory Management Library provides device specific and buffer management for the Intel(R) Graphics Compute Runtime for OpenCL(TM) and the Intel(R) Media Driver for VAAPI.

License

The Intel(R) Graphics Memory Management Library is distributed under the MIT Open Source license.

You may obtain a copy of the License at:

https://opensource.org/licenses/MIT

Building

  1. Get gmmlib repository

    git clone https://github.com/intel/gmmlib.git

  2. Change it to root directory

    $ cd gmmlib

  3. Make a build directory

    $ mkdir build && cd build

  4. Run the cmake command to prepare build files

$ cmake [-DCMAKE_BUILD_TYPE=Release | Debug | ReleaseInternal] ..
where,
-DCMAKE_BUILD_TYPE can be set to one build type flag at a time.
Example:
$ cmake -DCMAKE_BUILD_TYPE=Release .., For Release build
  1. Build the project

    $ make -j"$(nproc)" (Also performs compile time ULT)

Install

$ sudo make install

This will install the following files (e.g. on Ubuntu):

-- Install configuration: "Release"
-- Installing: /usr/local/lib/libigdgmm.so.12.1.0
-- Installing: /usr/local/lib/libigdgmm.so.12

Not a stand alone software component. GmmLib is built as dynamic library for Intel media driver and Compute runtime for OpenCL

Supported Platforms

Intel Atom and Core Processors supporting Gen8/Gen9/Gen10 graphics devices

BDW (Broadwell)

SKL (Skylake, Kaby Lake, Coffee Lake)

BXTx (BXT: Broxton, APL: Apollo Lake, GLK: Gemini Lake)

KBLx (KBL: Kaby Lake, CFL: Coffe Lake, WHL: Whiskey Lake, CML: Comet Lake, AML: Amber Lake)

CNL (Cannonlake)

ICL (Icelake)

TGLx (TGL: Tiger Lake, RKL: Rocket Lake)

ADLx (ADL-S: Alder Lake S, ADL-P: Alder Lake P, ADL-N: Alder Lake N)

XE_LP (DG1)

XE_HP (XE_HP_SDV)

XE_HPC (PVC: Ponte Vecchio)

XE_HPG (DG2, ACM: Alchemist)

Xe_LPG (MTL: Meteor Lake, ARL: Arrow Lake)

Release Tags

Gmmlib Release tag versioning schema follows:

Tag intel-gmmlib-<x>.<y>.<z> will be stable release series with the same API and ABI version with only bug fixes where,
x = GMMLIB_API_MAJOR_VERSION + 10,
y = GMMLIB_API_MINOR_VERSION,
z = RELEASE NUMBER which is incremented as 0,1,2,...n for changes including new flag, bug fixes, etc.

Example:
For GMM library libigdgmm.so.12.0.0,
Tag = intel-gmmlib-22.0.0 where,
22 = GMMLIB_API_MAJOR_VERSION + 10 = 12 + 10
0 = GMMLIB_API_MINOR_VERSION
0 = RELEASE NUMBER

On potential ABI break changes,

Tag intel-gmmlib-<x>.<y>.<z> becomes intel-gmmlib-<x + 1>.0.0
i.e intel-gmmlib-22.5.3 becomes intel-gmmlib-23.0.0

Known Issues and Limitations

Current Gmmlib support only limited to Linux

(*) Other names and brands may be claimed as property of others.

gmmlib's People

Contributors

arturharasimiuk avatar downor avatar drprajap avatar dvrogozh avatar jana1981 avatar johnbash avatar johnmach avatar kmvadsar avatar lpriyank-intel avatar manish7093 avatar mmeenaks-gh avatar priyankg22 avatar pwilma avatar shankarprashanth avatar simonxu2020 avatar uartie avatar vinitazad avatar xuguangxin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gmmlib's Issues

ULT TEST_BPP warning

Hi, When building 20.4.1 on Chrome OS the following warnings are observed.

Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp:2122:57: warning: result of comparison of constant 8 with expression of type 'TEST_BPP' (aka 'TEST_BPP_ENUM') is always true [-Wtautological-constant-out-of-range-compare]
        gmmParams.Flags.Info.AllowVirtualPadding = (bpp != 8); //OCL uses 8bpp buffers. Specification doesn't comment if Linear buffer compr allowed or not on bpp!=8.
                                                    ~~~ ^  ~
Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp:2167:57: warning: result of comparison of constant 8 with expression of type 'TEST_BPP' (aka 'TEST_BPP_ENUM') is always true [-Wtautological-constant-out-of-range-compare]
        gmmParams.Flags.Info.AllowVirtualPadding = (bpp != 8); //OCL uses 8bpp buffers. Specification doesn't comment if Linear buffer compr allowed or not on bpp!=8.
                                                    ~~~ ^  ~
2 warnings generated.
Source/GmmLib/ULT/GmmGen12ResourceULT.cpp:2117:57: warning: result of comparison of constant 8 with expression of type 'TEST_BPP' (aka 'TEST_BPP_ENUM') is always true [-Wtautological-constant-out-of-range-compare]
        gmmParams.Flags.Info.AllowVirtualPadding = (bpp != 8); //OCL uses 8bpp buffers. doc doesn't comment if Linear buffer compr allowed or not on bpp!=8.
                                                    ~~~ ^  ~
Source/GmmLib/ULT/GmmGen12ResourceULT.cpp:2162:57: warning: result of comparison of constant 8 with expression of type 'TEST_BPP' (aka 'TEST_BPP_ENUM') is always true [-Wtautological-constant-out-of-range-compare]
        gmmParams.Flags.Info.AllowVirtualPadding = (bpp != 8); //OCL uses 8bpp buffers. document doesn't comment if Linear buffer compr allowed or not on bpp!=8.
                                                    ~~~ ^  ~
2 warnings generated.

Fixture TestLinearCompressedResource is looping through TEST_BPP values (0, 1, 2, 3, 4). Comparing to 8 is outside of the available enum options.

Do not impose -fno-strict-aliasing in compiler flags

When removing, this kind of warnings start showing up

common/gfxmacro.h:193:18: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
ux = mask & *(uint32_t *) &fx;
^~~~~~~~~~~~~~~~

tagging a release

What is the plan to tag releases for this project? What combination is desired with media-driver and libva? I'd like to create a package with a released version of gmmlib.

Remove ARCH from cmake files and detect architecture asking compiler

Please, remove ARCH from all cmake files. This will break cross compilation support. Instead, detect architecture as follows:

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    message("architecture: 64-bit")
else()
    message("architecture: 32-bit")
endif()

CMAKE_SIZEOF_VOID_P will be set for you by cmake: cmake will ask compiler which you are going to use, so you will have 100% guarantee to correctly detect architecture

Fail to link against libigdgmm.so in media-driver

/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva.cpp:5745: undefined reference to `GmmResGetSizeSurface'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva.cpp.o: In function `DdiMedia_CreateImage(VADriverContext*, _VAImageFormat*, int, int, _VAImage*)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva.cpp:3830: undefined reference to `GmmResCreate'
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva.cpp:3895: undefined reference to `GmmResFree'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva.cpp.o: In function `DdiMedia_Terminate(VADriverContext*)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva.cpp:1634: undefined reference to `GmmDestroyGlobalContext'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva.cpp.o: In function `DdiMedia__Initialize(VADriverContext*, int*, int*)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva.cpp:1403: undefined reference to `GmmInitGlobalContext'
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva.cpp:1475: undefined reference to `pGmmGlobalContext'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/cm/cm_hal_os.cpp.o: In function `HalCm_GetSurfPitchSize':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/cm/cm_hal_os.cpp:370: undefined reference to `GmmResCreate'
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/cm/cm_hal_os.cpp:375: undefined reference to `GmmResFree'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva_util.cpp.o: In function `DdiMediaUtil_AllocateBuffer':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:676: undefined reference to `GmmResCreate'
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:679: undefined reference to `GmmResOverrideAllocationSize'
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:680: undefined reference to `GmmResOverrideAllocationBaseWidth'
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:681: undefined reference to `GmmResOverrideAllocationPitch'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva_util.cpp.o: In function `DdiMediaUtil_Allocate2DBuffer':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:729: undefined reference to `GmmResCreate'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva_util.cpp.o: In function `DdiMediaUtil_FreeSurface(_DDI_MEDIA_SURFACE*)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:1067: undefined reference to `GmmResFree'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva_util.cpp.o: In function `DdiMediaUtil_AllocateSurface':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:500: undefined reference to `GmmResCreate'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva_util.cpp.o: In function `DdiMediaUtil_FreeBuffer(_DDI_MEDIA_BUFFER*)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_util.cpp:1096: undefined reference to `GmmResFree'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/ddi/media_libva_putsurface_linux.cpp.o: In function `DdiCodec_PutSurfaceLinuxHW(VADriverContext*, unsigned int, void*, short, short, unsigned short, unsigned short, short, short, unsigned short, unsigned short, _VARectangle*, unsigned int, unsigned int)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_putsurface_linux.cpp:488: undefined reference to `GmmResCreate'
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/ddi/media_libva_putsurface_linux.cpp:532: undefined reference to `GmmResFree'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/os/mos_context_specific.cpp.o: In function `OsContextSpecific::Destroy()':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/os/mos_context_specific.cpp:659: undefined reference to `GmmDeleteClientContext'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/os/mos_context_specific.cpp.o: In function `OsContextSpecific::Init(_MOS_OS_CONTEXT*)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/os/mos_context_specific.cpp:508: undefined reference to `GmmCreateClientContext'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/os/mos_os_specific.c.o: In function `Linux_Destroy(_MOS_OS_CONTEXT*, int, int)':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/os/mos_os_specific.c:1004: undefined reference to `GmmDeleteClientContext'
CMakeFiles/iHD_drv_video_OBJ.dir/linux/common/os/mos_os_specific.c.o: In function `Mos_Specific_InitInterface':
/home/dvrogozh/git/github/clean/media-driver/media_driver/linux/common/os/mos_os_specific.c:5758: undefined reference to `GmmCreateClientContext'
collect2: error: ld returned 1 exit status
make[2]: *** [media_driver/iHD_drv_video.so] Error 1
make[1]: *** [media_driver/CMakeFiles/iHD_drv_video.dir/all] Error 2
make: *** [all] Error 2

To reproduce:

  1. Apply intel/media-driver#270
  2. Try to configure and build media driver - you will see the above link error

Detailed repro steps:

git clone https://github.com/intel/media-driver.git && cd media-driver
git fetch origin pull/270/head:gmmlib_via_pkgconfig
git checkout gmmlib_via_pkgconfig
export PKG_CONFIG_PATH=/path/to/gmmlib/install/location/pkgconfig/igdgmm.pc
mkdir build && cd build
cmake ..
make -j8

gmmlib build warnings

Git head build with Ubuntu 18.04 gcc v7.4:

/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp: In member function 'v
irtual GMM_GFX_ADDRESS GmmLib::GmmPageTableMgr::GetAuxL3TableAddr()':
Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp:415:50: warning: conve
rting to non-pointer type 'long unsigned int' from NULL [-Wconversion-null]
     return AuxTTObj ? AuxTTObj->GetL3Address() : NULL;
                                                  ^~~~
/home/benchsrv/source/gmmlib/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp: In member function 'virtual GMM_STATUS GmmLib::GmmPageTableMgr::UpdateAuxTable(const GMM_DDI_UPDATEAUXTABLE*)':
/home/benchsrv/source/gmmlib/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp:474:31: warning: NULL used in arithmetic [-Wpointer-arith]
     if(GetAuxL3TableAddr() == NULL)

truncation from 'int' to bit-field changes value from 3 to 1 [-Werror,-Wbitfield-constant-conversion]

step to reproduce.

  1. apply this commit #12
  2. build with CFLAGS="-Werror -Wbitfield-constant-conversion" CXXFLAGS="-Werror -Wbitfield-constant-conversion" cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"

you will see errors like this:

/sdb/other/gmmlib/Source/GmmLib/CachePolicy/GmmGen10CachePolicy.h:130:1: error: implicit truncation from 'int' to bit-field changes value from 3 to 1 [-Werror,-Wbitfield-constant-conversion]
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_L3_SurfaceState,                                  0   , 1    , 0  , 3   ,3,      0,       0,      0,   0,    0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sdb/other/gmmlib/Source/GmmLib/CachePolicy/GmmGen10CachePolicy.cpp:45:96: note: expanded from macro 'DEFINE_CACHE_ELEMENT'
#define DEFINE_CACHE_ELEMENT(usage, llc, ellc, l3, wt, age, lecc_scc, l3_scc, sso, cos, hdcl1) DEFINE_CP_ELEMENT(usage, llc, ellc, l3, wt, age, 0, lecc_scc, l3_scc, 0, sso, cos, hdcl1, 0)
                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sdb/other/gmmlib/Source/GmmLib/inc/External/Common/CachePolicy/../GmmCachePolicyCommon.h:83:53: note: expanded from macro 'DEFINE_CP_ELEMENT'
                    pCachePolicy[Usage].WT          = (wt);                                                                  \
                                                    ^ ~~~~

The WT is 1 bits variable but the code assign 3 to it

please conside fix it.thanks

GmmUmdTranslationTable initialize NodesPerTable in order

Hi, When building 20.4.1 on Chrome OS the following warnings are observed.

Source/GmmLib/TranslationTable/../TranslationTable/GmmUmdTranslationTable.h:456:13: warning: field 'NodesPerTable' will be initialized after field 'TTType' [-Wreorder-ctor]
            NodesPerTable(Size / PAGE_SIZE),
            ^

Supported Platforms

Readme :

  • Intel Atom and Core Processors supporting Gen9/Gen10 graphics devices
  • BDW (Broadwell)
  • SKL (Skylake)
  • CNL (Cannonlake)

What about Apollo Lake architecture ?

-- The Intel media driver that requires this project for its build is expected to supports APL. --

Haswell support

Is it posible to support Haswell?

If yes, can this be implemented?

Thanks.

ABI Break introduced in 19.3.4 release tag.

GMMLib is creating revert for ABI break introduced in 19.3.4 release to save package maintenance cost to open source distributions. SO version name will be updated back to libigdgmm.so.11 in future release. Please discard libigdgmm.so.12, no support will continue in future for same.

All existing functionality in libigdgmm.so.11 will be maintained as is.

Switch to CMAKE_BUILD_TYPE from BUILD_TYPE

gmmlib uses BUILD_TYPE variable to select build type. Can you switch to use CMAKE_BUILD_TYPE instead of?
Currently when we run:

cmake ../gmmlib -DCMAKE_BUILD_TYPE=Debug

gmmlib will be built as Release

*BUILD_TYPE not defined, default to: release

gmmlib build QA warnings

Git head on gentoo gcc 9.2

  • QA Notice: Package triggers severe warnings which indicate that it
  •        may exhibit random runtime failures.
    
  • /var/tmp/portage/media-libs/gmmlib-9999/work/gmmlib-9999/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp:415:50: warning: converting to non-pointer type 'long unsigned int' from NULL [-Wconversion-null]
  • /var/tmp/portage/media-libs/gmmlib-9999/work/gmmlib-9999/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp:474:31: warning: NULL used in arithmetic [-Wpointer-arith]

FindThreads.cmake:121 (CHECK_INCLUDE_FILE)

Trying to compile version 19.4.1 on linux.
Was facing the issue while trying to cross-compile using spksrc toolstack.
I ended-up giving a try on a plain ubuntu and getting the exact same error.
Help on this would be much appreciated.

I'm unable to get passed the cmake portion as I always end-up getting the following error:

...
platform: Linux
source_dir: /home/whoami/gmmlib-intel-gmmlib-19.4.1/Source/GmmLib
arch: 64
build type: Release
SourceConfiguration:
CommonDir: /home/whoami/gmmlib-intel-gmmlib-19.4.1/Source/Common
IncDir: /home/whoami/gmmlib-intel-gmmlib-19.4.1/Source/inc
MOCS table: Static
CMake Error at /usr/share/cmake-3.13/Modules/CheckIncludeFile.cmake:50 (configure_file):
  configure_file attempted to configure a file:
  /home/whoami/gmmlib-intel-gmmlib-19.4.1/CMakeFiles/CMakeTmp/CheckIncludeFile.c
  into a source directory.
Call Stack (most recent call first):
  /usr/share/cmake-3.13/Modules/FindThreads.cmake:121 (CHECK_INCLUDE_FILE)
  Source/GmmLib/CMakeLists.txt:440 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/whoami/gmmlib-intel-gmmlib-19.4.1/CMakeFiles/CMakeOutput.log".

Uninitialized ExpectedQPitch warnings

Hi,

When building gmmlib as part of Chrome OS we observe the following uninitialized variable warnings

09:27:16  * /build/volteer/tmp/portage/media-libs/gmmlib-20.3.2-r2/work/gmmlib-intel-gmmlib-20.3.2/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp:2343:73: warning: variable 'ExpectedQPitch' is uninitialized when used here [-Wuninitialized]
09:27:16  * /build/volteer/tmp/portage/media-libs/gmmlib-20.3.2-r2/work/gmmlib-intel-gmmlib-20.3.2/Source/GmmLib/ULT/GmmGen12ResourceULT.cpp:2338:73: warning: variable 'ExpectedQPitch' is uninitialized when used here [-Wuninitialized]

Clang suggests that we initialize to 0.

/build/volteer/tmp/portage/media-libs/gmmlib-20.3.2-r2/work/gmmlib-intel-gmmlib-20.3.2/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp:2343:73: warning: variable 'ExpectedQPitch' is uninitialized when used here [-Wuninitialized]
                                          ExpectedPitch * GMM_ULT_ALIGN(ExpectedQPitch, AllocTileSize[0][1]) :
                                                                        ^~~~~~~~~~~~~~
/build/volteer/tmp/portage/media-libs/gmmlib-20.3.2-r2/work/gmmlib-intel-gmmlib-20.3.2/Source/GmmLib/ULT/./GmmResourceULT.h:98:41: note: expanded from macro 'GMM_ULT_ALIGN'
#define GMM_ULT_ALIGN(x, a)          (((x) + ((a) - 1)) - (((x) + ((a) - 1)) & ((a) - 1))) // Alt implementation with bitwise not (~) has issue with uint32 align used with 64-bit value, since ~'ed value will remain 32-bit.
                                        ^
/build/volteer/tmp/portage/media-libs/gmmlib-20.3.2-r2/work/gmmlib-intel-gmmlib-20.3.2/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp:2332:48: note: initialize the variable 'ExpectedQPitch' to silence this warning
            uint32_t TwoDQPitch, ExpectedQPitch;
                                               ^
                                                = 0

With the suggested minor changes, the warnings do disappear.

diff --git a/Source/GmmLib/ULT/GmmGen12ResourceULT.cpp b/Source/GmmLib/ULT/GmmGen12ResourceULT.cpp
index da4f9a4..43c7cd3 100644
--- a/Source/GmmLib/ULT/GmmGen12ResourceULT.cpp
+++ b/Source/GmmLib/ULT/GmmGen12ResourceULT.cpp
@@ -2324,7 +2324,7 @@ TEST_F(CTestGen12Resource, DISABLED_TestDepthCompressedResource)
             VerifyResourcePitch<true>(ResourceInfo, ExpectedPitch);
             VerifyResourcePitchInTiles<true>(ResourceInfo, 4); // 2 tile wide
 
-            uint32_t TwoDQPitch, ExpectedQPitch;
+            uint32_t TwoDQPitch, ExpectedQPitch = 0;
             if(gmmParams.Type == RESOURCE_3D)
             {
                 TwoDQPitch     = GMM_ULT_ALIGN(gmmParams.BaseHeight, VAlign);
diff --git a/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp b/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp
index f7ae8b1..e187f98 100644
--- a/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp
+++ b/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp
@@ -2329,7 +2329,7 @@ TEST_F(CTestGen12dGPUResource, DISABLED_TestDepthCompressedResource)
             VerifyResourcePitch<true>(ResourceInfo, ExpectedPitch);
             VerifyResourcePitchInTiles<true>(ResourceInfo, 4); // 2 tile wide
 
-            uint32_t TwoDQPitch, ExpectedQPitch;
+            uint32_t TwoDQPitch, ExpectedQPitch = 0;
             if(gmmParams.Type == RESOURCE_3D)
             {
                 TwoDQPitch     = GMM_ULT_ALIGN(gmmParams.BaseHeight, VAlign);

Is this an acceptable modification? If not, please submit a proper fix to address the uninitialized warnings.

GMMLib includes files are all over the place.

Please consider having all includes headers required to compile Media Driver in a single include folder.

There's one in root folder inc and one more in Gmmlib/inc.

Consider also removing hardcoded path like this one in Gmmlib.h that breaks if user uses -DINC_PATH

#include "../../inc/umKmInc/sharedata.h"

Compilation error on debian

original issue: intel/compute-runtime#16

When compiling on debian buster, using clang 5.0.1-2, the make step give me:

Scanning dependencies of target igfx_gmmumd_excite
[  1%] Building CXX object gmmlib/Source/GmmLib/CMakeFiles/igfx_gmmumd_excite.dir/__/Common/AssertTracer/AssertTracer.cpp.o
clang: error: unknown argument: '-fno-tree-pre'
clang: warning: -Wl,--no-undefined: 'linker' input unused [-Wunused-command-line-argument]

Syntax for RPM package requires is wrong

I am building on CentOS 7.4, using cmake 3.12.2. When running 'make package', the devel package has the following requires:

$ rpm -qpR intel-gmmlib-devel-5.0.0-1.el7.centos.x86_64.rpm 
...
intel-gmmlib(=5.0.0)
...

This causes rpm to look for a package named 'intel-gmmlib(=5.0.0-1)'. This should instead be

intel-gmmlib = 5.0.0

This can be fixed by

diff --git a/Source/GmmLib/CMakeLists.txt b/Source/GmmLib/CMakeLists.txt
index 3e962f5..9225a28 100644
--- a/Source/GmmLib/CMakeLists.txt
+++ b/Source/GmmLib/CMakeLists.txt
@@ -630,7 +630,7 @@ if(UNIX)
     endif()
 
     set(CPACK_DEBIAN_GMMLIB-DEVEL_PACKAGE_DEPENDS "intel-gmmlib(=${CPACK_PACKAGE_VERSION})")
-    set(CPACK_RPM_GMMLIB-DEVEL_PACKAGE_REQUIRES "intel-gmmlib(=${CPACK_PACKAGE_VERSION})")
+    set(CPACK_RPM_GMMLIB-DEVEL_PACKAGE_REQUIRES "intel-gmmlib = ${CPACK_PACKAGE_VERSION}")
 
     set(CPACK_COMPONENT_INSTALL ON)
     set(CPACK_DEB_COMPONENT_INSTALL ON)

Build dynamic library with a Linux-qualified name(s)

By convention on Linux if library is going to be linked against it should have:

  • real name, which is usually libigdgmm.so.x.y.z, x.y.z is a library version
  • soname which is libigdgmm.so.x, usually that's a symbolic link to real name
  • linker name which is libigdgmm.so, usually that's a symbolic link to soname
    Building library without the above convention is applicable only if library is supposed to be dlopen(), i.e. for drivers and similar things.

Since gmmlib will be linked against rahter than dlopen-ed it should qualify to the above Linux convention. This fix makes exactly that. CMake will automatically create required symbolc links (soname and linker name).

Mind also that it is typical to break these target in the following way for the packages:

  • real name and soname goes to runtime package (the one without *.h and *.pc files)
  • linker name goes to devel package (the one with *.h and *.pc files)

This can be achieved setting the following targets over the cmake target:

set_target_properties(${GMM_LIB_DLL_NAME} PROPERTIES VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
set_target_properties(${GMM_LIB_DLL_NAME} PROPERTIES SOVERSION ${MAJOR_VERSION})

Could you, please, make such a change?

icl: gmmlib mocs table don't match kernel table for ICL

We have compared MOCS table which programs gmmlib and i915 driver. They don't match. Some key details:
i915 driver taken from drm-tip: https://cgit.freedesktop.org/drm/drm-tip/tree/drivers/gpu/drm/i915/intel_mocs.c?id=b3c316b0b869252481acc8d88138aae7619de582#n136. It introduced ICL specific MOCS table starting from this commit: https://cgit.freedesktop.org/drm/drm-tip/commit/drivers/gpu/drm/i915/intel_mocs.c?id=b3c316b0b869252481acc8d88138aae7619de582

i915 programs table as (that's printout of our custom debug printk):

[    3.326058] [drm] MOCS table->table[0] control_value 0x5, l3cc_value 0x10
[    3.326060] [drm] MOCS table->table[1] control_value 0x4, l3cc_value 0x30
[    3.326061] [drm] MOCS table->table[2] control_value 0x37, l3cc_value 0x30
[    3.326063] [drm] MOCS table->table[3] control_value 0x5, l3cc_value 0x10
[    3.326065] [drm] MOCS table->table[4] control_value 0x5, l3cc_value 0x30
[    3.326066] [drm] MOCS table->table[5] control_value 0x37, l3cc_value 0x10
[    3.326068] [drm] MOCS table->table[6] control_value 0x17, l3cc_value 0x10
[    3.326069] [drm] MOCS table->table[7] control_value 0x17, l3cc_value 0x30
[    3.326071] [drm] MOCS table->table[8] control_value 0x27, l3cc_value 0x10
[    3.326073] [drm] MOCS table->table[9] control_value 0x27, l3cc_value 0x30
[    3.326074] [drm] MOCS table->table[10] control_value 0x77, l3cc_value 0x10
[    3.326076] [drm] MOCS table->table[11] control_value 0x77, l3cc_value 0x30
[    3.326077] [drm] MOCS table->table[12] control_value 0x57, l3cc_value 0x10
[    3.326079] [drm] MOCS table->table[13] control_value 0x57, l3cc_value 0x30
[    3.326081] [drm] MOCS table->table[14] control_value 0x67, l3cc_value 0x10
[    3.326082] [drm] MOCS table->table[15] control_value 0x67, l3cc_value 0x30
[    3.326084] [drm] MOCS table->table[16] control_value 0x4005, l3cc_value 0x10
[    3.326085] [drm] MOCS table->table[17] control_value 0x4005, l3cc_value 0x30
[    3.326087] [drm] MOCS table->table[18] control_value 0x60037, l3cc_value 0x30
[    3.326089] [drm] MOCS table->table[19] control_value 0x737, l3cc_value 0x30
[    3.326090] [drm] MOCS table->table[20] control_value 0x337, l3cc_value 0x30
[    3.326092] [drm] MOCS table->table[21] control_value 0x137, l3cc_value 0x30
[    3.326094] [drm] MOCS table->table[22] control_value 0x3b7, l3cc_value 0x30
[    3.326095] [drm] MOCS table->table[23] control_value 0x7b7, l3cc_value 0x30
[    3.326097] [drm] MOCS table->table[24] control_value 0x0, l3cc_value 0x0
[    3.326098] [drm] MOCS table->table[25] control_value 0x0, l3cc_value 0x0
[    3.326100] [drm] MOCS table->table[26] control_value 0x0, l3cc_value 0x0
[    3.326102] [drm] MOCS table->table[27] control_value 0x0, l3cc_value 0x0
[    3.326103] [drm] MOCS table->table[28] control_value 0x0, l3cc_value 0x0
[    3.326105] [drm] MOCS table->table[29] control_value 0x0, l3cc_value 0x0
[    3.326106] [drm] MOCS table->table[30] control_value 0x0, l3cc_value 0x0
[    3.326108] [drm] MOCS table->table[31] control_value 0x0, l3cc_value 0x0
[    3.326110] [drm] MOCS table->table[32] control_value 0x0, l3cc_value 0x0
[    3.326111] [drm] MOCS table->table[33] control_value 0x0, l3cc_value 0x0
[    3.326113] [drm] MOCS table->table[34] control_value 0x0, l3cc_value 0x0
[    3.326114] [drm] MOCS table->table[35] control_value 0x0, l3cc_value 0x0
[    3.326116] [drm] MOCS table->table[36] control_value 0x0, l3cc_value 0x0
[    3.326118] [drm] MOCS table->table[37] control_value 0x0, l3cc_value 0x0
[    3.326119] [drm] MOCS table->table[38] control_value 0x0, l3cc_value 0x0
[    3.326121] [drm] MOCS table->table[39] control_value 0x0, l3cc_value 0x0
[    3.326122] [drm] MOCS table->table[40] control_value 0x0, l3cc_value 0x0
[    3.326124] [drm] MOCS table->table[41] control_value 0x0, l3cc_value 0x0
[    3.326126] [drm] MOCS table->table[42] control_value 0x0, l3cc_value 0x0
[    3.326127] [drm] MOCS table->table[43] control_value 0x0, l3cc_value 0x0
[    3.326129] [drm] MOCS table->table[44] control_value 0x0, l3cc_value 0x0
[    3.326130] [drm] MOCS table->table[45] control_value 0x0, l3cc_value 0x0
[    3.326132] [drm] MOCS table->table[46] control_value 0x0, l3cc_value 0x0
[    3.326133] [drm] MOCS table->table[47] control_value 0x0, l3cc_value 0x0
[    3.326135] [drm] MOCS table->table[48] control_value 0x0, l3cc_value 0x0
[    3.326137] [drm] MOCS table->table[49] control_value 0x0, l3cc_value 0x0
[    3.326138] [drm] MOCS table->table[50] control_value 0x0, l3cc_value 0x0
[    3.326140] [drm] MOCS table->table[51] control_value 0x0, l3cc_value 0x0
[    3.326141] [drm] MOCS table->table[52] control_value 0x0, l3cc_value 0x0
[    3.326143] [drm] MOCS table->table[53] control_value 0x0, l3cc_value 0x0
[    3.326144] [drm] MOCS table->table[54] control_value 0x0, l3cc_value 0x0
[    3.326146] [drm] MOCS table->table[55] control_value 0x0, l3cc_value 0x0
[    3.326147] [drm] MOCS table->table[56] control_value 0x0, l3cc_value 0x0
[    3.326149] [drm] MOCS table->table[57] control_value 0x0, l3cc_value 0x0
[    3.326150] [drm] MOCS table->table[58] control_value 0x0, l3cc_value 0x0
[    3.326152] [drm] MOCS table->table[59] control_value 0x0, l3cc_value 0x0
[    3.326154] [drm] MOCS table->table[60] control_value 0x0, l3cc_value 0x0
[    3.326155] [drm] MOCS table->table[61] control_value 0x0, l3cc_value 0x0
[    3.326157] [drm] MOCS table->table[62] control_value 0x37, l3cc_value 0x10
[    3.326158] [drm] MOCS table->table[63] control_value 0x37, l3cc_value 0x10
[    3.326160] [drm] MOCS n_entries 64

And gmmlib at ac68e2c as:

[idx 0] L3 0x10, LeCC 0x9 
[idx 1] L3 0x30, LeCC 0x3b 
[idx 2] L3 0x10, LeCC 0x39 
[idx 3] L3 0x30, LeCC 0x33 
[idx 4] L3 0x10, LeCC 0x3b 
[idx 5] L3 0x30, LeCC 0x39 
[idx 6] L3 0x30, LeCC 0x37 
[idx 7] L3 0x10, LeCC 0x33 
[idx 8] L3 0x10, LeCC 0x37 
[idx 9] L3 0x30, LeCC 0x17 
[idx 10] L3 0x30, LeCC 0x6003b 
[idx 11] L3 0x0, LeCC 0x0 
[idx 12] L3 0x0, LeCC 0x0 
[idx 13] L3 0x0, LeCC 0x0 
[idx 14] L3 0x0, LeCC 0x0 
[idx 15] L3 0x0, LeCC 0x0 
[idx 16] L3 0x0, LeCC 0x0 
[idx 17] L3 0x0, LeCC 0x0 
[idx 18] L3 0x0, LeCC 0x0 
[idx 19] L3 0x0, LeCC 0x0 
[idx 20] L3 0x0, LeCC 0x0 
[idx 21] L3 0x0, LeCC 0x0 
[idx 22] L3 0x0, LeCC 0x0 
[idx 23] L3 0x0, LeCC 0x0 
[idx 24] L3 0x0, LeCC 0x0 
[idx 25] L3 0x0, LeCC 0x0 
[idx 26] L3 0x0, LeCC 0x0 
[idx 27] L3 0x0, LeCC 0x0 
[idx 28] L3 0x0, LeCC 0x0 
[idx 29] L3 0x0, LeCC 0x0 
[idx 30] L3 0x0, LeCC 0x0 
[idx 31] L3 0x0, LeCC 0x0 
[idx 32] L3 0x0, LeCC 0x0 
[idx 33] L3 0x0, LeCC 0x0 
[idx 34] L3 0x0, LeCC 0x0 
[idx 35] L3 0x0, LeCC 0x0 
[idx 36] L3 0x0, LeCC 0x0 
[idx 37] L3 0x0, LeCC 0x0 
[idx 38] L3 0x0, LeCC 0x0 
[idx 39] L3 0x0, LeCC 0x0 
[idx 40] L3 0x0, LeCC 0x0 
[idx 41] L3 0x0, LeCC 0x0 
[idx 42] L3 0x0, LeCC 0x0 
[idx 43] L3 0x0, LeCC 0x0 
[idx 44] L3 0x0, LeCC 0x0 
[idx 45] L3 0x0, LeCC 0x0 
[idx 46] L3 0x0, LeCC 0x0 
[idx 47] L3 0x0, LeCC 0x0 
[idx 48] L3 0x30, LeCC 0x3b 
[idx 49] L3 0x0, LeCC 0x0 
[idx 50] L3 0x0, LeCC 0x0 
[idx 51] L3 0x0, LeCC 0x0 
[idx 52] L3 0x0, LeCC 0x0 
[idx 53] L3 0x0, LeCC 0x0 
[idx 54] L3 0x0, LeCC 0x0 
[idx 55] L3 0x0, LeCC 0x0 
[idx 56] L3 0x0, LeCC 0x0 
[idx 57] L3 0x0, LeCC 0x0 
[idx 58] L3 0x0, LeCC 0x0 
[idx 59] L3 0x0, LeCC 0x0 
[idx 60] L3 0x0, LeCC 0x0 
[idx 61] L3 0x0, LeCC 0x0 
[idx 62] L3 0x0, LeCC 0x0 
[idx 63] L3 0x0, LeCC 0x0 

allow using a system packaged spdlog

Debian already has libspdlog-dev which includes all the headers, so to avoid duplicate work I'd rather just use that and not ship those files with gmmlib.

Do not wipe out compiler flags given by user

gmmlib cmake is forcing this:

SET (CMAKE_CXX_STANDARD_LIBRARIES "")
SET (CMAKE_C_STANDARD_LIBRARIES "")
SET (CMAKE_SHARED_LINKER_FLAGS "")
SET (CMAKE_CXX_FLAGS_RELEASEINTERNAL "")
SET (CMAKE_CXX_FLAGS_DEBUG "")
SET (CMAKE_CXX_FLAGS_RELEASE "")

It should not erase compiler and linker flags coming from user.

Please remove and reconcile the flags given on Linux.cmake file.

failure to build on alpine

I'm unsure if this is a bug (I'm not c++ expert) or an error with alpine, but since I'm struggling to find anything online, I'm wondering if it is a bug. Specifically I'm building intel/compute_runtime and the following occurs:

make -j1 VERBOSE=1 package
...
cd /dockerws/workspace/build/gmmlib/Source/GmmLib && ccache /usr/bin/c++  -DCL_TARGET_OPENCL_VERSION=210 -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DGMM_LIB_DLL -DGMM_UNIFIED_LIB -DGMM_UNIFY_DAF_API -DISTDLIB_UMD -DSMALL_POOL_ALLOC -DUNUSED_ISTDLIB_MT -D_ATL_NO_WIN_SUPPORT -D_X64 -D__GFX_MACRO_C__ -D__GMM -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__UMD -Digfx_gmmumd_dll_EXPORTS -I/dockerws/workspace/gmmlib/Source/GmmLib -I/codegen -I/igc/llvm/include -I/dockerws/workspace/gmmlib/Source/OpenGL/source/os/linux/oskl -I/source/os/linux/oskl/drm_intel -I/driver/linux/drm_intel -I/dockerws/workspace/gmmlib/Source/GmmLib/Utility/GmmLog -I/dockerws/workspace/gmmlib/Source/GmmLib/inc -I/dockerws/workspace/gmmlib/Source/GmmLib/Utility -I/dockerws/workspace/gmmlib/Source/GmmLib/GlobalInfo -I/dockerws/workspace/gmmlib/Source/GmmLib/Texture -I/dockerws/workspace/gmmlib/Source/GmmLib/Resource -I/dockerws/workspace/gmmlib/Source/GmmLib/Platform -I/dockerws/workspace/gmmlib/Source/inc -I/dockerws/workspace/gmmlib/Source/inc/common -I/dockerws/workspace/gmmlib/Source/inc/umKmInc -I/dockerws/workspace/gmmlib/Source/install  -Wno-reorder -Wsign-promo -Wnon-virtual-dtor -Wno-invalid-offsetof -fvisibility-inlines-hidden -fno-use-cxa-atexit -fno-rtti -fexceptions -fcheck-new -std=c++11 -fPIC   -Wall -Winit-self -Winvalid-pch -Wpointer-arith -Wno-unused -Wno-unknown-pragmas -Wno-comments -Wno-narrowing -Wno-overflow -Wno-parentheses -Wno-missing-braces -Wno-sign-compare -Werror=implicit-function-declaration -Werror=address -Werror=format-security -Werror=non-virtual-dtor -Werror=return-type -march=corei7 -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mfpmath=sse -finline-functions -fno-short-enums -Wa,--noexecstack -fno-strict-aliasing -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -DUSE_SSE3 -DUSE_SSSE3 -fstack-protector -fdata-sections -ffunction-sections -fmessage-length=0 -fvisibility=hidden -fPIC -g -m64 -funswitch-loops -Wl,--no-undefined -Wl,--no-as-needed -Wl,--gc-sections -O2 -fno-omit-frame-pointer -finline-limit=100 -std=gnu++11 -o CMakeFiles/igfx_gmmumd_dll.dir/CachePolicy/GmmCachePolicy.cpp.o -c /dockerws/workspace/gmmlib/Source/GmmLib/CachePolicy/GmmCachePolicy.cpp
In file included from /dockerws/workspace/gmmlib/Source/GmmLib/inc/Internal/Common/GmmLibInc.h:25:0,
                 from /dockerws/workspace/gmmlib/Source/GmmLib/CachePolicy/GmmCachePolicy.cpp:23:
/dockerws/workspace/gmmlib/Source/inc/portable_compiler.h:71:47: error: typedef '__CONCAT' is initialized (use decltype instead)
   #define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1]
                                               ^
/dockerws/workspace/gmmlib/Source/inc/portable_compiler.h:67:47: note: in definition of macro '__UNIQUENAME'
     #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
                                               ^~
/dockerws/workspace/gmmlib/Source/inc/portable_compiler.h:71:36: note: in expansion of macro 'UNIQUENAME'
   #define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1]
                                    ^~~~~~~~~~
/dockerws/workspace/gmmlib/Source/GmmLib/inc/External/Common/GmmCommonExt.h:392:1: note: in expansion of macro 'C_ASSERT'
 C_ASSERT(GMM_FORMAT_INVALID == 0); // GMM_FORMAT_INVALID needs to stay zero--How did it end-up not...?
 ^~~~~~~~
/dockerws/workspace/gmmlib/Source/inc/portable_compiler.h:71:47: error: 'STATIC_ASSERT_' was not declared in this scope
   #define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1]
                                               ^
/dockerws/workspace/gmmlib/Source/inc/portable_compiler.h:67:47: note: in definition of macro '__UNIQUENAME'
     #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
                                               ^~
/dockerws/workspace/gmmlib/Source/inc/portable_compiler.h:71:36: note: in expansion of macro 'UNIQUENAME'
   #define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1]
                                    ^~~~~~~~~~
/dockerws/workspace/gmmlib/Source/GmmLib/inc/External/Common/GmmCommonExt.h:392:1: note: in expansion of macro 'C_ASSERT'
 C_ASSERT(GMM_FORMAT_INVALID == 0); // GMM_FORMAT_INVALID needs to stay zero--How did it end-up not...?
 ^~~~~~~~
make[2]: *** [gmmlib/Source/GmmLib/CMakeFiles/igfx_gmmumd_dll.dir/build.make:87: gmmlib/Source/GmmLib/CMakeFiles/igfx_gmmumd_dll.dir/CachePolicy/GmmCachePolicy.cpp.o] Error 1
make[2]: Leaving directory '/dockerws/workspace/build'
make[1]: *** [CMakeFiles/Makefile2:11558: gmmlib/Source/GmmLib/CMakeFiles/igfx_gmmumd_dll.dir/all] Error 2
make[1]: Leaving directory '/dockerws/workspace/build'
make: *** [Makefile:152: all] Error 2

Am I doing something silly, or is this associated with the recent change in the file? Note that I have built this on Ubuntu 18.04 before (though a version of the repo from a few months ago) and had no trouble.

Provide support for cmake 2.8

Some Linux distributions, especially server distributions, still has older cmake versions than 3.5 by default. Cent OS 7.4 is an example:

$ cmake --version
cmake version 2.8.12.2

Yocto is another example:

# cmake --version
cmake version 3.3.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Please, provide compatibility with older versions of cmake starting from 2.8 to extend Linux distributions coverage. Mind that currently gmmlib does not actually has dependency from cmake 3.5 and can be built with cmake 2.8 just fine.

avoid hardcoded folders when creating packages for distributions

In particular this:

if("${os_name}" STREQUAL "clear-linux-os")
    # clear-linux-os distribution avoids /etc for distribution defaults.
    # Set this variable explicitly before including GNUInstallDirs.
    set(CMAKE_INSTALL_SYSCONFDIR "usr/share/defaults/etc")
endif()

If Clear-Linux is not setting SYSCONFDIR file a bug with them.

Add project(GmmLib) to the top-level CMakeLists.txt file

Please add project(GmmLib) to the top-level CMakeLists.txt file to suppress this CMake warning:

$ cmake -DCMAKE_BUILD_TYPE=Release ..
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

Tests fail on i386

[ RUN ] CTestAuxTable.TestAuxTableContent
/<>/intel-gmmlib-19.3.2+ds1/Source/GmmLib/ULT/GmmAuxTableULT.cpp:244: Failure
Value of: val
Actual: 281474827812864
Expected: expected
Which is: 18446744073560653824
[ FAILED ] CTestAuxTable.TestAuxTableContent (0 ms)
TearDownTestCase
[----------] 3 tests from CTestAuxTable (1 ms total)

Commit aa11d6ada523 breaks intel/media-driver compilation

Since aa11d6a

commit aa11d6ada523b1188fa7bebd1014b16be998c1df
Author: drprajap <[email protected]>
Date:   Mon Dec 18 14:17:12 2017 -0800

    Removing windef wrapper header
    
    Change-Id: I63ca71a7d4905e9f9019a93600f294d75c805249

...causes https://github.com/intel/media-driver to fail to compile:

In file included from /opt/media/build/intel-media-driver/media_driver/agnostic/common/os/mos_os.h:43:0,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/hw/mhw_mi.h:33,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_common.h:29,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_debug.h:31,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_mem.h:31,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_array.h:28,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_array.cpp:27:
/opt/media/build/intel-media-driver/media_driver/linux/common/os/mos_os_specific.h:53:19: error: 'PVOID' has not been declared
 #define HINSTANCE PVOID
                   ^
/opt/media/build/intel-media-driver/media_driver/agnostic/common/os/mos_os.h:692:9: note: in expansion of macro 'HINSTANCE'
         HINSTANCE                   hInstance);
         ^
In file included from /opt/media/build/intel-media-driver/media_driver/agnostic/common/hw/mhw_mi.h:33:0,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_common.h:29,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_debug.h:31,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_mem.h:31,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_array.h:28,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_array.cpp:27:
/opt/media/build/intel-media-driver/media_driver/agnostic/common/os/mos_os.h:694:31: error: expected ';' at end of member declaration
     void  *(*pfnGetProcAddress) (
                               ^
/opt/media/build/intel-media-driver/media_driver/agnostic/common/os/mos_os.h:695:37: error: expected ')' before 'hInstance'
         HINSTANCE                   hInstance,
                                     ^
In file included from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_common.h:30:0,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_debug.h:31,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_mem.h:31,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_array.h:28,
                 from /opt/media/build/intel-media-driver/media_driver/agnostic/common/cm/cm_array.cpp:27:
/opt/media/build/intel-media-driver/media_driver/linux/common/cm/cm_innerdef_os.h:55:14: warning: ISO C++ forbids declaration of 'INT' with no type [-fpermissive]
 typedef INT  (__cdecl *pCallBackReleaseVaSurface)( PVOID VaDpy, PVOID pVaSurfID);
              ^
/opt/media/build/intel-media-driver/media_driver/linux/common/cm/cm_innerdef_os.h:55:14: error: typedef 'INT' is initialized (use decltype instead)
/opt/media/build/intel-media-driver/media_driver/linux/common/cm/cm_innerdef_os.h:55:24: error: 'pCallBackReleaseVaSurface' was not declared in this scope
 typedef INT  (__cdecl *pCallBackReleaseVaSurface)( PVOID VaDpy, PVOID pVaSurfID);
                        ^
make[2]: *** [media_driver/CMakeFiles/iHD_drv_video.dir/agnostic/common/cm/cm_array.cpp.o] Error 1
make[2]: Leaving directory `/opt/media/build/intel-media-driver/build'
make[1]: *** [media_driver/CMakeFiles/iHD_drv_video.dir/all] Error 2
make[1]: Leaving directory `/opt/media/build/intel-media-driver/build'
make: *** [all] Error 2

CMake Error: The source directory "/home/user/gmmlib/Release" does not exist.

I followed the steps in the repository. When I ran the make command I encountered this error "CMake Error: The source directory "/home/user/gmmlib/Release" does not exist." I'm currently developing on the Intel Up2 board (https://www.mouser.com/ProductDetail/AAEON-UP/UPS-APLP4-A10-0864?qs=%2fha2pyFadugX3tk9b%252bihNuRyghyfMUN2lfOyoIYwLz7iQ95HDEsz%2ffwk8ReicMqL ) with no external gpu's just the board itself. Any suggestions on how to resolve this error

Remove fake dependency from libdrm

At this place and around it:

if (EXISTS "/usr/include/libdrm/intel_mocs_table.h")

gmmlib introduces fake dependency from custom version of libdrm. This is error prone since users may have patched version of libdrm (from MSS package) or have non-patched version. As a result there is a very high chance of building invalid version of gmmlib.

Could you, please, do the following:

  1. Completely remove any dependency from libdrm in gmmlib
  2. Move intel_mocs_table.h inside gmmlib
  3. Introduce configure level option to request build with extended mocs table instead of open source one
  4. By default build against open source mocs table

In other words, I suggest to do something similar to the following:

# cmake -DUSE_EXTENDED_MOCS_TABLE=TRUE ..
# cat ./Source/GmmLib/CMakeLists.txt
…
if (NOT DEFINED USE_EXTENDED_MOCS_TABLE)
  set(USE_EXTENDED_MOCS_TABLE FALSE)
endif()

if (USE_EXTENDED_MOCS_TABLE)
  add_definitions(-DUSE_EXTENDED_MOCS_TABLE)
  # no need in additional include dir since intel_mocs_table.h is inside gmmlib tree
endif()
…

userptr: provide uAPI to pass pitch to describe memory allocation done by the user

Reporting as a follow up for intel/media-driver#746.

Scenario is:

  1. End-user allocates surface in system memory (basically via malloc)
  2. User tries to create VASurface via userptr path passing https://github.com/intel/libva/blob/4b1bc91936ef0f8c3f0e22be0fccd401770879eb/va/va.h#L1379 to the media driver
  3. Media driver requests gmmlib to validate that user allocation complies to padding/alignment expectations
  4. gmmlib validates user input and returns gmm resource object or NULL if allocation is not compliant

The problem is that media driver can't comprehensively describe end-user memory allocation. One of the issues is that there is no way to specify a pitch. Please, provide uAPI to do that.

Implement make install

Please, implement make install for gmmlib. It should install the following:

  • gmmlib libraries to CMAKE_INSTALL_LIBDIR (for example to /usr/lib64 on centos)
  • CMAKE_INSTALL_LIBDIR/pkgconfig/gmmlib.pc - pkg-config file to be used by other project to use gmmlib as a build dependency
  • CMAKE_INSTALL_INCLUDEDIR/gmmlib/*.h - gmmlib header files

GmmGen9Texture overlapping MSAA.NumSamples comparisons

Hi, When building 20.4.1 for Chrome OS the following warning is observed.

Source/GmmLib/Texture/GmmGen9Texture.cpp:588:46: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
           ((pTexInfo->MSAA.NumSamples == 8) && (pTexInfo->MSAA.NumSamples == 16)) &&
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MSAA.NumSamples can not be both 8 and 16 at the same time forcing the entire if() to always skip.

19.1.2: CMake: incorrect assignment of default GMMLIB_API_PATCH_VERSION

Hello,

At the moment, Source/GmmLib/CMakeLists.txt calls

set(GMMLIB_API_PATCH_VERSION PATCH_VERSION)

if GMMLIB_API_PATCH_VERSION has not been explicitly defined. This results in the shared library being named literally "libigdgmm.so.9.0.PATCH_VERSION".

The simplest way of fixing this seems to be to change the aforementioned assignment to

set(GMMLIB_API_PATCH_VERSION "${PATCH_VERSION}")

Change recommended output directory in build instruction

Current build instruction starts with README.rst:

  1. Get gmmlib repo, make it look like
    < workspace >
    |- GmmLib

  2. $ mkdir /build

  3. $ cd /build

  4. cmake [-DCMAKE_BUILD_TYPE= Release | Debug | ReleaseInternal] [-DARCH= 64 | 32] ../GmmLib

  5. $ make -j8 ( Also performs compile time ULT)

This will lead naive end-user to the issue if he will try to build few projects from intel: they all suggest to create build directory in the workspace:). As a result all projects will try to generate Mekefiles in the same folder and will eventually conflict.

Please:

  1. Drop a talk about a "workspace" to be created - user should clone only the repository
  2. Change the build instruction suggesting to create build directory inside the cloned copy. For example:
1. Get gmmlib sources and change to the root directory, for example:
git clone https://github.com/intel/gmmlib.git && cd gmmlib
2. Configure, build and install as follows:
mkdir build && cd build
cmake ..
make
make install

Gentoo: QA Notice ...

UTC+3 here.
amd64 ~ # eix media-libs/gmmlib
Installed versions: 9999*l(00:02:38 14/08/2020)(ABI_MIPS="-n32 -n64 -o32" ABI_RISCV="-lp64 -lp64d" ABI_S390="-32 -64" ABI_X86="64 -32 -x32")

End of below build log returns:

  • QA Notice: Package triggers severe warnings which indicate that it
  •        may exhibit random runtime failures.
    
  • /var/tmp/portage/media-libs/gmmlib-9999/work/gmmlib-9999/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp:415:50: warning: converting to non-pointer type 'long unsigned int' from NULL [-Wconversion-null]
  • /var/tmp/portage/media-libs/gmmlib-9999/work/gmmlib-9999/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp:474:31: warning: NULL used in arithmetic [-Wpointer-arith]

media-libs:gmmlib-9999:20200813-210138.log.zip

building environment details:

amd64 ~ # emerge --info gmmlib
sh bash 5.0_p17
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
distcc 3.3.3 x86_64-pc-linux-gnu [disabled]
app-shells/bash: 5.0_p17::gentoo
dev-java/java-config: 2.3.1::gentoo
dev-lang/perl: 5.30.3::gentoo
dev-lang/python: 2.7.18-r1::gentoo, 3.6.11-r2::gentoo, 3.7.8-r2::gentoo, 3.8.4-r1::gentoo
dev-util/cmake: 3.16.5::gentoo
dev-util/pkgconfig: 0.29.2::gentoo
sys-apps/baselayout: 2.6-r1::gentoo
sys-apps/openrc: 0.42.1::gentoo
sys-apps/sandbox: 2.18::gentoo
sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake: 1.16.1-r1::gentoo
sys-devel/binutils: 2.33.1-r1::gentoo
sys-devel/gcc: 9.3.0-r1::gentoo, 10.2.0::gentoo
sys-devel/gcc-config: 2.3.1::gentoo
sys-devel/libtool: 2.4.6-r6::gentoo
sys-devel/make: 4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.7::gentoo (virtual/os-headers)
sys-libs/glibc: 2.31-r6::gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@eula"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=skylake -mtune=skylake -O2 -pipe -ftree-loop-vectorize -ftree-slp-vectorize "
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=skylake -mtune=skylake -O2 -pipe -ftree-loop-vectorize -ftree-slp-vectorize "
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--alert y --alphabetical --ask-enter-invalid --autounmask y --autounmask-only n --autounmask-unrestricted-atoms y --autounmask-write y --misspell-suggestions n --noconfmem --nospinner --tree --with-bdeps y"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=skylake -mtune=skylake -O2 -pipe -ftree-loop-vectorize -ftree-slp-vectorize "
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-march=skylake -mtune=skylake -O2 -pipe -ftree-loop-vectorize -ftree-slp-vectorize "

LANG="fr_FR.utf8"
LDFLAGS=" -Wl,-O1 -Wl,-fuse-ld=bfd -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -fno-plt -march=skylake -mtune=skylake -O2 -pipe -ftree-loop-vectorize -ftree-slp-vectorize "
LINGUAS="fr"
MAKEOPTS="-j3 -l3"

USE="amd64 asm libglvnd minimal split-usr" ABI_X86="64" ALSA_CARDS="hda-intel" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput" KERNEL="linux" L10N="fr" PHP_TARGETS="php7-4" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_6 python3_7" QEMU_USER_TARGETS="aarch64" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="intel i965"
Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS

                    Package Settings

media-libs/gmmlib-9999::gentoo was built with the following:
USE="" ABI_X86="-32 (64) (-x32)"

Thks 4 ur attention, interest & support

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.