libdrm-dfbsd: Update wip/libdrm-dfbsd to 2.4.99
Changes: * Meson build * Knobs for NetBSD xsrc patches on NetBSD
This commit is contained in:
parent
7c4c93bff1
commit
2051b61279
|
@ -1,6 +1,21 @@
|
|||
# $NetBSD: Makefile,v 1.91 2019/01/22 21:50:47 wiz Exp $
|
||||
# $NetBSD: Makefile,v 1.92 2019/04/23 09:51:47 wiz Exp $
|
||||
|
||||
DISTNAME= libdrm-2.4.97
|
||||
# 2019-07-02 Bump version to 2.4.99
|
||||
# COMMIT_ID= b2103fa3257daa6acfdc6f4d4d8565abebaec4a8
|
||||
|
||||
# 2019-05-16 amdgpu: Add amdgpu_cs_syncobj_transfer to amdgpu-symbol-check
|
||||
# COMMIT_ID= 922d92994267743266024ecceb734ce0ebbca808
|
||||
|
||||
# PORTNAME= drm
|
||||
|
||||
# DISTNAME= ${PORTNAME}-${COMMIT_ID}
|
||||
# PKGNAME= libdrm-2.4.98
|
||||
# PKGREVISION= 2
|
||||
# CATEGORIES= x11 graphics
|
||||
# MASTER_SITES= http://cgit.freedesktop.org/mesa/${PORTNAME}/snapshot/
|
||||
# EXTRACT_SUFX= .tar.xz
|
||||
|
||||
DISTNAME= libdrm-2.4.99
|
||||
CATEGORIES= x11 graphics
|
||||
MASTER_SITES= http://dri.freedesktop.org/libdrm/
|
||||
EXTRACT_SUFX= .tar.bz2
|
||||
|
@ -14,9 +29,9 @@ ONLY_FOR_PLATFORM= NetBSD-*-* DragonFly-*-* FreeBSD-*-* OpenBSD-*-* \
|
|||
|
||||
USE_PKGLOCALEDIR= yes
|
||||
USE_TOOLS+= gmake pkg-config
|
||||
USE_LIBTOOL= yes
|
||||
# USE_LIBTOOL= yes
|
||||
PKGCONFIG_OVERRIDE+= libdrm.pc.in
|
||||
GNU_CONFIGURE= yes
|
||||
# GNU_CONFIGURE= yes
|
||||
|
||||
.include "../../mk/bsd.prefs.mk"
|
||||
|
||||
|
@ -31,28 +46,30 @@ ATOMIC_OPS_CHECK= 0
|
|||
ATOMIC_OPS_CHECK= 1
|
||||
.else
|
||||
# Intel driver no longer needs libatomic_ops
|
||||
. if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != x86_64
|
||||
. include "../../devel/libatomic_ops/buildlink3.mk"
|
||||
.if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != x86_64
|
||||
. include "../../devel/libatomic_ops/buildlink3.mk"
|
||||
CONFIGURE_ENV+= drm_cv_atomic_primitives=libatomic-ops
|
||||
. endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
CONFIGURE_ARGS+= PTHREADSTUBS_CFLAGS=-I${PREFIX}/include \
|
||||
PTHREADSTUBS_LIBS=-L${PREFIX}/lib
|
||||
CONFIGURE_ARGS+= --disable-manpages
|
||||
CONFIGURE_ARGS+= --disable-valgrind
|
||||
MESON_ARGS+= -Dman-pages=false
|
||||
MESON_ARGS+= -Dvalgrind=false
|
||||
|
||||
LDFLAGS.NetBSD+= -lpci
|
||||
|
||||
PLIST_VARS+= intel arm
|
||||
.if ${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == x86_64
|
||||
.if !empty(MACHINE_ARCH:Mi386) || !empty(MACHINE_ARCH:Mx86_64)
|
||||
# libpciaccess is needed to build support for the intel KMS API,
|
||||
# libdrm_intel.so.
|
||||
.include "../../sysutils/libpciaccess/buildlink3.mk"
|
||||
PLIST.intel= yes
|
||||
.elif !empty(MACHINE_ARCH:Marm*) || \
|
||||
!empty(MACHINE_ARCH:Mearm*) || \
|
||||
${MACHINE_ARCH} == aarch64
|
||||
!empty(MACHINE_ARCH:Maarch64)
|
||||
PLIST.arm= yes
|
||||
#.else
|
||||
#CONFIGURE_ARGS+= --disable-intel
|
||||
|
@ -62,19 +79,43 @@ PKG_OPTIONS_VAR= PKG_OPTIONS.libdrm
|
|||
PKG_SUPPORTED_OPTIONS= libkms
|
||||
PKG_SUGGESTED_OPTIONS=
|
||||
|
||||
PKG_SUPPORTED_OPTIONS+= invert_atomic_add_unless
|
||||
.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
|
||||
PKG_SUGGESTED_OPTIONS+= invert_atomic_add_unless
|
||||
.endif
|
||||
|
||||
# .if !empty(MACHINE_ARCH:Mi386) || !empty(MACHINE_ARCH:Mx86_64)
|
||||
# PKG_SUGGESTED_OPTIONS+= libkms
|
||||
# .endif
|
||||
|
||||
.include "../../mk/bsd.options.mk"
|
||||
|
||||
PLIST_VARS+= libkms
|
||||
.if !empty(PKG_OPTIONS:Mlibkms)
|
||||
PKGCONFIG_OVERRIDE+= libkms.pc.in
|
||||
PLIST.libkms= yes
|
||||
CONFIGURE_ARGS+= --enable-libkms
|
||||
.else
|
||||
#CONFIGURE_ARGS+= --disable-libkms
|
||||
PKG_SUPPORTED_OPTIONS+= strict_xsrc_netbsd
|
||||
.if ${OPSYS} == "NetBSD"
|
||||
PKG_SUGGESTED_OPTIONS+= strict_xsrc_netbsd
|
||||
.endif
|
||||
|
||||
.include "../../mk/bsd.options.mk"
|
||||
|
||||
PLIST_VARS+= libkms
|
||||
.if !empty(PKG_OPTIONS:Mlibkms)
|
||||
PKGCONFIG_OVERRIDE+= libkms.pc.in
|
||||
PLIST.libkms= yes
|
||||
CONFIGURE_ARGS+= --enable-libkms
|
||||
MESON_ARGS+= -Dlibkms=true
|
||||
.else
|
||||
CONFIGURE_ARGS+= --disable-libkms
|
||||
MESON_ARGS+= -Dlibkms=false
|
||||
.endif
|
||||
|
||||
.if !empty(PKG_OPTIONS:Minvert_atomic_add_unless)
|
||||
CPPFLAGS+= -DINVERT_ATOMIC_ADD_UNLESS
|
||||
.endif
|
||||
|
||||
.if !empty(PKG_OPTIONS:Mstrict_xsrc_netbsd)
|
||||
CPPFLAGS+= -DSTRICT_XSRC_NETBSD
|
||||
.endif
|
||||
|
||||
# Meson
|
||||
# CPPFLAGS+= -Wno-return-type
|
||||
.include "../../devel/py-meson/build.mk"
|
||||
|
||||
.include "../../mk/bsd.pkg.mk"
|
||||
|
|
|
@ -38,22 +38,39 @@ include/libdrm/savage_drm.h
|
|||
include/libdrm/sis_drm.h
|
||||
include/libdrm/tegra_drm.h
|
||||
include/libdrm/vc4_drm.h
|
||||
${PLIST.libkms}include/libkms/libkms.h
|
||||
${PLIST.arm}include/libdrm/vc4_packet.h
|
||||
${PLIST.arm}include/libdrm/vc4_qpu_defines.h
|
||||
include/libdrm/via_drm.h
|
||||
include/libdrm/virtgpu_drm.h
|
||||
include/libdrm/vmwgfx_drm.h
|
||||
${PLIST.libkms}include/libkms/libkms.h
|
||||
include/libsync.h
|
||||
include/xf86drm.h
|
||||
include/xf86drmMode.h
|
||||
lib/libdrm.la
|
||||
lib/libdrm_amdgpu.la
|
||||
@comment lib/libdrm.la
|
||||
lib/libdrm.so
|
||||
lib/libdrm.so.2
|
||||
lib/libdrm.so.2.4.0
|
||||
@comment lib/libdrm_amdgpu.la
|
||||
lib/libdrm_amdgpu.so
|
||||
lib/libdrm_amdgpu.so.1
|
||||
lib/libdrm_amdgpu.so.1.0.0
|
||||
${PLIST.arm}lib/libdrm_freedreno.la
|
||||
${PLIST.intel}lib/libdrm_intel.la
|
||||
lib/libdrm_nouveau.la
|
||||
lib/libdrm_radeon.la
|
||||
${PLIST.libkms}lib/libkms.la
|
||||
@comment ${PLIST.intel}lib/libdrm_intel.la
|
||||
${PLIST.intel}lib/libdrm_intel.so
|
||||
${PLIST.intel}lib/libdrm_intel.so.1
|
||||
${PLIST.intel}lib/libdrm_intel.so.1.0.0
|
||||
@comment lib/libdrm_nouveau.la
|
||||
lib/libdrm_nouveau.so
|
||||
lib/libdrm_nouveau.so.2
|
||||
lib/libdrm_nouveau.so.2.0.0
|
||||
@comment lib/libdrm_radeon.la
|
||||
lib/libdrm_radeon.so
|
||||
lib/libdrm_radeon.so.1
|
||||
lib/libdrm_radeon.so.1.0.1
|
||||
${PLIST.libkms}lib/libkms.so
|
||||
${PLIST.libkms}lib/libkms.so.1
|
||||
${PLIST.libkms}lib/libkms.so.1.0.0
|
||||
lib/pkgconfig/libdrm.pc
|
||||
lib/pkgconfig/libdrm_amdgpu.pc
|
||||
${PLIST.arm}lib/pkgconfig/libdrm_freedreno.pc
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
@comment $NetBSD: PLIST.DragonFly,v 1.1 2014/06/01 06:37:46 ryoon Exp $
|
||||
include/libkms/libkms.h
|
||||
lib/libkms.la
|
||||
lib/pkgconfig/libkms.pc
|
||||
@comment include/libkms/libkms.h
|
||||
@comment lib/libkms.la
|
||||
@comment ${PLIST.libkms}lib/libkms.so
|
||||
@comment ${PLIST.libkms}lib/libkms.so.1
|
||||
@comment ${PLIST.libkms}lib/libkms.so.1.0.0
|
||||
@comment lib/pkgconfig/libkms.pc
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
@comment $NetBSD: PLIST.FreeBSD,v 1.1 2014/04/18 09:43:29 asau Exp $
|
||||
include/libkms/libkms.h
|
||||
lib/libkms.la
|
||||
lib/pkgconfig/libkms.pc
|
||||
@comment include/libkms/libkms.h
|
||||
@comment lib/libkms.la
|
||||
@comment ${PLIST.libkms}lib/libkms.so
|
||||
@comment ${PLIST.libkms}lib/libkms.so.1
|
||||
@comment ${PLIST.libkms}lib/libkms.so.1.0.0
|
||||
@comment lib/pkgconfig/libkms.pc
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: builtin.mk,v 1.4 2018/06/01 15:05:43 maya Exp $
|
||||
|
||||
BUILTIN_PKG:= libdrm
|
||||
BUILTIN_PKG:= libdrm
|
||||
.for pcfile in libdrm libdrm_amdgpu libdrm_intel libdrm_nouveau libdrm_radeon
|
||||
PKGCONFIG_FILE.libdrm+= ${X11BASE}/lib/pkgconfig/${pcfile}.pc
|
||||
PKGCONFIG_FILE.libdrm+= ${X11BASE}/lib${LIBABISUFFIX}/pkgconfig/${pcfile}.pc
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
$NetBSD: distinfo,v 1.92 2019/01/22 21:50:47 wiz Exp $
|
||||
$NetBSD: distinfo,v 1.93 2019/04/23 09:51:47 wiz Exp $
|
||||
|
||||
SHA1 (libdrm-2.4.97.tar.bz2) = 7635bec769a17edd140282fa2c46838c4a44bc91
|
||||
RMD160 (libdrm-2.4.97.tar.bz2) = eb9b715aef37af8b879f45fb2ee5fbb9adbba31b
|
||||
SHA512 (libdrm-2.4.97.tar.bz2) = 3e08ee9d6c9ce265d783a59b51e22449905ea73aa27f25a082a1e9e1532f7c99e1c9f7cb966eb0970be2a08e2e5993dc9aa55093b1bff548689fdb465e7145ed
|
||||
Size (libdrm-2.4.97.tar.bz2) = 837329 bytes
|
||||
SHA1 (libdrm-2.4.99.tar.bz2) = e15a3fcc2d321b03d233a245a8593abde7feefd4
|
||||
RMD160 (libdrm-2.4.99.tar.bz2) = 6561915eeba4a5348d342620c2495dabed99d63f
|
||||
SHA512 (libdrm-2.4.99.tar.bz2) = 04702eebe8dca97fac61653623804fdcb0b8b3714bdc6f5e72f0dfdce9c9524cf16f69d37aa9feac79ddc1c11939be44a216484563a612414668ea5eaeadf191
|
||||
Size (libdrm-2.4.99.tar.bz2) = 853659 bytes
|
||||
SHA1 (patch-ac) = 67c998df7dfc0dabc86320ea6d015cede3e464ea
|
||||
SHA1 (patch-include_drm_drm.h) = 48a912f40bf2b2a1c23edbe4446fa7869212f17b
|
||||
SHA1 (patch-include_drm_drm.h) = 964d1af410469f8995a7be8c603e33ae3701c0d4
|
||||
SHA1 (patch-intel_intel__bufmgr__gem.c) = 29598cfacd6b6f7432001d0d884b4e4204c18d4a
|
||||
SHA1 (patch-intel_uthash.h) = fba0a7bb2437760b06640a3d69f1a44b62726a3a
|
||||
SHA1 (patch-libkms_vmwgfx.c) = de56a4f1724bef5f237f183eca889b8cef3b81af
|
||||
SHA1 (patch-libsync.h) = 1e0603e72a54a069fc9d2ab2c9559d22381a69d3
|
||||
SHA1 (patch-xf86atomic.h) = 887db95db00125bdfa1ab298b2ccc555dec70366
|
||||
SHA1 (patch-xf86drm.c) = 3cd8c6a6e26728d92ec3fc03cfffa778a65c286b
|
||||
SHA1 (patch-meson.build) = f010ba233e8a50ec59f323a8a6669758b3bdb7bf
|
||||
SHA1 (patch-xf86atomic.h) = e8af89dfefe0537e33dce16609b083261792b1ad
|
||||
SHA1 (patch-xf86drm.c) = 84aa5b4bd19a86ce449c9757db55e39e1fd61f73
|
||||
SHA1 (patch-xf86drmMode.c) = d7c6617ef54f76dc3dac00098adbb2f6fb02d685
|
||||
SHA1 (patch-xf86drmMode.h) = 265989e670cc7ead9bb5002e116e5ab56439ede6
|
||||
|
|
|
@ -1,10 +1,32 @@
|
|||
$NetBSD: patch-include_drm_drm.h,v 1.4 2016/04/29 11:17:34 wiz Exp $
|
||||
|
||||
NetBSD xsrc:
|
||||
protect from redefinition
|
||||
|
||||
Fix compilation on systems that don't provide O_CLOEXEC.
|
||||
|
||||
--- include/drm/drm.h.orig 2016-04-28 00:44:16.000000000 +0000
|
||||
--- include/drm/drm.h.orig 2019-07-02 18:36:50.000000000 +0000
|
||||
+++ include/drm/drm.h
|
||||
@@ -674,7 +674,11 @@ struct drm_set_client_cap {
|
||||
@@ -47,6 +47,10 @@ typedef unsigned int drm_handle_t;
|
||||
#include <stdint.h>
|
||||
#include <sys/ioccom.h>
|
||||
#include <sys/types.h>
|
||||
+#if !defined(__NetBSD__) || !defined(__linux_sized_types__)
|
||||
+#if defined(__NetBSD__) && !defined(__linux_sized_types__)
|
||||
+#define __linux_sized_types__
|
||||
+#endif /* __NetBSD__ */
|
||||
typedef int8_t __s8;
|
||||
typedef uint8_t __u8;
|
||||
typedef int16_t __s16;
|
||||
@@ -55,6 +59,7 @@ typedef int32_t __s32;
|
||||
typedef uint32_t __u32;
|
||||
typedef int64_t __s64;
|
||||
typedef uint64_t __u64;
|
||||
+#endif /* __linux_sized_types__ */
|
||||
typedef size_t __kernel_size_t;
|
||||
typedef unsigned long drm_handle_t;
|
||||
|
||||
@@ -699,7 +704,11 @@ struct drm_set_client_cap {
|
||||
};
|
||||
|
||||
#define DRM_RDWR O_RDWR
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
$NetBSD$
|
||||
|
||||
--- intel/intel_bufmgr_gem.c.orig 2019-03-12 11:55:31.000000000 +0000
|
||||
+++ intel/intel_bufmgr_gem.c
|
||||
@@ -43,6 +43,9 @@
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
+#if defined(STRICT_XSRC_NETBSD)
|
||||
+#include <stddef.h>
|
||||
+#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- intel/uthash.h.orig 2019-03-12 11:55:31.000000000 +0000
|
||||
+++ intel/uthash.h
|
||||
@@ -71,7 +71,7 @@ do {
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
#endif
|
||||
-#elif defined(__GNUC__) && !defined(__VXWORKS__)
|
||||
+#elif ((defined(STRICT_XSRC_NETBSD) && defined(__lint__)) || defined(__GNUC__)) && !defined(__VXWORKS__)
|
||||
#include <stdint.h>
|
||||
#else
|
||||
typedef unsigned int uint32_t;
|
|
@ -0,0 +1,29 @@
|
|||
$NetBSD$
|
||||
|
||||
From FreeBSD ports graphics/libdrm 2.4.98
|
||||
- sys/sysctl.h isn't self-sufficient
|
||||
|
||||
--- meson.build.orig 2019-04-19 15:52:29.000000000 +0000
|
||||
+++ meson.build
|
||||
@@ -35,11 +35,7 @@ config.set10('UDEV', get_option('udev'))
|
||||
with_freedreno_kgsl = get_option('freedreno-kgsl')
|
||||
with_install_tests = get_option('install-test-programs')
|
||||
|
||||
-if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
|
||||
- dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
|
||||
-else
|
||||
- dep_pthread_stubs = []
|
||||
-endif
|
||||
+dep_pthread_stubs = []
|
||||
dep_threads = dependency('threads')
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
@@ -181,7 +177,7 @@ endif
|
||||
dep_m = cc.find_library('m', required : false)
|
||||
foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
|
||||
config.set('HAVE_' + header.underscorify().to_upper(),
|
||||
- cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header)))
|
||||
+ cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
|
||||
endforeach
|
||||
if cc.has_header_symbol('sys/sysmacros.h', 'major')
|
||||
config.set10('MAJOR_IN_SYSMACROS', true)
|
|
@ -1,17 +1,40 @@
|
|||
$NetBSD$
|
||||
|
||||
Option to define atomic types similar to current NetBSD xsrc.
|
||||
|
||||
This single patch allows glxgears to run properly on
|
||||
an Intel integrated graphics IvyBridge machine on DragonFly.
|
||||
libdrm atomic_add_unless() may reverse return value meaning
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=100077
|
||||
|
||||
--- xf86atomic.h.orig 2015-09-22 04:34:51.000000000 +0000
|
||||
--- xf86atomic.h.orig 2019-03-12 11:55:31.000000000 +0000
|
||||
+++ xf86atomic.h
|
||||
@@ -111,7 +111,11 @@ static inline int atomic_add_unless(atom
|
||||
@@ -79,12 +79,20 @@ typedef struct {
|
||||
#define HAS_ATOMIC_OPS 1
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
+#if defined(STRICT_XSRC_NETBSD)
|
||||
+#define LIBDRM_ATOMIC_TYPE unsigned int
|
||||
+#else /* !STRICT_XSRC_NETBSD */
|
||||
#define LIBDRM_ATOMIC_TYPE int
|
||||
+#endif /*STRICT_XSRC_NETBSD */
|
||||
#else
|
||||
#define LIBDRM_ATOMIC_TYPE uint_t
|
||||
#endif
|
||||
|
||||
+#if defined(STRICT_XSRC_NETBSD)
|
||||
+typedef struct { volatile LIBDRM_ATOMIC_TYPE atomic; } atomic_t;
|
||||
+#else /* !STRICT_XSRC_NETBSD */
|
||||
typedef struct { LIBDRM_ATOMIC_TYPE atomic; } atomic_t;
|
||||
+#endif /*STRICT_XSRC_NETBSD */
|
||||
|
||||
# define atomic_read(x) (int) ((x)->atomic)
|
||||
# define atomic_set(x, val) ((x)->atomic = (LIBDRM_ATOMIC_TYPE)(val))
|
||||
@@ -107,7 +115,11 @@ static inline int atomic_add_unless(atom
|
||||
c = atomic_read(v);
|
||||
while (c != unless && (old = atomic_cmpxchg(v, c, c + add)) != c)
|
||||
c = old;
|
||||
+#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
+#if defined(INVERT_ATOMIC_ADD_UNLESS)
|
||||
+ return c != unless;
|
||||
+#else
|
||||
return c == unless;
|
||||
|
|
|
@ -2,15 +2,15 @@ $NetBSD: patch-xf86drm.c,v 1.4 2019/01/22 21:50:47 wiz Exp $
|
|||
|
||||
Implement drmParseSubsystemType, drmParsePciBusInfo for NetBSD
|
||||
|
||||
Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
||||
Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.98.
|
||||
|
||||
--- xf86drm.c.orig 2019-01-22 16:32:41.000000000 +0000
|
||||
--- xf86drm.c.orig 2019-04-19 15:52:29.000000000 +0000
|
||||
+++ xf86drm.c
|
||||
@@ -46,6 +46,11 @@
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+#ifdef HAVE_SYS_SYSCTL_H
|
||||
+#include <sys/sysctl.h>
|
||||
+#endif
|
||||
|
@ -22,7 +22,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
#endif
|
||||
#include <math.h>
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+#include <sys/pciio.h>
|
||||
+#endif
|
||||
+
|
||||
|
@ -37,7 +37,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
+#define DRM_MAJOR 0 /* Major ID unused on systems with devfs */
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+#define DRM_NODE_NAME_MAX \
|
||||
+ (sizeof(DRM_DIR_NAME) + \
|
||||
+ MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), \
|
||||
|
@ -55,20 +55,11 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
#endif
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
@@ -101,7 +122,7 @@
|
||||
#define DRM_MAJOR 226 /* Linux */
|
||||
#endif
|
||||
|
||||
-#if defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
+#if defined(__OpenBSD__)
|
||||
struct drm_pciinfo {
|
||||
uint16_t domain;
|
||||
uint8_t bus;
|
||||
@@ -222,6 +243,35 @@ drm_public drmHashEntry *drmGetEntry(int
|
||||
return entry;
|
||||
}
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+static int drmGetMinorBase(int type);
|
||||
+static int drmGetMinorType(int minor);
|
||||
+
|
||||
|
@ -95,7 +86,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
+}
|
||||
+
|
||||
+static int drmGetNodeType(const char *name);
|
||||
+#endif /* __FreeBSD__ || __DragonFly__ */
|
||||
+#endif /* __FreeBSD__ */
|
||||
+
|
||||
/**
|
||||
* Compare two busid strings
|
||||
|
@ -104,7 +95,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
return -EINVAL;
|
||||
};
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ sprintf(buf, dev_name, DRM_DIR_NAME, minor + drmGetMinorBase(type));
|
||||
+#else
|
||||
sprintf(buf, dev_name, DRM_DIR_NAME, minor);
|
||||
|
@ -116,7 +107,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
return -EINVAL;
|
||||
};
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ sprintf(buf, dev_name, DRM_DIR_NAME, minor + drmGetMinorBase(type));
|
||||
+#else
|
||||
sprintf(buf, dev_name, DRM_DIR_NAME, minor);
|
||||
|
@ -128,19 +119,19 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
static int drmGetMinorBase(int type)
|
||||
{
|
||||
switch (type) {
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ case DRM_NODE_PRIMARY:
|
||||
+ case DRM_NODE_CONTROL:
|
||||
+ case DRM_NODE_RENDER:
|
||||
+ return type << 6;
|
||||
+#else /* !__FreeBSD__ && !__DragonFly__ */
|
||||
+#else /* !__FreeBSD__ */
|
||||
case DRM_NODE_PRIMARY:
|
||||
return 0;
|
||||
case DRM_NODE_CONTROL:
|
||||
return 64;
|
||||
case DRM_NODE_RENDER:
|
||||
return 128;
|
||||
+#endif /* __FreeBSD__ || __DragonFly__ */
|
||||
+#endif /* __FreeBSD__ */
|
||||
default:
|
||||
return -1;
|
||||
};
|
||||
|
@ -160,13 +151,25 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
|
||||
/**
|
||||
* Open the device by bus ID.
|
||||
@@ -2779,12 +2846,29 @@ static bool drmNodeIsDRM(int maj, int mi
|
||||
@@ -2571,7 +2638,7 @@ drm_public int drmCommandNone(int fd, un
|
||||
{
|
||||
unsigned long request;
|
||||
|
||||
- request = DRM_IO( DRM_COMMAND_BASE + drmCommandIndex);
|
||||
+ request = DRM_IO( (DRM_COMMAND_BASE + drmCommandIndex) );
|
||||
|
||||
if (drmIoctl(fd, request, NULL)) {
|
||||
return -errno;
|
||||
@@ -2796,13 +2863,32 @@ static bool drmNodeIsDRM(int maj, int mi
|
||||
snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
|
||||
maj, min);
|
||||
return stat(path, &sbuf) == 0;
|
||||
#else
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+ return !DRM_MAJOR || maj == DRM_MAJOR;
|
||||
+#elif defined(__DragonFly__)
|
||||
+ return true; /* DragonFly BSD has no fixed major device numbers */
|
||||
+#else
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ return !DRM_MAJOR || maj == DRM_MAJOR;
|
||||
#else
|
||||
return maj == DRM_MAJOR;
|
||||
#endif
|
||||
+#endif
|
||||
|
@ -174,14 +177,14 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
|
||||
drm_public int drmGetNodeTypeFromFd(int fd)
|
||||
{
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ char *name = drmGetDeviceNameFromFd2(fd);
|
||||
+ if (!name) {
|
||||
+ errno = ENODEV;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ int type = drmGetNodeType(name);
|
||||
+ int type = drmGetNodeType(strrchr(name, '/') + 1);
|
||||
+ free(name);
|
||||
+ if (type < 0)
|
||||
+ errno = ENODEV;
|
||||
|
@ -190,7 +193,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
struct stat sbuf;
|
||||
int maj, min, type;
|
||||
|
||||
@@ -2803,6 +2887,7 @@ drm_public int drmGetNodeTypeFromFd(int
|
||||
@@ -2821,6 +2907,7 @@ drm_public int drmGetNodeTypeFromFd(int
|
||||
if (type == -1)
|
||||
errno = ENODEV;
|
||||
return type;
|
||||
|
@ -198,11 +201,11 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
}
|
||||
|
||||
drm_public int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags,
|
||||
@@ -2881,6 +2966,25 @@ static char *drmGetMinorNameForFD(int fd
|
||||
@@ -2899,6 +2986,25 @@ static char *drmGetMinorNameForFD(int fd
|
||||
|
||||
closedir(sysdir);
|
||||
return NULL;
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ const char *dev_name = drmGetDeviceName(type);
|
||||
+ if (!dev_name)
|
||||
+ return NULL;
|
||||
|
@ -224,7 +227,16 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
#else
|
||||
struct stat sbuf;
|
||||
char buf[PATH_MAX + 1];
|
||||
@@ -3014,7 +3118,66 @@ static int drmParseSubsystemType(int maj
|
||||
@@ -2934,7 +3040,7 @@ static char *drmGetMinorNameForFD(int fd
|
||||
return NULL;
|
||||
|
||||
n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min - base);
|
||||
- if (n == -1 || n >= sizeof(buf))
|
||||
+ if (n == -1 || n >= (int)sizeof(buf))
|
||||
return NULL;
|
||||
|
||||
return strdup(buf);
|
||||
@@ -3032,7 +3138,66 @@ static int drmParseSubsystemType(int maj
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
|
@ -292,7 +304,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
return DRM_BUS_PCI;
|
||||
#else
|
||||
#warning "Missing implementation of drmParseSubsystemType"
|
||||
@@ -3022,6 +3185,7 @@ static int drmParseSubsystemType(int maj
|
||||
@@ -3040,6 +3205,7 @@ static int drmParseSubsystemType(int maj
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -300,13 +312,13 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
static void
|
||||
get_pci_path(int maj, int min, char *pci_path)
|
||||
{
|
||||
@@ -3037,8 +3201,14 @@ get_pci_path(int maj, int min, char *pci
|
||||
@@ -3055,8 +3221,14 @@ get_pci_path(int maj, int min, char *pci
|
||||
if (term && strncmp(term, "/virtio", 7) == 0)
|
||||
*term = 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+static int drmParsePciBusInfo(const char *node, int node_type,
|
||||
+ int maj, int min, drmPciBusInfoPtr info)
|
||||
+#else
|
||||
|
@ -315,11 +327,10 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
{
|
||||
#ifdef __linux__
|
||||
unsigned int domain, bus, dev, func;
|
||||
@@ -3063,7 +3233,74 @@ static int drmParsePciBusInfo(int maj, i
|
||||
@@ -3081,6 +3253,73 @@ static int drmParsePciBusInfo(int maj, i
|
||||
info->func = func;
|
||||
|
||||
return 0;
|
||||
-#elif defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
+#elif defined(__NetBSD__)
|
||||
+ int type, fd;
|
||||
+ drmSetVersion sv;
|
||||
|
@ -387,15 +398,14 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
+
|
||||
+ /* Success! */
|
||||
+ return 0;
|
||||
+#elif defined(__OpenBSD__)
|
||||
#elif defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
struct drm_pciinfo pinfo;
|
||||
int fd, type;
|
||||
|
||||
@@ -3087,6 +3324,61 @@ static int drmParsePciBusInfo(int maj, i
|
||||
@@ -3105,6 +3344,61 @@ static int drmParsePciBusInfo(int maj, i
|
||||
info->func = pinfo.func;
|
||||
|
||||
return 0;
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ /*
|
||||
+ * Only the primary nodes can be mapped to hw.dri.%i via major/minor
|
||||
+ * Determine the primary node by offset and use its major/minor pair
|
||||
|
@ -453,33 +463,32 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
#else
|
||||
#warning "Missing implementation of drmParsePciBusInfo"
|
||||
return -EINVAL;
|
||||
@@ -3135,7 +3427,11 @@ static int drmGetNodeType(const char *na
|
||||
@@ -3153,7 +3447,11 @@ static int drmGetNodeType(const char *na
|
||||
sizeof(DRM_RENDER_MINOR_NAME) - 1) == 0)
|
||||
return DRM_NODE_RENDER;
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ return -1;
|
||||
+#else /* !__FreeBSD__ || __DragonFly__ */
|
||||
+#else /* !__FreeBSD__ */
|
||||
return -EINVAL;
|
||||
+#endif /* __FreeBSD__ || __DragonFly__ */
|
||||
+#endif /* __FreeBSD__ */
|
||||
}
|
||||
|
||||
static int drmGetMaxNodeName(void)
|
||||
@@ -3218,6 +3514,9 @@ static int parse_config_sysfs_file(int m
|
||||
@@ -3236,6 +3534,9 @@ static int parse_config_sysfs_file(int m
|
||||
#endif
|
||||
|
||||
static int drmParsePciDeviceInfo(int maj, int min,
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ drmPciBusInfoPtr info,
|
||||
+#endif
|
||||
drmPciDeviceInfoPtr device,
|
||||
uint32_t flags)
|
||||
{
|
||||
@@ -3229,7 +3528,49 @@ static int drmParsePciDeviceInfo(int maj
|
||||
@@ -3247,6 +3548,48 @@ static int drmParsePciDeviceInfo(int maj
|
||||
return parse_config_sysfs_file(maj, min, device);
|
||||
|
||||
return 0;
|
||||
-#elif defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
+#elif defined(__NetBSD__)
|
||||
+ drmPciBusInfo businfo;
|
||||
+ char fname[PATH_MAX];
|
||||
|
@ -522,15 +531,14 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
+ ret = -errno;
|
||||
+ close(pcifd);
|
||||
+ return ret;
|
||||
+#elif defined(__OpenBSD__)
|
||||
#elif defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
struct drm_pciinfo pinfo;
|
||||
int fd, type;
|
||||
|
||||
@@ -3254,6 +3595,43 @@ static int drmParsePciDeviceInfo(int maj
|
||||
@@ -3272,6 +3615,43 @@ static int drmParsePciDeviceInfo(int maj
|
||||
device->subdevice_id = pinfo.subdevice_id;
|
||||
|
||||
return 0;
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ struct pci_conf_io pc;
|
||||
+ struct pci_match_conf patterns[1];
|
||||
+ struct pci_conf results[1];
|
||||
|
@ -570,11 +578,11 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
#else
|
||||
#warning "Missing implementation of drmParsePciDeviceInfo"
|
||||
return -EINVAL;
|
||||
@@ -3380,18 +3758,42 @@ static int drmProcessPciDevice(drmDevice
|
||||
@@ -3398,18 +3778,42 @@ static int drmProcessPciDevice(drmDevice
|
||||
|
||||
dev->businfo.pci = (drmPciBusInfoPtr)addr;
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ ret = drmParsePciBusInfo(node, node_type, maj, min, dev->businfo.pci);
|
||||
+#else
|
||||
ret = drmParsePciBusInfo(maj, min, dev->businfo.pci);
|
||||
|
@ -592,7 +600,7 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
addr += sizeof(drmPciBusInfo);
|
||||
dev->deviceinfo.pci = (drmPciDeviceInfoPtr)addr;
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ ret = drmParsePciDeviceInfo(maj, min, dev->businfo.pci, dev->deviceinfo.pci, flags);
|
||||
+#else
|
||||
ret = drmParsePciDeviceInfo(maj, min, dev->deviceinfo.pci, flags);
|
||||
|
@ -613,11 +621,11 @@ Patches from FreeBSD ports / DragonFly dports for graphics/libdrm 2.4.84.
|
|||
}
|
||||
|
||||
*device = dev;
|
||||
@@ -4099,6 +4501,23 @@ drm_public char *drmGetDeviceNameFromFd2
|
||||
@@ -4078,6 +4482,23 @@ drm_public char *drmGetDeviceNameFromFd2
|
||||
free(value);
|
||||
|
||||
return strdup(path);
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ stat_t sbuf;
|
||||
+ if (fstat(fd, &sbuf))
|
||||
+ return NULL;
|
||||
|
|
Loading…
Reference in New Issue