1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
8 SDESC[standard]= Direct Rendering Module services kernel interface
9 HOMEPAGE= https://dri.freedesktop.org
13 SITES[main]= https://dri.freedesktop.org/libdrm/
14 DISTFILE[1]= libdrm-2.4.116.tar.xz:main
16 SPKGS[standard]= complete
21 OPTIONS_AVAILABLE= ARM X86 NOUVEAU
22 OPTIONS_STANDARD= ARM X86 NOUVEAU
24 OPT_ON[linux]= NOUVEAU
28 BUILD_DEPENDS= libxslt:primary:standard
29 python-docutils:single:python_default
31 USES= gmake pkgconfig solaris-funcs meson
32 GNOME_COMPONENTS= libxml2
33 XORG_COMPONENTS= pciaccess
36 LICENSE_FILE= MIT:{{WRKDIR}}/LICENSE_MIT
37 LICENSE_AWK= MIT:"_XF86DRM_H_"
38 LICENSE_SOURCE= MIT:{{WRKSRC}}/xf86drm.h
41 FPC_EQUIVALENT= graphics/libdrm
42 MESON_ARGS= -Dman-pages=enabled
43 -Dinstall-test-programs=true
44 -Dcairo-tests=disabled
47 SOL_FUNCTIONS= getline:amdgpu/amdgpu_asic_id.c
49 asprintf:tests/modetest/modetest.c
50 strndup:tests/modetest/modetest.c
52 INSTALL_TARGET= install-strip
53 INSTALL_REQ_TOOLCHAIN= yes
55 VAR_OPSYS[sunos]= LDFLAGS=-lrt
56 VAR_OPSYS[netbsd]= LDFLAGS=-lpci
58 [X86].DESCRIPTION= DRM Drivers for amd64 and i386 architectures
59 [X86].CONFIGURE_ARGS_OFF= -Dintel=disabled
61 [X86].CONFIGURE_ARGS_ON= -Dintel=enabled
64 [ARM].DESCRIPTION= DRM Drivers for AARCH64 architecture
65 [ARM].CONFIGURE_ARGS_OFF= -Detnaviv=disabled
68 -Dfreedreno-kgsl=false
72 [ARM].CONFIGURE_ARGS_ON= -Detnaviv=enabled
79 [NOUVEAU].DESCRIPTION= Build x86 Nouveau driver
80 [NOUVEAU].CONFIGURE_ARGS_OFF= -Dnouveau=disabled
81 [NOUVEAU].CONFIGURE_ARGS_ON= -Dnouveau=enabled
83 [FILE:70:descriptions/desc.primary]
84 Userspace interface to kernel DRM (Direct Rendering Module) services.
88 46c53f40735ea3d26d614297f155f6131a510624a24274f654f6469ca905339a 473560 libdrm-2.4.116.tar.xz
91 [FILE:438:manifests/plist.primary]
94 libdrm_freedreno.so.1.0.0
95 %%X86-ON%%%%NOUVEAU-ON%%lib/
97 libdrm_nouveau.so.2.0.0
98 %%X86-ON%%bin/amdgpu_stress
101 libdrm_amdgpu.so.1.0.0
103 libdrm_intel.so.1.0.0
105 libdrm_radeon.so.1.0.1
106 %%X86-ON%%share/libdrm/amdgpu.ids
118 [FILE:139:manifests/plist.man]
122 drmModeGetResources.3.gz
129 [FILE:1209:manifests/plist.dev]
130 %%ARM-ON%%include/freedreno/
132 freedreno_ringbuffer.h
133 %%ARM-ON%%include/libdrm/
136 %%ARM-ON%%lib/libdrm_freedreno.so
137 %%ARM-ON%%lib/pkgconfig/
140 %%X86-ON%%%%NOUVEAU-ON%%include/libdrm/nouveau/nouveau.h
141 %%X86-ON%%%%NOUVEAU-ON%%include/libdrm/nouveau/nvif/
149 %%X86-ON%%%%NOUVEAU-ON%%lib/libdrm_nouveau.so
150 %%X86-ON%%%%NOUVEAU-ON%%lib/pkgconfig/libdrm_nouveau.pc
151 %%X86-ON%%include/libdrm/
169 %%X86-ON%%lib/pkgconfig/
198 lib/pkgconfig/libdrm.pc
201 [FILE:425:patches/patch-amdgpu_amdgpu__cs.c]
202 $NetBSD: patch-amdgpu_amdgpu__cs.c,v 1.3 2022/03/13 15:20:01 tnn Exp $
204 libc-supplied compat alloca(3) should not be used
206 --- amdgpu/amdgpu_cs.c.orig 2023-08-23 09:57:39 UTC
207 +++ amdgpu/amdgpu_cs.c
211 #include <sys/ioctl.h>
213 -# include <alloca.h>
215 +#define alloca(size) __builtin_alloca(size)
218 #include "amdgpu_drm.h"
221 [FILE:834:patches/patch-amdgpu_amdgpu__device.c]
222 --- amdgpu/amdgpu_device.c.orig 2023-08-23 09:57:39 UTC
223 +++ amdgpu/amdgpu_device.c
224 @@ -177,7 +177,12 @@ drm_public int amdgpu_device_initialize(
227 if ((flag_auth) && (!flag_authexist)) {
228 +#ifdef F_DUPFD_CLOEXEC
229 dev->flink_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
231 + dev->flink_fd = fcntl(fd, F_DUPFD, 0);
232 + fcntl(dev->flink_fd, F_SETFD, FD_CLOEXEC);
235 *major_version = dev->major_version;
236 *minor_version = dev->minor_version;
237 @@ -211,7 +216,12 @@ drm_public int amdgpu_device_initialize(
241 +#ifdef F_DUPFD_CLOEXEC
242 dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
244 + dev->fd = fcntl(fd, F_DUPFD, 0);
245 + fcntl(dev->fd, F_SETFD, FD_CLOEXEC);
247 dev->flink_fd = dev->fd;
248 dev->major_version = version->version_major;
249 dev->minor_version = version->version_minor;
252 [FILE:283:patches/patch-include_drm_drm.h]
253 --- include/drm/drm.h.orig 2023-08-23 09:57:39 UTC
254 +++ include/drm/drm.h
255 @@ -837,7 +837,11 @@ struct drm_set_client_cap {
258 #define DRM_RDWR O_RDWR
260 +#define DRM_CLOEXEC 0
262 #define DRM_CLOEXEC O_CLOEXEC
264 struct drm_prime_handle {
269 [FILE:689:patches/patch-intel_intel__bufmgr__gem.c]
270 --- intel/intel_bufmgr_gem.c.orig 2023-08-23 09:57:39 UTC
271 +++ intel/intel_bufmgr_gem.c
272 @@ -966,6 +966,27 @@ drm_intel_gem_bo_alloc_userptr(drm_intel
277 +#define posix_memalign illumos_memalign
279 +posix_memalign(void **memptr, size_t alignment, size_t size)
284 + if (alignment == 0 ||
285 + (alignment & (sizeof (void *) - 1)) != 0 ||
286 + (alignment & (alignment - 1)) != 0)
288 + else if (size != 0 &&
289 + (ptr = memalign(alignment, size)) == NULL)
298 has_userptr(drm_intel_bufmgr_gem *bufmgr_gem)
302 [FILE:379:patches/patch-intel_test__decode.c]
303 --- intel/test_decode.c.orig 2023-08-23 09:57:39 UTC
304 +++ intel/test_decode.c
307 #include <sys/types.h>
308 #include <sys/stat.h>
310 +#define errx(exitcode, format, args...) \
311 + { fprintf(stderr, format "\n", ## args); \
317 #include "libdrm_macros.h"
318 #include "intel_bufmgr.h"
321 [FILE:521:patches/patch-libsync.h]
322 define ETIME as ETIMEOUT same as done in mesa
324 --- libsync.h.orig 2023-08-23 09:57:39 UTC
327 #include <sys/ioctl.h>
328 #include <sys/poll.h>
331 +#define ETIME ETIMEDOUT
334 #if defined(__cplusplus)
336 @@ -53,6 +56,9 @@ struct sync_merge_data {
341 +#include <sys/ioccom.h>
343 #define SYNC_IOC_MAGIC '>'
344 #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
348 [FILE:267:patches/patch-tests_drmdevice.c]
349 --- tests/drmdevice.c.orig 2023-08-23 09:57:39 UTC
350 +++ tests/drmdevice.c
360 print_device_info(drmDevicePtr device, int i, bool print_revision)
363 [FILE:333:patches/patch-tests_modetest_meson.build]
364 --- tests/modetest/meson.build.orig 2023-08-23 09:57:39 UTC
365 +++ tests/modetest/meson.build
366 @@ -25,5 +25,6 @@ modetest = executable(
367 include_directories : [inc_root, inc_tests, inc_drm],
368 dependencies : [dep_threads, dep_cairo],
369 link_with : [libdrm, libutil],
370 + link_args : ['-lpthread'],
371 install : with_install_tests,
375 [FILE:358:patches/patch-tests_nouveau_meson.build]
376 --- tests/nouveau/meson.build.orig 2023-08-23 09:57:39 UTC
377 +++ tests/nouveau/meson.build
378 @@ -24,6 +24,7 @@ threaded = executable(
379 dependencies : [dep_dl, dep_threads],
380 include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
381 link_with : [libdrm, libdrm_nouveau],
382 + link_args : ['-lpthread'],
383 c_args : libdrm_c_args,
388 [FILE:387:patches/patch-tests_nouveau_threaded.c]
389 --- tests/nouveau/threaded.c.orig 2023-08-23 09:57:39 UTC
390 +++ tests/nouveau/threaded.c
391 @@ -36,7 +36,7 @@ static int failed;
393 static int import_fd;
395 -#if defined(__GLIBC__) || defined(__FreeBSD__)
396 +#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
397 int ioctl(int fd, unsigned long request, ...)
399 int ioctl(int fd, int request, ...)
402 [FILE:7506:patches/patch-xf86drm.c]
403 --- xf86drm.c.orig 2023-08-23 09:57:39 UTC
407 #include <inttypes.h>
409 -#if defined(__FreeBSD__)
414 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
421 #include <sys/param.h>
422 #include <sys/pciio.h>
428 -#define DRM_MAJOR 34
429 +#define DRM_MAJOR 180
430 +#include <sys/param.h>
431 +#include <dev/pci/pcireg.h>
436 @@ -317,8 +330,10 @@ drmGetFormatModifierNameFromArm(uint64_t
437 char *modifier_name = NULL;
441 fp = open_memstream(&modifier_name, &size);
447 @@ -463,8 +478,10 @@ drmGetFormatModifierNameFromAmd(uint64_t
448 tile_version = AMD_FMT_MOD_GET(TILE_VERSION, modifier);
449 dcc = AMD_FMT_MOD_GET(DCC, modifier);
452 fp = open_memstream(&mod_amd, &size);
458 @@ -1033,7 +1050,7 @@ static int drmGetMinorBase(int type)
460 static int drmGetMinorType(int major, int minor)
464 char name[SPECNAMELEN];
467 @@ -3286,7 +3303,7 @@ drm_public int drmIsMaster(int fd)
469 drm_public char *drmGetDeviceNameFromFd(int fd)
476 @@ -3333,7 +3350,7 @@ static bool drmNodeIsDRM(int maj, int mi
477 snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
479 return stat(path, &sbuf) == 0;
480 -#elif defined(__FreeBSD__)
482 char name[SPECNAMELEN];
484 if (!devname_r(makedev(maj, min), S_IFCHR, name, sizeof(name)))
485 @@ -3456,7 +3473,7 @@ static char *drmGetMinorNameForFD(int fd
489 -#elif defined(__FreeBSD__)
492 char dname[SPECNAMELEN];
494 @@ -3641,6 +3658,65 @@ static int drmParseSubsystemType(int maj
495 return DRM_BUS_VIRTIO;
497 return subsystem_type;
498 +#elif defined(__NetBSD__)
502 + unsigned domain, bus, dev;
506 + /* Get the type of device we're looking for to pick the right pathname. */
507 + type = drmGetMinorType(maj, min);
511 + /* Open the device. Don't try to create it if it's not there. */
512 + fd = drmOpenMinor(min, 0, type);
517 + * Set the interface version to 1.4 or 1.1, which has the effect of
518 + * populating the bus id for us.
520 + sv.drm_di_major = 1;
521 + sv.drm_di_minor = 4;
522 + sv.drm_dd_major = -1;
523 + sv.drm_dd_minor = -1;
524 + if (drmSetInterfaceVersion(fd, &sv)) {
525 + sv.drm_di_major = 1;
526 + sv.drm_di_minor = 1;
527 + sv.drm_dd_major = -1;
528 + sv.drm_dd_minor = -1;
529 + if (drmSetInterfaceVersion(fd, &sv)) {
531 + * We're probably not the master. Hope the master already
532 + * set the version to >=1.1 so that we can get the busid.
537 + /* Get the bus id. */
538 + buf = drmGetBusid(fd);
540 + /* We're done with the device now. */
543 + /* If there is no bus id, fail. */
547 + /* Find a string we know about; otherwise -EINVAL. */
549 + if (strncmp(buf, "pci:", 4) == 0)
552 + /* We're done with the bus id. */
555 + /* Success or not, we're done. */
557 #elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
560 @@ -3667,7 +3743,7 @@ get_pci_path(int maj, int min, char *pci
566 static int get_sysctl_pci_bus_info(int maj, int min, drmPciBusInfoPtr info)
568 char dname[SPECNAMELEN];
569 @@ -3749,6 +3825,73 @@ static int drmParsePciBusInfo(int maj, i
573 +#elif defined(__NetBSD__)
577 + unsigned domain, bus, dev;
581 + /* Get the type of device we're looking for to pick the right pathname. */
582 + type = drmGetMinorType(maj, min);
586 + /* Open the device. Don't try to create it if it's not there. */
587 + fd = drmOpenMinor(min, 0, type);
592 + * Set the interface version to 1.4 or 1.1, which has the effect of
593 + * populating the bus id for us.
595 + sv.drm_di_major = 1;
596 + sv.drm_di_minor = 4;
597 + sv.drm_dd_major = -1;
598 + sv.drm_dd_minor = -1;
599 + if (drmSetInterfaceVersion(fd, &sv)) {
600 + sv.drm_di_major = 1;
601 + sv.drm_di_minor = 1;
602 + sv.drm_dd_major = -1;
603 + sv.drm_dd_minor = -1;
604 + if (drmSetInterfaceVersion(fd, &sv)) {
606 + * We're probably not the master. Hope the master already
607 + * set the version to >=1.1 so that we can get the busid.
612 + /* Get the bus id. */
613 + buf = drmGetBusid(fd);
615 + /* We're done with the device now. */
618 + /* If there is no bus id, fail. */
622 + /* Parse the bus id. */
623 + ret = sscanf(buf, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func);
625 + /* We're done with the bus id. */
628 + /* If scanf didn't return 4 -- domain, bus, dev, func -- then fail. */
632 + /* Populate the results. */
633 + info->domain = domain;
640 #elif defined(__OpenBSD__) || defined(__DragonFly__)
641 struct drm_pciinfo pinfo;
643 @@ -3917,6 +4060,48 @@ static int drmParsePciDeviceInfo(int maj
644 return parse_config_sysfs_file(maj, min, device);
647 +#elif defined(__NetBSD__)
648 + drmPciBusInfo businfo;
649 + char fname[PATH_MAX];
651 + pcireg_t id, class, subsys;
654 + /* Find where on the bus the device lives. */
655 + ret = drmParsePciBusInfo(maj, min, &businfo);
659 + /* Open the pciN device node to get at its config registers. */
660 + if (snprintf(fname, sizeof fname, "/dev/pci%u", businfo.domain)
663 + if ((pcifd = open(fname, O_RDONLY)) == -1)
667 + /* Read the id and class pci config registers. */
668 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
669 + PCI_ID_REG, &id) == -1)
671 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
672 + PCI_CLASS_REG, &class) == -1)
674 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
675 + PCI_SUBSYS_ID_REG, &subsys) == -1)
679 + device->vendor_id = PCI_VENDOR(id);
680 + device->device_id = PCI_PRODUCT(id);
681 + device->subvendor_id = PCI_SUBSYS_VENDOR(subsys);
682 + device->subdevice_id = PCI_SUBSYS_ID(subsys);
683 + device->revision_id = PCI_REVISION(class);
689 #elif defined(__OpenBSD__) || defined(__DragonFly__)
690 struct drm_pciinfo pinfo;
694 [FILE:397:patches/patch-xf86drm.h]
695 --- xf86drm.h.orig 2023-08-23 09:57:39 UTC
697 @@ -59,6 +59,9 @@ extern "C" {
698 #else /* One of the *BSDs */
700 #include <sys/ioccom.h>
702 +#define _IOC(inout,group,num,len) (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
704 #define DRM_IOCTL_NR(n) ((n) & 0xff)
705 #define DRM_IOC_VOID IOC_VOID
706 #define DRM_IOC_READ IOC_OUT
709 [FILE:635:patches/patch-xf86drmMode.c]
710 --- xf86drmMode.c.orig 2023-08-23 09:57:39 UTC
714 #include <sys/ioctl.h>
715 #if HAVE_SYS_SYSCTL_H
717 #include <sys/types.h>
719 #include <sys/sysctl.h>
722 @@ -1119,7 +1117,7 @@ drm_public int drmModePageFlipTarget(int
724 drm_public int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
725 uint32_t fb_id, uint32_t flags,
726 - int32_t crtc_x, int32_t crtc_y,
727 + uint32_t crtc_x, int32_t crtc_y,
728 uint32_t crtc_w, uint32_t crtc_h,
729 uint32_t src_x, uint32_t src_y,
730 uint32_t src_w, uint32_t src_h)
733 [FILE:505:patches/patch-xf86drmMode.h]
734 --- xf86drmMode.h.orig 2023-08-23 09:57:39 UTC
736 @@ -429,7 +429,7 @@ extern drmModePlaneResPtr drmModeGetPlan
737 extern drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id);
738 extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
739 uint32_t fb_id, uint32_t flags,
740 - int32_t crtc_x, int32_t crtc_y,
741 + uint32_t crtc_x, int32_t crtc_y,
742 uint32_t crtc_w, uint32_t crtc_h,
743 uint32_t src_x, uint32_t src_y,
744 uint32_t src_w, uint32_t src_h);