Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD support #819

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

FreeBSD support #819

wants to merge 14 commits into from

Conversation

jbeich
Copy link

@jbeich jbeich commented Jan 11, 2020

Depends on intel/libva#363 and intel/gmmlib#68

Build logs

http://beefy9.nyi.freebsd.org/data/latest-per-pkg/libva-intel-media-driver/21.1.1/114amd64-default.log
http://beefy10.nyi.freebsd.org/data/latest-per-pkg/libva-intel-media-driver/21.1.1/114i386-default.log
http://beefy6.nyi.freebsd.org/data/latest-per-pkg/libva-intel-media-driver/21.1.1/122amd64-default.log
http://beefy5.nyi.freebsd.org/data/latest-per-pkg/libva-intel-media-driver/21.1.1/122i386-default.log
http://beefy18.nyi.freebsd.org/data/latest-per-pkg/libva-intel-media-driver/21.1.1/main-amd64-default.log
http://beefy17.nyi.freebsd.org/data/latest-per-pkg/libva-intel-media-driver/21.1.1/main-i386-default.log
https://sting.dragonflybsd.org/dports/logs/multimedia___libva-intel-media-driver.log

Tests output
[==========] Running 43 tests from 13 test cases.
[----------] Global test environment set-up.
[----------] 1 test from MediaCapsDdiTest
[ RUN      ] MediaCapsDdiTest.DecodeEncodeProfile
[       OK ] MediaCapsDdiTest.DecodeEncodeProfile (11 ms)
[----------] 1 test from MediaCapsDdiTest (11 ms total)

[----------] 2 tests from MediaDecodeDdiTest
[ RUN      ] MediaDecodeDdiTest.DecodeHEVCLong
[       OK ] MediaDecodeDdiTest.DecodeHEVCLong (6 ms)
[ RUN      ] MediaDecodeDdiTest.DecodeAVCLong
[       OK ] MediaDecodeDdiTest.DecodeAVCLong (10 ms)
[----------] 2 tests from MediaDecodeDdiTest (16 ms total)

[----------] 2 tests from MediaEncodeDdiTest
[ RUN      ] MediaEncodeDdiTest.EncodeHEVC_DualPipe
[       OK ] MediaEncodeDdiTest.EncodeHEVC_DualPipe (10 ms)
[ RUN      ] MediaEncodeDdiTest.EncodeAVC_DualPipe
[       OK ] MediaEncodeDdiTest.EncodeAVC_DualPipe (12 ms)
[----------] 2 tests from MediaEncodeDdiTest (22 ms total)

[----------] 5 tests from KernelTest
[ RUN      ] KernelTest.LoadDestroyProgram
[       OK ] KernelTest.LoadDestroyProgram (67 ms)
[ RUN      ] KernelTest.LoadWrongIsa
[       OK ] KernelTest.LoadWrongIsa (13 ms)
[ RUN      ] KernelTest.CreateKernel
[       OK ] KernelTest.CreateKernel (26 ms)
[ RUN      ] KernelTest.SetArgument
[       OK ] KernelTest.SetArgument (78 ms)
[ RUN      ] KernelTest.SetSamplerBTI
[       OK ] KernelTest.SetSamplerBTI (67 ms)
[----------] 5 tests from KernelTest (251 ms total)

[----------] 3 tests from BufferTest
[ RUN      ] BufferTest.MultipleSizes
[       OK ] BufferTest.MultipleSizes (79 ms)
[ RUN      ] BufferTest.ReadWrite
[       OK ] BufferTest.ReadWrite (13 ms)
[ RUN      ] BufferTest.Initialization
[       OK ] BufferTest.Initialization (14 ms)
[----------] 3 tests from BufferTest (106 ms total)

[----------] 2 tests from BufferUPTest
[ RUN      ] BufferUPTest.MultipleSizes
[       OK ] BufferUPTest.MultipleSizes (79 ms)
[ RUN      ] BufferUPTest.InvalidSystemMemory
[       OK ] BufferUPTest.InvalidSystemMemory (28 ms)
[----------] 2 tests from BufferUPTest (107 ms total)

[----------] 8 tests from DeviceTest
[ RUN      ] DeviceTest.Destroy
[       OK ] DeviceTest.Destroy (13 ms)
[ RUN      ] DeviceTest.NoScratchSpace
[       OK ] DeviceTest.NoScratchSpace (18 ms)
[ RUN      ] DeviceTest.QueryGpuPlatform
[       OK ] DeviceTest.QueryGpuPlatform (14 ms)
[ RUN      ] DeviceTest.QueryThreadCount
[       OK ] DeviceTest.QueryThreadCount (13 ms)
[ RUN      ] DeviceTest.QueryFrequency
[       OK ] DeviceTest.QueryFrequency (13 ms)
[ RUN      ] DeviceTest.QueryPlatformInformation
[       OK ] DeviceTest.QueryPlatformInformation (13 ms)
[ RUN      ] DeviceTest.SetThreadCount
[       OK ] DeviceTest.SetThreadCount (13 ms)
[ RUN      ] DeviceTest.GetInvalidCap
[       OK ] DeviceTest.GetInvalidCap (13 ms)
[----------] 8 tests from DeviceTest (111 ms total)

[----------] 2 tests from QueueTest
[ RUN      ] QueueTest.CreateTwice
[       OK ] QueueTest.CreateTwice (14 ms)
[ RUN      ] QueueTest.EnqueueWithoutTask
[       OK ] QueueTest.EnqueueWithoutTask (13 ms)
[----------] 2 tests from QueueTest (27 ms total)

[----------] 7 tests from Surface2DTest
[ RUN      ] Surface2DTest.MultipleSizes
[       OK ] Surface2DTest.MultipleSizes (172 ms)
[ RUN      ] Surface2DTest.PlanarFormats
[       OK ] Surface2DTest.PlanarFormats (80 ms)
[ RUN      ] Surface2DTest.DestroyNull
[       OK ] Surface2DTest.DestroyNull (14 ms)
[ RUN      ] Surface2DTest.ReadWrite
[       OK ] Surface2DTest.ReadWrite (29 ms)
[ RUN      ] Surface2DTest.ReadWriteWithStride
[       OK ] Surface2DTest.ReadWriteWithStride (14 ms)
[ RUN      ] Surface2DTest.Initialization
[       OK ] Surface2DTest.Initialization (13 ms)
[ RUN      ] Surface2DTest.GetInfo
[       OK ] Surface2DTest.GetInfo (27 ms)
[----------] 7 tests from Surface2DTest (349 ms total)

[----------] 3 tests from Surface2DUPTest
[ RUN      ] Surface2DUPTest.MultipleSizes
[       OK ] Surface2DUPTest.MultipleSizes (138 ms)
[ RUN      ] Surface2DUPTest.InvalidSystemMemory
[       OK ] Surface2DUPTest.InvalidSystemMemory (27 ms)
[ RUN      ] Surface2DUPTest.PlanarFormat
[       OK ] Surface2DUPTest.PlanarFormat (53 ms)
[----------] 3 tests from Surface2DUPTest (218 ms total)

[----------] 4 tests from Surface3DTest
[ RUN      ] Surface3DTest.MultipleSizes
[       OK ] Surface3DTest.MultipleSizes (135 ms)
[ RUN      ] Surface3DTest.Abgr16Format
[       OK ] Surface3DTest.Abgr16Format (27 ms)
[ RUN      ] Surface3DTest.ReadWrite
[       OK ] Surface3DTest.ReadWrite (13 ms)
[ RUN      ] Surface3DTest.Initialization
[       OK ] Surface3DTest.Initialization (14 ms)
[----------] 4 tests from Surface3DTest (189 ms total)

[----------] 1 test from TaskTest
[ RUN      ] TaskTest.CreateDestroy
[       OK ] TaskTest.CreateDestroy (14 ms)
[----------] 1 test from TaskTest (14 ms total)

[----------] 3 tests from ThreadSpaceTest
[ RUN      ] ThreadSpaceTest.MultipleSizes
[       OK ] ThreadSpaceTest.MultipleSizes (27 ms)
[ RUN      ] ThreadSpaceTest.DependencyPattern
[       OK ] ThreadSpaceTest.DependencyPattern (27 ms)
[ RUN      ] ThreadSpaceTest.MediaWalkingPattern
[       OK ] ThreadSpaceTest.MediaWalkingPattern (29 ms)
[----------] 3 tests from ThreadSpaceTest (84 ms total)

[----------] Global test environment tear-down
[==========] 43 tests from 13 test cases ran. (1505 ms total)
[  PASSED  ] 43 tests.

Note, to avoid regressing build in future consider FreeBSD-friendly CI.

@jbeich
Copy link
Author

jbeich commented Jan 11, 2020

@iamleot, @iarebatman, can you test on NetBSD and OpenBSD? intel-vaapi-driver is deprecated in favor of media-driver. This PR fixes both DragonFly and FreeBSD but if it also fixes NetBSD and OpenBSD it'd increase upstream buy in. ;)

@iamleot
Copy link

iamleot commented Jan 13, 2020

Hello Jan,
Sure! I'll hopefully be able to test it on NetBSD/amd64 later this UTC evening. Unfortunately I only have 4th generation Intel CPUs so I think that I can only build test them.

Both intel/gmmlib#68 and #819 NetBSD parts looks good to me after quick skimming them.

@iamleot
Copy link

iamleot commented Jan 15, 2020 via email

@jbeich
Copy link
Author

jbeich commented Feb 7, 2020

@iamleot wrote:

I hope to test and share news this evening!

Do you still plan to? See also intel/libva#363

@iamleot
Copy link

iamleot commented Feb 7, 2020 via email

@jbeich jbeich force-pushed the freebsd branch 5 times, most recently from 9488259 to 1792489 Compare March 15, 2020 19:25
@jbeich
Copy link
Author

jbeich commented Mar 16, 2020

Porting 6cafa0b is harder than expected due to bundled libdrm. Intel didn't bother documenting exact revision the code was taken from and BSDs didn't bother upstreaming all of their patches. I've dropped my incomplete attempt to add missing pieces, leaving cmrtlib partially broken on BSDs. The regressing commit can be reverted downstream until a proper fix is found.

Note, cmrtlib can be disabled via -DBUILD_CMRTLIB=OFF and seems to be used only by MediaSDK.

@jbeich
Copy link
Author

jbeich commented May 23, 2020

cache (including ccache) doesn't work due to TravisCI bug. If ~12 minutes is too long I can add a CirrusCI config.

$ export CASHER_DIR=${TRAVIS_HOME}/.casher
$ Installing caching utilities
/home/travis/.rvm/scripts/set: /home/travis/.casher/bin/casher: /bin/bash: bad interpreter: No such file or directory
/home/travis/.rvm/scripts/set: line 19: /home/travis/.casher/bin/casher: No error: 0

@jbeich
Copy link
Author

jbeich commented Jul 12, 2020

casher was fixed, so cache nowadays works but ccache in this repo doesn't for some reason:

preprocessor error 752

@jbeich jbeich force-pushed the freebsd branch 3 times, most recently from 39495b6 to c939d3b Compare December 8, 2021 04:55
@dvrogozh
Copy link
Contributor

As much as I wish to take this PR in, there is an issue that we have unpatched dependency (gmmlib). This means that the best we can do (w/o having permanently patched gmmlib) would be to setup ci based on PR against gmmlib - that's what is actually done in this PR. This has a problem however that we risk to have ci failures on gmmlib updates. Someone will need to fix PR against gmmlib. And ci fill be down during the time gmmlib PR is getting fixed. To be honest, this is not something I wish to setup and track.

I would suggest however to start picking up patches in this PR one by one reducing number of patches we have here. Some of them look to be ready to go, some might need further discussion.

jbeich added 13 commits May 25, 2022 22:21
In file included from media_driver/agnostic/common/cm/cm_hal.cpp:26:
In file included from media_driver/agnostic/common/os/mos_os.h:30:
In file included from media_driver/agnostic/common/os/mos_defs.h:38:
In file included from /usr/include/c++/v1/stdio.h:101:
/usr/include/c++/v1/__config:219:12: fatal error: 'features.h' file not found
 #  include <features.h>
            ^~~~~~~~~~~~
In file included from media_driver/agnostic/common/cm/cm_kernel_rt.cpp:35:
In file included from media_driver/agnostic/common/cm/cm_mov_inst.h:31:
In file included from media_driver/agnostic/common/cm/cm_mem.h:128:
media_driver/linux/common/cm/hal/cm_mem_os.h:33:9: error: '__fastcall' macro redefined [-Werror,-Wmacro-redefined]
 #define __fastcall
         ^
/usr/include/sys/cdefs.h:372:9: note: previous definition is here
 #define __fastcall      __attribute__((__fastcall__))
         ^
In file included from media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp:38:
media_driver/linux/common/os/i915/include/mos_bufmgr_priv.h:351:9: error: 'ALIGN' macro redefined [-Werror,-Wmacro-redefined]
 #define ALIGN(value, alignment)    ((value + alignment - 1) & ~(alignment - 1))
         ^
/usr/include/machine/param.h:79:9: note: previous definition is here
 #define ALIGN(p)                _ALIGN(p)
         ^

In file included from media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp:30:
In file included from media_driver/linux/common/ddi/media_libva.h:52:
In file included from media_driver/agnostic/common/codec/hal/codechal_decoder.h:40:
In file included from media_driver/agnostic/common/cm/cm_wrapper.h:31:
In file included from media_driver/linux/common/cm/hal/cm_wrapper_os.h:31:
In file included from media_driver/agnostic/common/cm/cm_def.h:31:
In file included from media_driver/agnostic/common/cm/cm_common.h:31:
In file included from media_driver/linux/common/cm/hal/cm_innerdef_os.h:42:
In file included from /usr/include/pthread_np.h:36:
In file included from /usr/include/sys/param.h:162:
/usr/include/machine/param.h:79:2: error: bootlegging test
ld: error: unable to find library -ldl
media_driver/media_driver_next/linux/common/os/mos_utilities_specific_next.cpp:1693:12: error: cast from pointer to smaller type 'uint32_t' (aka 'unsigned int') loses information
    return (uint32_t)pthread_self();
           ^~~~~~~~~~~~~~~~~~~~~~~~
…laris

In file included from cmrtlib/linux/hardware/cm_device_os.cpp:24:
cmrtlib/linux/../linux/hardware/drm_device.h:42:10: fatal error: 'sys/sysmacros.h' file not found
 #include <sys/sysmacros.h>   //<sys/types.h>
          ^~~~~~~~~~~~~~~~~
media_driver/linux/common/os/i915/xf86drm.c:50:10: fatal error: 'sys/sysmacros.h' file not found
 #include <sys/sysmacros.h>
          ^~~~~~~~~~~~~~~~~
media_driver/linux/ult/libdrm_mock/xf86drm_mock.c:50:10: fatal error: 'sys/sysmacros.h' file not found
 #include <sys/sysmacros.h>
          ^~~~~~~~~~~~~~~~~
In file included from cmrtlib/agnostic/hardware/cm_queue.cpp:22:
In file included from cmrtlib/linux/../agnostic/hardware/cm_queue.h:26:
cmrtlib/linux/../linux/share/cm_def_os.h:37:10: fatal error: 'malloc.h' file not found
 #include <malloc.h>
          ^~~~~~~~~~
In file included from cmrtlib/agnostic/share/cm_avs_state_msg_ex.cpp:22:
In file included from cmrtlib/linux/../agnostic/share/cm_def.h:26:
cmrtlib/linux/../linux/share/cm_def_os.h:104:10: error: use of undeclared identifier 'memalign'
  return memalign(alignment, size);
         ^
media_driver/agnostic/common/os/mos_utilities.c:36:10: fatal error: 'malloc.h' file not found
 #include <malloc.h>    // For memalign
          ^~~~~~~~~~
media_driver/agnostic/common/os/mos_utilities.c:4047:11: error: use of undeclared identifier 'memalign'
    ptr = _aligned_malloc(size, alignment);
          ^
media_driver/linux/common/os/mos_utilities_specific.h:91:43: note: expanded from macro '_aligned_malloc'
 #define _aligned_malloc(size, alignment)  memalign(alignment, size)
                                           ^
media_driver/agnostic/common/cm/cm_task_internal.cpp:896:39: error: use of undeclared identifier 'SYS_gettid'
    m_taskProfilingInfo.threadID    = CmGetCurThreadId(); // Get Thread ID
                                      ^
media_driver/linux/common/cm/hal/cm_innerdef_os.h:98:37: note: expanded from macro 'CmGetCurThreadId'
 #define CmGetCurThreadId()  syscall(SYS_gettid)
                                     ^
media_driver/agnostic/common/cm/cm_task_internal.cpp:997:39: error: use of undeclared identifier 'SYS_gettid'
    m_taskProfilingInfo.threadID    = CmGetCurThreadId(); // Get Thread ID
                                      ^
media_driver/linux/common/cm/hal/cm_innerdef_os.h:98:37: note: expanded from macro 'CmGetCurThreadId'
 #define CmGetCurThreadId()  syscall(SYS_gettid)
                                     ^
media_driver/linux/common/codec/ddi/media_libva_decoder.cpp:48:10: fatal error: 'linux/fb.h' file not found
 #include <linux/fb.h>
          ^~~~~~~~~~~~
media_driver/linux/common/codec/ddi/media_libva_decoder.cpp:55:43: error: variable has incomplete type 'struct fb_var_screeninfo'
    struct fb_var_screeninfo              vsinfo;
                                          ^
media_driver/linux/common/codec/ddi/media_libva_decoder.cpp:62:22: error: use of undeclared identifier 'FBIOGET_VSCREENINFO'
        if(ioctl(fd, FBIOGET_VSCREENINFO, &vsinfo) < 0)
                     ^
media_driver/linux/common/ddi/media_libva.cpp:39:10: fatal error: 'linux/fb.h' file not found
 #include <linux/fb.h>
          ^~~~~~~~~~~~
ld: error: undefined symbol: backtrace
>>> referenced by mos_utilities_specific.cpp:2504 (media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp:2504)
>>>               media_driver/CMakeFiles/iHD_drv_video_COMMON.dir/__/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp.o:(MosUtilities::MosTraceEvent(unsigned short, unsigned char, void const*, unsigned int, void const*, unsigned int))
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants