1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= Direct Rendering Module services kernel interface
8 HOMEPAGE= https://dri.freedesktop.org
12 SITES[main]= https://dri.freedesktop.org/libdrm/
13 DISTFILE[1]= libdrm-2.4.114.tar.xz:main
15 SPKGS[standard]= single
17 OPTIONS_AVAILABLE= ARM X86
18 OPTIONS_STANDARD= ARM X86
23 BUILD_DEPENDS= libpthread-stubs:single:standard
24 libxslt:single:standard
25 libxml2:single:standard
26 python-docutils:single:python_default
28 USES= gmake pkgconfig solaris-funcs meson
29 XORG_COMPONENTS= pciaccess
32 LICENSE_FILE= MIT:{{WRKDIR}}/LICENSE_MIT
33 LICENSE_AWK= MIT:"_XF86DRM_H_"
34 LICENSE_SOURCE= MIT:{{WRKSRC}}/xf86drm.h
37 FPC_EQUIVALENT= graphics/libdrm
38 MESON_ARGS= -Dman-pages=enabled
39 -Dinstall-test-programs=true
40 -Dcairo-tests=disabled
44 SOL_FUNCTIONS= getline:amdgpu/amdgpu_asic_id.c
46 asprintf:tests/modetest/modetest.c
47 strndup:tests/modetest/modetest.c
49 INSTALL_TARGET= install-strip
50 INSTALL_REQ_TOOLCHAIN= yes
52 VAR_OPSYS[sunos]= LDFLAGS=-lrt
53 VAR_OPSYS[netbsd]= LDFLAGS=-lpci
55 [X86].DESCRIPTION= DRM Drivers for amd64 and i386 architectures
56 [X86].CONFIGURE_ARGS_OFF= -Dintel=disabled
58 [X86].CONFIGURE_ARGS_ON= -Dintel=enabled
61 [ARM].DESCRIPTION= DRM Drivers for AARCH64 architecture
62 [ARM].CONFIGURE_ARGS_OFF= -Detnaviv=disabled
68 [ARM].CONFIGURE_ARGS_ON= -Detnaviv=enabled
75 [FILE:70:descriptions/desc.single]
76 Userspace interface to kernel DRM (Direct Rendering Module) services.
80 3049cf843a47d12e5eeefbc3be3496d782fa09f42346bf0b7defe3d1e598d026 471664 libdrm-2.4.114.tar.xz
83 [FILE:1634:manifests/plist.single]
84 %%ARM-ON%%include/freedreno/
86 freedreno_ringbuffer.h
87 %%ARM-ON%%include/libdrm/
93 libdrm_freedreno.so.1.0.0
94 %%ARM-ON%%lib/pkgconfig/
97 %%X86-ON%%bin/amdgpu_stress
98 %%X86-ON%%include/libdrm/
112 %%X86-ON%%include/libdrm/nouveau/nouveau.h
113 %%X86-ON%%include/libdrm/nouveau/nvif/
124 libdrm_amdgpu.so.1.0.0
127 libdrm_intel.so.1.0.0
130 libdrm_nouveau.so.2.0.0
133 libdrm_radeon.so.1.0.1
134 %%X86-ON%%lib/pkgconfig/
139 %%X86-ON%%share/libdrm/amdgpu.ids
174 lib/pkgconfig/libdrm.pc
178 drmModeGetResources.3.gz
185 [FILE:425:patches/patch-amdgpu_amdgpu__cs.c]
186 $NetBSD: patch-amdgpu_amdgpu__cs.c,v 1.3 2022/03/13 15:20:01 tnn Exp $
188 libc-supplied compat alloca(3) should not be used
190 --- amdgpu/amdgpu_cs.c.orig 2022-11-03 08:33:36 UTC
191 +++ amdgpu/amdgpu_cs.c
195 #include <sys/ioctl.h>
197 -# include <alloca.h>
199 +#define alloca(size) __builtin_alloca(size)
202 #include "amdgpu_drm.h"
205 [FILE:834:patches/patch-amdgpu_amdgpu__device.c]
206 --- amdgpu/amdgpu_device.c.orig 2022-11-03 08:33:36 UTC
207 +++ amdgpu/amdgpu_device.c
208 @@ -177,7 +177,12 @@ drm_public int amdgpu_device_initialize(
211 if ((flag_auth) && (!flag_authexist)) {
212 +#ifdef F_DUPFD_CLOEXEC
213 dev->flink_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
215 + dev->flink_fd = fcntl(fd, F_DUPFD, 0);
216 + fcntl(dev->flink_fd, F_SETFD, FD_CLOEXEC);
219 *major_version = dev->major_version;
220 *minor_version = dev->minor_version;
221 @@ -211,7 +216,12 @@ drm_public int amdgpu_device_initialize(
225 +#ifdef F_DUPFD_CLOEXEC
226 dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
228 + dev->fd = fcntl(fd, F_DUPFD, 0);
229 + fcntl(dev->fd, F_SETFD, FD_CLOEXEC);
231 dev->flink_fd = dev->fd;
232 dev->major_version = version->version_major;
233 dev->minor_version = version->version_minor;
236 [FILE:283:patches/patch-include_drm_drm.h]
237 --- include/drm/drm.h.orig 2022-11-03 08:33:36 UTC
238 +++ include/drm/drm.h
239 @@ -837,7 +837,11 @@ struct drm_set_client_cap {
242 #define DRM_RDWR O_RDWR
244 +#define DRM_CLOEXEC 0
246 #define DRM_CLOEXEC O_CLOEXEC
248 struct drm_prime_handle {
253 [FILE:689:patches/patch-intel_intel__bufmgr__gem.c]
254 --- intel/intel_bufmgr_gem.c.orig 2022-11-03 08:33:36 UTC
255 +++ intel/intel_bufmgr_gem.c
256 @@ -966,6 +966,27 @@ drm_intel_gem_bo_alloc_userptr(drm_intel
261 +#define posix_memalign illumos_memalign
263 +posix_memalign(void **memptr, size_t alignment, size_t size)
268 + if (alignment == 0 ||
269 + (alignment & (sizeof (void *) - 1)) != 0 ||
270 + (alignment & (alignment - 1)) != 0)
272 + else if (size != 0 &&
273 + (ptr = memalign(alignment, size)) == NULL)
282 has_userptr(drm_intel_bufmgr_gem *bufmgr_gem)
286 [FILE:379:patches/patch-intel_test__decode.c]
287 --- intel/test_decode.c.orig 2022-11-03 08:33:36 UTC
288 +++ intel/test_decode.c
291 #include <sys/types.h>
292 #include <sys/stat.h>
294 +#define errx(exitcode, format, args...) \
295 + { fprintf(stderr, format "\n", ## args); \
301 #include "libdrm_macros.h"
302 #include "intel_bufmgr.h"
305 [FILE:521:patches/patch-libsync.h]
306 define ETIME as ETIMEOUT same as done in mesa
308 --- libsync.h.orig 2022-11-03 08:33:36 UTC
311 #include <sys/ioctl.h>
312 #include <sys/poll.h>
315 +#define ETIME ETIMEDOUT
318 #if defined(__cplusplus)
320 @@ -53,6 +56,9 @@ struct sync_merge_data {
325 +#include <sys/ioccom.h>
327 #define SYNC_IOC_MAGIC '>'
328 #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
332 [FILE:542:patches/patch-meson.build]
333 $NetBSD: patch-meson.build,v 1.3 2022/11/03 20:52:29 triaxx Exp $
335 xxx how to deal with this properly?
337 --- meson.build.orig 2022-11-03 08:33:36 UTC
339 @@ -40,7 +40,7 @@ with_freedreno_kgsl = get_option('freedr
340 with_install_tests = get_option('install-test-programs')
341 with_tests = get_option('tests')
343 -if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
344 +if ['dragonfly'].contains(host_machine.system())
345 dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
347 dep_pthread_stubs = []
350 [FILE:267:patches/patch-tests_drmdevice.c]
351 --- tests/drmdevice.c.orig 2022-11-03 08:33:36 UTC
352 +++ tests/drmdevice.c
362 print_device_info(drmDevicePtr device, int i, bool print_revision)
365 [FILE:333:patches/patch-tests_modetest_meson.build]
366 --- tests/modetest/meson.build.orig 2022-11-03 08:33:36 UTC
367 +++ tests/modetest/meson.build
368 @@ -25,5 +25,6 @@ modetest = executable(
369 include_directories : [inc_root, inc_tests, inc_drm],
370 dependencies : [dep_threads, dep_cairo],
371 link_with : [libdrm, libutil],
372 + link_args : ['-lpthread'],
373 install : with_install_tests,
377 [FILE:358:patches/patch-tests_nouveau_meson.build]
378 --- tests/nouveau/meson.build.orig 2022-11-03 08:33:36 UTC
379 +++ tests/nouveau/meson.build
380 @@ -24,6 +24,7 @@ threaded = executable(
381 dependencies : [dep_dl, dep_threads],
382 include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
383 link_with : [libdrm, libdrm_nouveau],
384 + link_args : ['-lpthread'],
385 c_args : libdrm_c_args,
390 [FILE:387:patches/patch-tests_nouveau_threaded.c]
391 --- tests/nouveau/threaded.c.orig 2022-11-03 08:33:36 UTC
392 +++ tests/nouveau/threaded.c
393 @@ -36,7 +36,7 @@ static int failed;
395 static int import_fd;
397 -#if defined(__GLIBC__) || defined(__FreeBSD__)
398 +#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
399 int ioctl(int fd, unsigned long request, ...)
401 int ioctl(int fd, int request, ...)
404 [FILE:7504:patches/patch-xf86drm.c]
405 --- xf86drm.c.orig 2022-11-03 08:33:36 UTC
409 #include <inttypes.h>
411 -#if defined(__FreeBSD__)
416 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
423 #include <sys/param.h>
424 #include <sys/pciio.h>
430 -#define DRM_MAJOR 34
431 +#define DRM_MAJOR 180
432 +#include <sys/param.h>
433 +#include <dev/pci/pcireg.h>
438 @@ -313,8 +326,10 @@ drmGetFormatModifierNameFromArm(uint64_t
439 char *modifier_name = NULL;
443 fp = open_memstream(&modifier_name, &size);
449 @@ -459,8 +474,10 @@ drmGetFormatModifierNameFromAmd(uint64_t
450 tile_version = AMD_FMT_MOD_GET(TILE_VERSION, modifier);
451 dcc = AMD_FMT_MOD_GET(DCC, modifier);
454 fp = open_memstream(&mod_amd, &size);
460 @@ -963,7 +980,7 @@ static int drmGetMinorBase(int type)
462 static int drmGetMinorType(int major, int minor)
466 char name[SPECNAMELEN];
469 @@ -3219,7 +3236,7 @@ drm_public int drmIsMaster(int fd)
471 drm_public char *drmGetDeviceNameFromFd(int fd)
478 @@ -3266,7 +3283,7 @@ static bool drmNodeIsDRM(int maj, int mi
479 snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
481 return stat(path, &sbuf) == 0;
482 -#elif defined(__FreeBSD__)
484 char name[SPECNAMELEN];
486 if (!devname_r(makedev(maj, min), S_IFCHR, name, sizeof(name)))
487 @@ -3389,7 +3406,7 @@ static char *drmGetMinorNameForFD(int fd
491 -#elif defined(__FreeBSD__)
494 char dname[SPECNAMELEN];
496 @@ -3574,6 +3591,65 @@ static int drmParseSubsystemType(int maj
497 return DRM_BUS_VIRTIO;
499 return subsystem_type;
500 +#elif defined(__NetBSD__)
504 + unsigned domain, bus, dev;
508 + /* Get the type of device we're looking for to pick the right pathname. */
509 + type = drmGetMinorType(maj, min);
513 + /* Open the device. Don't try to create it if it's not there. */
514 + fd = drmOpenMinor(min, 0, type);
519 + * Set the interface version to 1.4 or 1.1, which has the effect of
520 + * populating the bus id for us.
522 + sv.drm_di_major = 1;
523 + sv.drm_di_minor = 4;
524 + sv.drm_dd_major = -1;
525 + sv.drm_dd_minor = -1;
526 + if (drmSetInterfaceVersion(fd, &sv)) {
527 + sv.drm_di_major = 1;
528 + sv.drm_di_minor = 1;
529 + sv.drm_dd_major = -1;
530 + sv.drm_dd_minor = -1;
531 + if (drmSetInterfaceVersion(fd, &sv)) {
533 + * We're probably not the master. Hope the master already
534 + * set the version to >=1.1 so that we can get the busid.
539 + /* Get the bus id. */
540 + buf = drmGetBusid(fd);
542 + /* We're done with the device now. */
545 + /* If there is no bus id, fail. */
549 + /* Find a string we know about; otherwise -EINVAL. */
551 + if (strncmp(buf, "pci:", 4) == 0)
554 + /* We're done with the bus id. */
557 + /* Success or not, we're done. */
559 #elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
562 @@ -3600,7 +3676,7 @@ get_pci_path(int maj, int min, char *pci
568 static int get_sysctl_pci_bus_info(int maj, int min, drmPciBusInfoPtr info)
570 char dname[SPECNAMELEN];
571 @@ -3685,6 +3761,73 @@ static int drmParsePciBusInfo(int maj, i
575 +#elif defined(__NetBSD__)
579 + unsigned domain, bus, dev;
583 + /* Get the type of device we're looking for to pick the right pathname. */
584 + type = drmGetMinorType(maj, min);
588 + /* Open the device. Don't try to create it if it's not there. */
589 + fd = drmOpenMinor(min, 0, type);
594 + * Set the interface version to 1.4 or 1.1, which has the effect of
595 + * populating the bus id for us.
597 + sv.drm_di_major = 1;
598 + sv.drm_di_minor = 4;
599 + sv.drm_dd_major = -1;
600 + sv.drm_dd_minor = -1;
601 + if (drmSetInterfaceVersion(fd, &sv)) {
602 + sv.drm_di_major = 1;
603 + sv.drm_di_minor = 1;
604 + sv.drm_dd_major = -1;
605 + sv.drm_dd_minor = -1;
606 + if (drmSetInterfaceVersion(fd, &sv)) {
608 + * We're probably not the master. Hope the master already
609 + * set the version to >=1.1 so that we can get the busid.
614 + /* Get the bus id. */
615 + buf = drmGetBusid(fd);
617 + /* We're done with the device now. */
620 + /* If there is no bus id, fail. */
624 + /* Parse the bus id. */
625 + ret = sscanf(buf, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func);
627 + /* We're done with the bus id. */
630 + /* If scanf didn't return 4 -- domain, bus, dev, func -- then fail. */
634 + /* Populate the results. */
635 + info->domain = domain;
642 #elif defined(__OpenBSD__) || defined(__DragonFly__)
643 struct drm_pciinfo pinfo;
645 @@ -3857,6 +4000,48 @@ static int drmParsePciDeviceInfo(int maj
646 return parse_config_sysfs_file(maj, min, device);
649 +#elif defined(__NetBSD__)
650 + drmPciBusInfo businfo;
651 + char fname[PATH_MAX];
653 + pcireg_t id, class, subsys;
656 + /* Find where on the bus the device lives. */
657 + ret = drmParsePciBusInfo(maj, min, &businfo);
661 + /* Open the pciN device node to get at its config registers. */
662 + if (snprintf(fname, sizeof fname, "/dev/pci%u", businfo.domain)
665 + if ((pcifd = open(fname, O_RDONLY)) == -1)
669 + /* Read the id and class pci config registers. */
670 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
671 + PCI_ID_REG, &id) == -1)
673 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
674 + PCI_CLASS_REG, &class) == -1)
676 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
677 + PCI_SUBSYS_ID_REG, &subsys) == -1)
681 + device->vendor_id = PCI_VENDOR(id);
682 + device->device_id = PCI_PRODUCT(id);
683 + device->subvendor_id = PCI_SUBSYS_VENDOR(subsys);
684 + device->subdevice_id = PCI_SUBSYS_ID(subsys);
685 + device->revision_id = PCI_REVISION(class);
691 #elif defined(__OpenBSD__) || defined(__DragonFly__)
692 struct drm_pciinfo pinfo;
696 [FILE:397:patches/patch-xf86drm.h]
697 --- xf86drm.h.orig 2022-11-03 08:33:36 UTC
699 @@ -59,6 +59,9 @@ extern "C" {
700 #else /* One of the *BSDs */
702 #include <sys/ioccom.h>
704 +#define _IOC(inout,group,num,len) (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
706 #define DRM_IOCTL_NR(n) ((n) & 0xff)
707 #define DRM_IOC_VOID IOC_VOID
708 #define DRM_IOC_READ IOC_OUT
711 [FILE:635:patches/patch-xf86drmMode.c]
712 --- xf86drmMode.c.orig 2022-11-03 08:33:36 UTC
716 #include <sys/ioctl.h>
717 #if HAVE_SYS_SYSCTL_H
719 #include <sys/types.h>
721 #include <sys/sysctl.h>
724 @@ -1119,7 +1117,7 @@ drm_public int drmModePageFlipTarget(int
726 drm_public int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
727 uint32_t fb_id, uint32_t flags,
728 - int32_t crtc_x, int32_t crtc_y,
729 + uint32_t crtc_x, int32_t crtc_y,
730 uint32_t crtc_w, uint32_t crtc_h,
731 uint32_t src_x, uint32_t src_y,
732 uint32_t src_w, uint32_t src_h)
735 [FILE:505:patches/patch-xf86drmMode.h]
736 --- xf86drmMode.h.orig 2022-11-03 08:33:36 UTC
738 @@ -429,7 +429,7 @@ extern drmModePlaneResPtr drmModeGetPlan
739 extern drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id);
740 extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
741 uint32_t fb_id, uint32_t flags,
742 - int32_t crtc_x, int32_t crtc_y,
743 + uint32_t crtc_x, int32_t crtc_y,
744 uint32_t crtc_w, uint32_t crtc_h,
745 uint32_t src_x, uint32_t src_y,
746 uint32_t src_w, uint32_t src_h);