Ravenports generated: 22 Sep 2023 12:17
[ravenports.git] / bucket_CD / libdrm
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               libdrm
4 VERSION=                2.4.116
5 REVISION=               1
6 KEYWORDS=               graphics x11
7 VARIANTS=               standard
8 SDESC[standard]=        Direct Rendering Module services kernel interface
9 HOMEPAGE=               https://dri.freedesktop.org
10 CONTACT=                nobody
11
12 DOWNLOAD_GROUPS=        main
13 SITES[main]=            https://dri.freedesktop.org/libdrm/
14 DISTFILE[1]=            libdrm-2.4.116.tar.xz:main
15 DF_INDEX=               1
16 SPKGS[standard]=        complete
17                         primary
18                         man
19                         dev
20
21 OPTIONS_AVAILABLE=      ARM X86 NOUVEAU
22 OPTIONS_STANDARD=       ARM X86 NOUVEAU
23 OPT_ON[aarch64]=        ARM
24 OPT_ON[linux]=          NOUVEAU
25 OPT_ON[x86_64]=         X86
26 OPT_ON[i386]=           X86
27
28 BUILD_DEPENDS=          libxslt:primary:standard
29                         python-docutils:single:python_default
30
31 USES=                   gmake pkgconfig solaris-funcs meson
32 GNOME_COMPONENTS=       libxml2
33 XORG_COMPONENTS=        pciaccess
34
35 LICENSE=                MIT:primary
36 LICENSE_FILE=           MIT:{{WRKDIR}}/LICENSE_MIT
37 LICENSE_AWK=            MIT:"_XF86DRM_H_"
38 LICENSE_SOURCE=         MIT:{{WRKSRC}}/xf86drm.h
39 LICENSE_SCHEME=         solo
40
41 FPC_EQUIVALENT=         graphics/libdrm
42 MESON_ARGS=             -Dman-pages=enabled
43                         -Dinstall-test-programs=true
44                         -Dcairo-tests=disabled
45                         -Dradeon=enabled
46                         -Damdgpu=enabled
47 SOL_FUNCTIONS=          getline:amdgpu/amdgpu_asic_id.c
48                         asprintf:xf86drm.c
49                         asprintf:tests/modetest/modetest.c
50                         strndup:tests/modetest/modetest.c
51
52 INSTALL_TARGET=         install-strip
53 INSTALL_REQ_TOOLCHAIN=  yes
54
55 VAR_OPSYS[sunos]=       LDFLAGS=-lrt
56 VAR_OPSYS[netbsd]=      LDFLAGS=-lpci
57
58 [X86].DESCRIPTION=                      DRM Drivers for amd64 and i386 architectures
59 [X86].CONFIGURE_ARGS_OFF=               -Dintel=disabled
60                                         -Dvmwgfx=disabled
61 [X86].CONFIGURE_ARGS_ON=                -Dintel=enabled
62                                         -Dvmwgfx=enabled
63
64 [ARM].DESCRIPTION=                      DRM Drivers for AARCH64 architecture
65 [ARM].CONFIGURE_ARGS_OFF=               -Detnaviv=disabled
66                                         -Dexynos=disabled
67                                         -Dfreedreno=disabled
68                                         -Dfreedreno-kgsl=false
69                                         -Domap=disabled
70                                         -Dtegra=disabled
71                                         -Dvc4=disabled
72 [ARM].CONFIGURE_ARGS_ON=                -Detnaviv=enabled
73                                         -Dexynos=enabled
74                                         -Dfreedreno=enabled
75                                         -Domap=enabled
76                                         -Dtegra=enabled
77                                         -Dvc4=enabled
78
79 [NOUVEAU].DESCRIPTION=                  Build x86 Nouveau driver
80 [NOUVEAU].CONFIGURE_ARGS_OFF=           -Dnouveau=disabled
81 [NOUVEAU].CONFIGURE_ARGS_ON=            -Dnouveau=enabled
82
83 [FILE:70:descriptions/desc.primary]
84 Userspace interface to kernel DRM (Direct Rendering Module) services.
85
86
87 [FILE:100:distinfo]
88 46c53f40735ea3d26d614297f155f6131a510624a24274f654f6469ca905339a       473560 libdrm-2.4.116.tar.xz
89
90
91 [FILE:438:manifests/plist.primary]
92 %%ARM-ON%%lib/
93  libdrm_freedreno.so.1
94  libdrm_freedreno.so.1.0.0
95 %%X86-ON%%%%NOUVEAU-ON%%lib/
96  libdrm_nouveau.so.2
97  libdrm_nouveau.so.2.0.0
98 %%X86-ON%%bin/amdgpu_stress
99 %%X86-ON%%lib/
100  libdrm_amdgpu.so.1
101  libdrm_amdgpu.so.1.0.0
102  libdrm_intel.so.1
103  libdrm_intel.so.1.0.0
104  libdrm_radeon.so.1
105  libdrm_radeon.so.1.0.1
106 %%X86-ON%%share/libdrm/amdgpu.ids
107 bin/
108  drmdevice
109  modeprint
110  modetest
111  proptest
112  vbltest
113 lib/
114  libdrm.so.2
115  libdrm.so.2.4.0
116
117
118 [FILE:139:manifests/plist.man]
119 share/man/man3/
120  drmAvailable.3.gz
121  drmHandleEvent.3.gz
122  drmModeGetResources.3.gz
123 share/man/man7/
124  drm-kms.7.gz
125  drm-memory.7.gz
126  drm.7.gz
127
128
129 [FILE:1209:manifests/plist.dev]
130 %%ARM-ON%%include/freedreno/
131  freedreno_drmif.h
132  freedreno_ringbuffer.h
133 %%ARM-ON%%include/libdrm/
134  vc4_packet.h
135  vc4_qpu_defines.h
136 %%ARM-ON%%lib/libdrm_freedreno.so
137 %%ARM-ON%%lib/pkgconfig/
138  libdrm_freedreno.pc
139  libdrm_vc4.pc
140 %%X86-ON%%%%NOUVEAU-ON%%include/libdrm/nouveau/nouveau.h
141 %%X86-ON%%%%NOUVEAU-ON%%include/libdrm/nouveau/nvif/
142  cl0080.h
143  cl9097.h
144  class.h
145  if0002.h
146  if0003.h
147  ioctl.h
148  unpack.h
149 %%X86-ON%%%%NOUVEAU-ON%%lib/libdrm_nouveau.so
150 %%X86-ON%%%%NOUVEAU-ON%%lib/pkgconfig/libdrm_nouveau.pc
151 %%X86-ON%%include/libdrm/
152  amdgpu.h
153  amdgpu_drm.h
154  intel_aub.h
155  intel_bufmgr.h
156  intel_debug.h
157  r600_pci_ids.h
158  radeon_bo.h
159  radeon_bo_gem.h
160  radeon_bo_int.h
161  radeon_cs.h
162  radeon_cs_gem.h
163  radeon_cs_int.h
164  radeon_surface.h
165 %%X86-ON%%lib/
166  libdrm_amdgpu.so
167  libdrm_intel.so
168  libdrm_radeon.so
169 %%X86-ON%%lib/pkgconfig/
170  libdrm_amdgpu.pc
171  libdrm_intel.pc
172  libdrm_radeon.pc
173 include/
174  libsync.h
175  xf86drm.h
176  xf86drmMode.h
177 include/libdrm/
178  drm.h
179  drm_fourcc.h
180  drm_mode.h
181  drm_sarea.h
182  i915_drm.h
183  mach64_drm.h
184  mga_drm.h
185  msm_drm.h
186  nouveau_drm.h
187  qxl_drm.h
188  r128_drm.h
189  radeon_drm.h
190  savage_drm.h
191  sis_drm.h
192  tegra_drm.h
193  vc4_drm.h
194  via_drm.h
195  virtgpu_drm.h
196  vmwgfx_drm.h
197 lib/libdrm.so
198 lib/pkgconfig/libdrm.pc
199
200
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 $
203
204 libc-supplied compat alloca(3) should not be used
205
206 --- amdgpu/amdgpu_cs.c.orig     2023-08-23 09:57:39 UTC
207 +++ amdgpu/amdgpu_cs.c
208 @@ -28,9 +28,7 @@
209  #include <pthread.h>
210  #include <sched.h>
211  #include <sys/ioctl.h>
212 -#if HAVE_ALLOCA_H
213 -# include <alloca.h>
214 -#endif
215 +#define alloca(size) __builtin_alloca(size)
216  
217  #include "xf86drm.h"
218  #include "amdgpu_drm.h"
219
220
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(
225                         return r;
226                 }
227                 if ((flag_auth) && (!flag_authexist)) {
228 +#ifdef F_DUPFD_CLOEXEC
229                         dev->flink_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
230 +#else
231 +                       dev->flink_fd = fcntl(fd, F_DUPFD, 0);
232 +                       fcntl(dev->flink_fd, F_SETFD, FD_CLOEXEC);
233 +#endif
234                 }
235                 *major_version = dev->major_version;
236                 *minor_version = dev->minor_version;
237 @@ -211,7 +216,12 @@ drm_public int amdgpu_device_initialize(
238                 goto cleanup;
239         }
240  
241 +#ifdef F_DUPFD_CLOEXEC
242         dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
243 +#else
244 +       dev->fd = fcntl(fd, F_DUPFD, 0);
245 +       fcntl(dev->fd, F_SETFD, FD_CLOEXEC);
246 +#endif
247         dev->flink_fd = dev->fd;
248         dev->major_version = version->version_major;
249         dev->minor_version = version->version_minor;
250
251
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 {
256  };
257  
258  #define DRM_RDWR O_RDWR
259 +#ifdef __sun__
260 +#define DRM_CLOEXEC 0
261 +#else
262  #define DRM_CLOEXEC O_CLOEXEC
263 +#endif
264  struct drm_prime_handle {
265         __u32 handle;
266  
267
268
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
273         return &bo_gem->bo;
274  }
275  
276 +#ifdef __sun__
277 +#define posix_memalign illumos_memalign
278 +static int
279 +posix_memalign(void **memptr, size_t alignment, size_t size)
280 +{
281 +       void *ptr = NULL;
282 +       int error = 0;
283 +
284 +       if (alignment == 0 ||
285 +           (alignment & (sizeof (void *) - 1)) != 0 ||
286 +           (alignment & (alignment - 1)) != 0)
287 +               error = EINVAL;
288 +       else if (size != 0 &&
289 +           (ptr = memalign(alignment, size)) == NULL)
290 +               error = ENOMEM;
291 +
292 +       *memptr = ptr;
293 +       return (error);
294 +}
295 +#endif
296 +
297  static bool
298  has_userptr(drm_intel_bufmgr_gem *bufmgr_gem)
299  {
300
301
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
305 @@ -28,7 +28,13 @@
306  #include <fcntl.h>
307  #include <sys/types.h>
308  #include <sys/stat.h>
309 +#ifdef __sun__
310 +#define errx(exitcode, format, args...) \
311 +       { fprintf(stderr, format "\n", ## args); \
312 +         exit(exitcode); }
313 +#else
314  #include <err.h>
315 +#endif
316  
317  #include "libdrm_macros.h"
318  #include "intel_bufmgr.h"
319
320
321 [FILE:521:patches/patch-libsync.h]
322 define ETIME as ETIMEOUT same as done in mesa
323
324 --- libsync.h.orig      2023-08-23 09:57:39 UTC
325 +++ libsync.h
326 @@ -35,6 +35,9 @@
327  #include <sys/ioctl.h>
328  #include <sys/poll.h>
329  #include <unistd.h>
330 +#ifndef ETIME
331 +#define ETIME ETIMEDOUT
332 +#endif
333  
334  #if defined(__cplusplus)
335  extern "C" {
336 @@ -53,6 +56,9 @@ struct sync_merge_data {
337         uint32_t        flags;
338         uint32_t        pad;
339  };
340 +#ifdef __sun__
341 +#include <sys/ioccom.h>
342 +#endif
343  #define SYNC_IOC_MAGIC         '>'
344  #define SYNC_IOC_MERGE         _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
345  #endif
346
347
348 [FILE:267:patches/patch-tests_drmdevice.c]
349 --- tests/drmdevice.c.orig      2023-08-23 09:57:39 UTC
350 +++ tests/drmdevice.c
351 @@ -31,6 +31,9 @@
352  #include <unistd.h>
353  #include <xf86drm.h>
354  
355 +#ifndef O_CLOEXEC
356 +#define O_CLOEXEC 0
357 +#endif
358  
359  static void
360  print_device_info(drmDevicePtr device, int i, bool print_revision)
361
362
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,
372  )
373
374
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,
384  )
385  
386
387
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;
392  
393  static int import_fd;
394  
395 -#if defined(__GLIBC__) || defined(__FreeBSD__)
396 +#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
397  int ioctl(int fd, unsigned long request, ...)
398  #else
399  int ioctl(int fd, int request, ...)
400
401
402 [FILE:7506:patches/patch-xf86drm.c]
403 --- xf86drm.c.orig      2023-08-23 09:57:39 UTC
404 +++ xf86drm.c
405 @@ -63,7 +63,17 @@
406  #include <math.h>
407  #include <inttypes.h>
408  
409 -#if defined(__FreeBSD__)
410 +#ifndef O_CLOEXEC
411 +#define O_CLOEXEC 0
412 +#endif
413 +
414 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
415 +#define FREEDFLY 1
416 +#else
417 +#define FREEDFLY 0
418 +#endif
419 +
420 +#if FREEDFLY
421  #include <sys/param.h>
422  #include <sys/pciio.h>
423  #endif
424 @@ -86,7 +96,10 @@
425  #endif
426  
427  #ifdef __NetBSD__
428 -#define DRM_MAJOR 34
429 +#define DRM_MAJOR 180
430 +#include <sys/param.h>
431 +#include <dev/pci/pcireg.h>
432 +#include <pci.h>
433  #endif
434  
435  #ifdef __OpenBSD__
436 @@ -317,8 +330,10 @@ drmGetFormatModifierNameFromArm(uint64_t
437      char *modifier_name = NULL;
438      bool result = false;
439  
440 +#ifndef __sun
441      fp = open_memstream(&modifier_name, &size);
442      if (!fp)
443 +#endif
444          return NULL;
445  
446      switch (type) {
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);
450  
451 +#ifndef __sun
452      fp = open_memstream(&mod_amd, &size);
453      if (!fp)
454 +#endif
455          return NULL;
456  
457      /* add tile  */
458 @@ -1033,7 +1050,7 @@ static int drmGetMinorBase(int type)
459  
460  static int drmGetMinorType(int major, int minor)
461  {
462 -#ifdef __FreeBSD__
463 +#if FREEDFLY
464      char name[SPECNAMELEN];
465      int id;
466  
467 @@ -3286,7 +3303,7 @@ drm_public int drmIsMaster(int fd)
468  
469  drm_public char *drmGetDeviceNameFromFd(int fd)
470  {
471 -#ifdef __FreeBSD__
472 +#if FREEDFLY
473      struct stat sbuf;
474      int maj, min;
475      int nodetype;
476 @@ -3333,7 +3350,7 @@ static bool drmNodeIsDRM(int maj, int mi
477      snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
478               maj, min);
479      return stat(path, &sbuf) == 0;
480 -#elif defined(__FreeBSD__)
481 +#elif FREEDFLY
482      char name[SPECNAMELEN];
483  
484      if (!devname_r(makedev(maj, min), S_IFCHR, name, sizeof(name)))
485 @@ -3456,7 +3473,7 @@ static char *drmGetMinorNameForFD(int fd
486  
487      closedir(sysdir);
488      return NULL;
489 -#elif defined(__FreeBSD__)
490 +#elif FREEDFLY
491      struct stat sbuf;
492      char dname[SPECNAMELEN];
493      const char *mname;
494 @@ -3641,6 +3658,65 @@ static int drmParseSubsystemType(int maj
495              return DRM_BUS_VIRTIO;
496       }
497      return subsystem_type;
498 +#elif defined(__NetBSD__)
499 +    int type, fd;
500 +    drmSetVersion sv;
501 +    char *buf;
502 +    unsigned domain, bus, dev;
503 +    int func;
504 +    int ret;
505 +
506 +    /* Get the type of device we're looking for to pick the right pathname.  */
507 +    type = drmGetMinorType(maj, min);
508 +    if (type == -1)
509 +       return -ENODEV;
510 +
511 +    /* Open the device.  Don't try to create it if it's not there.  */
512 +    fd = drmOpenMinor(min, 0, type);
513 +    if (fd < 0)
514 +       return -errno;
515 +
516 +    /*
517 +     * Set the interface version to 1.4 or 1.1, which has the effect of
518 +     * populating the bus id for us.
519 +     */
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)) {
530 +           /*
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.
533 +            */
534 +       }
535 +     }
536 +
537 +    /* Get the bus id.  */
538 +    buf = drmGetBusid(fd);
539 +
540 +    /* We're done with the device now.  */
541 +    (void)close(fd);
542 +
543 +    /* If there is no bus id, fail.  */
544 +    if (buf == NULL)
545 +       return -ENODEV;
546 +
547 +    /* Find a string we know about; otherwise -EINVAL.  */
548 +    ret = -EINVAL;
549 +    if (strncmp(buf, "pci:", 4) == 0)
550 +       ret = DRM_BUS_PCI;
551 +
552 +    /* We're done with the bus id.  */
553 +    free(buf);
554 +
555 +    /* Success or not, we're done.  */
556 +    return ret;
557  #elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
558      return DRM_BUS_PCI;
559  #else
560 @@ -3667,7 +3743,7 @@ get_pci_path(int maj, int min, char *pci
561  }
562  #endif
563  
564 -#ifdef __FreeBSD__
565 +#if FREEDFLY
566  static int get_sysctl_pci_bus_info(int maj, int min, drmPciBusInfoPtr info)
567  {
568      char dname[SPECNAMELEN];
569 @@ -3749,6 +3825,73 @@ static int drmParsePciBusInfo(int maj, i
570      info->func = func;
571  
572      return 0;
573 +#elif defined(__NetBSD__)
574 +    int type, fd;
575 +    drmSetVersion sv;
576 +    char *buf;
577 +    unsigned domain, bus, dev;
578 +    int func;
579 +    int ret;
580 +
581 +    /* Get the type of device we're looking for to pick the right pathname.  */
582 +    type = drmGetMinorType(maj, min);
583 +    if (type == -1)
584 +       return -ENODEV;
585 +
586 +    /* Open the device.  Don't try to create it if it's not there.  */
587 +    fd = drmOpenMinor(min, 0, type);
588 +    if (fd < 0)
589 +       return -errno;
590 +
591 +    /*
592 +     * Set the interface version to 1.4 or 1.1, which has the effect of
593 +     * populating the bus id for us.
594 +     */
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)) {
605 +            /*
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.
608 +            */
609 +       }
610 +    }
611 +
612 +    /* Get the bus id.  */
613 +    buf = drmGetBusid(fd);
614 +
615 +    /* We're done with the device now.  */
616 +    (void)close(fd);
617 +
618 +    /* If there is no bus id, fail.  */
619 +    if (buf == NULL)
620 +       return -ENODEV;
621 +
622 +    /* Parse the bus id.  */
623 +    ret = sscanf(buf, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func);
624 +
625 +    /* We're done with the bus id.  */
626 +    free(buf);
627 +
628 +    /* If scanf didn't return 4 -- domain, bus, dev, func -- then fail.  */
629 +    if (ret != 4)
630 +       return -ENODEV;
631 +
632 +    /* Populate the results.  */
633 +    info->domain = domain;
634 +    info->bus = bus;
635 +    info->dev = dev;
636 +    info->func = func;
637 +
638 +    /* Success!  */
639 +    return 0;
640  #elif defined(__OpenBSD__) || defined(__DragonFly__)
641      struct drm_pciinfo pinfo;
642      int fd, type;
643 @@ -3917,6 +4060,48 @@ static int drmParsePciDeviceInfo(int maj
644          return parse_config_sysfs_file(maj, min, device);
645  
646      return 0;
647 +#elif defined(__NetBSD__)
648 +    drmPciBusInfo businfo;
649 +    char fname[PATH_MAX];
650 +    int pcifd;
651 +    pcireg_t id, class, subsys;
652 +    int ret;
653 +
654 +    /* Find where on the bus the device lives.  */
655 +    ret = drmParsePciBusInfo(maj, min, &businfo);
656 +    if (ret)
657 +       return ret;
658 +
659 +    /* Open the pciN device node to get at its config registers.  */
660 +    if (snprintf(fname, sizeof fname, "/dev/pci%u", businfo.domain)
661 +       >= sizeof fname)
662 +       return -ENODEV;
663 +    if ((pcifd = open(fname, O_RDONLY)) == -1)
664 +       return -errno;
665 +
666 +    ret = -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)
670 +       goto out;
671 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
672 +           PCI_CLASS_REG, &class) == -1)
673 +       goto out;
674 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
675 +           PCI_SUBSYS_ID_REG, &subsys) == -1)
676 +       goto out;
677 +
678 +    ret = 0;
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);
684 +out:
685 +    if (ret == -1)
686 +       ret = -errno;
687 +    close(pcifd);
688 +    return ret;
689  #elif defined(__OpenBSD__) || defined(__DragonFly__)
690      struct drm_pciinfo pinfo;
691      int fd, type;
692
693
694 [FILE:397:patches/patch-xf86drm.h]
695 --- xf86drm.h.orig      2023-08-23 09:57:39 UTC
696 +++ xf86drm.h
697 @@ -59,6 +59,9 @@ extern "C" {
698  #else /* One of the *BSDs */
699  
700  #include <sys/ioccom.h>
701 +#ifdef __sun__
702 +#define _IOC(inout,group,num,len)      (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
703 +#endif
704  #define DRM_IOCTL_NR(n)         ((n) & 0xff)
705  #define DRM_IOC_VOID            IOC_VOID
706  #define DRM_IOC_READ            IOC_OUT
707
708
709 [FILE:635:patches/patch-xf86drmMode.c]
710 --- xf86drmMode.c.orig  2023-08-23 09:57:39 UTC
711 +++ xf86drmMode.c
712 @@ -39,9 +39,7 @@
713  #include <stdlib.h>
714  #include <sys/ioctl.h>
715  #if HAVE_SYS_SYSCTL_H
716 -#ifdef __FreeBSD__
717  #include <sys/types.h>
718 -#endif
719  #include <sys/sysctl.h>
720  #endif
721  #include <stdio.h>
722 @@ -1119,7 +1117,7 @@ drm_public int drmModePageFlipTarget(int
723  
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)
731
732
733 [FILE:505:patches/patch-xf86drmMode.h]
734 --- xf86drmMode.h.orig  2023-08-23 09:57:39 UTC
735 +++ xf86drmMode.h
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);
745