-
Notifications
You must be signed in to change notification settings - Fork 352
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
FreeBSD support #819
Conversation
@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. ;) |
Hello Jan, Both intel/gmmlib#68 and #819 NetBSD parts looks good to me after quick skimming them. |
media_driver/media_driver_next/linux/common/os/mos_utilities_specific_next.cpp
Outdated
Show resolved
Hide resolved
Hello Jan,
Jan Beich writes:
@iamleot, did you forget to test media-driver after gmmlib built fine? gmmlib is ~15x smaller than media-driver, so I expect more fun here.
(Just a reminder. I'll remove this comment shortly after.)
No, I haven't and now that gmmlib seems ready I can finally test it.
I hope to test and share news this evening!
Thanks for the remainder and for working on that!
|
@iamleot wrote:
Do you still plan to? See also intel/libva#363 |
Hello Jan,
Jan Beich writes:
@iamleot wrote:
> I hope to test and share news this evening!
Do you still plan to? See also intel/libva#363
Sorry for the delay and (upstream) please consider my test not blocking
(I was pretty busy in the last weeks).
I'll hopefully have more time this weekend but I couldn't promise
anything.
|
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 |
|
casher was fixed, so
|
Thanks for your work on this! I'm trying to build on FreeBSD 12.1-STABLE and running into this:
The first error I was able to fix with: diff --git a/cmrtlib/linux/hardware/drm_device.h b/cmrtlib/linux/hardware/drm_device.h
index fa874521..8ef63fd7 100644
--- a/cmrtlib/linux/hardware/drm_device.h
+++ b/cmrtlib/linux/hardware/drm_device.h
@@ -941,7 +941,7 @@ static int drmParseSubsystemType(int maj, int min)
}
return -EINVAL;
-#elif defined(__OpenBSD__) || defined(__DragonFly__)
+#elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
return DRM_BUS_PCI;
#else
#warning "Missing implementation of drmParseSubsystemType" |
@tmm1, see #819 (comment). Why not try ports/packages instead where this PR is integrated? https://www.freshports.org/multimedia/libva-intel-media-driver |
Thanks for the pointers! |
#include <sys/mkdev.h> | ||
#endif | ||
#ifdef MAJOR_IN_SYSMACROS | ||
#if defined(__GLIBC__) || defined(__linux__) //#ifdef MAJOR_IN_SYSMACROS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the bundled and patched libdrm is built via CMake and doesn't define MAJOR_IN_SYSMACROS
. Instead always-true conditionals on Linux were expanded while the rest left as is. Are you suggesting to implement the macros via CMake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see if CMake checks pass CI but 1 workflow awaiting approval
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. I didn't realize this was a bundled libdrm file. Ugh.
Never mind then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, reverted CMake checks. GNU libc disables extensions by default, so it breaks configure checks without _GNU_SOURCE
. Debugging without a Linux machine/VM maybe hard.
-- Looking for major
-- Looking for major - not found
-- Looking for major
-- Looking for major - not found
[...]
In file included from cmrtlib/linux/hardware/cm_device_os.cpp:24:
cmrtlib/linux/../linux/hardware/drm_device.h:1041:11: error: use of undeclared identifier 'major'
maj = major(sbuf.st_rdev);
^
cmrtlib/linux/../linux/hardware/drm_device.h:1042:11: error: use of undeclared identifier 'minor'
min = minor(sbuf.st_rdev);
^
#include <sys/stat.h> | ||
#define stat_t struct stat | ||
#include <sys/ioctl.h> | ||
#include <sys/time.h> | ||
#include <stdarg.h> | ||
#ifdef MAJOR_IN_MKDEV | ||
#ifdef __sun //#ifdef MAJOR_IN_MKDEV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change correct?
#include <sys/stat.h> | ||
#define stat_t struct stat | ||
#include <sys/ioctl.h> | ||
#include <sys/time.h> | ||
#include <stdarg.h> | ||
#ifdef HAVE_SYS_MKDEV_H | ||
#ifdef __sun //#ifdef MAJOR_IN_MKDEV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
# include <sys/mkdev.h> /* defines major(), minor(), and makedev() on Solaris */ | ||
#endif | ||
#include <sys/sysmacros.h> | ||
#if defined(__GLIBC__) || defined(__linux__) //#ifdef MAJOR_IN_SYSMACROS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Why not just #ifdef MAJOR_IN_SYSMACROS
?
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. |
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> ^~~~~~~~~~~~
This reverts commit 53405da.
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)
Obsoleted by #1785. Already used downstream. Personally, I gave up and use Vulkan Video (via anv from Mesa) or legacy intel-vaapi-driver (for hybrid VP9 decode) on my aging Skylake iGPU. |
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
Note, to avoid regressing build in future consider FreeBSD-friendly CI.