pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/x11/libdrm



Module Name:    pkgsrc
Committed By:   tnn
Date:           Sat Jan 19 13:21:29 UTC 2019

Modified Files:
        pkgsrc/x11/libdrm: Makefile distinfo
        pkgsrc/x11/libdrm/patches: patch-xf86drmMode.c
Removed Files:
        pkgsrc/x11/libdrm/patches: patch-radeon_radeon__bo__gem.c
            patch-radeon_radeon__cs__gem.c

Log Message:
libbdrm: sync patch-xf86drmMode.c with NetBS xsrc and FreeBSD ports

Also reduce diff to upstream. Doubt we need to worry about compilers
that don't understand C99-style struct initializers here.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 pkgsrc/x11/libdrm/Makefile
cvs rdiff -u -r1.90 -r1.91 pkgsrc/x11/libdrm/distinfo
cvs rdiff -u -r1.2 -r0 \
    pkgsrc/x11/libdrm/patches/patch-radeon_radeon__bo__gem.c
cvs rdiff -u -r1.1 -r0 \
    pkgsrc/x11/libdrm/patches/patch-radeon_radeon__cs__gem.c
cvs rdiff -u -r1.4 -r1.5 pkgsrc/x11/libdrm/patches/patch-xf86drmMode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/x11/libdrm/Makefile
diff -u pkgsrc/x11/libdrm/Makefile:1.89 pkgsrc/x11/libdrm/Makefile:1.90
--- pkgsrc/x11/libdrm/Makefile:1.89     Fri Jan 18 23:09:55 2019
+++ pkgsrc/x11/libdrm/Makefile  Sat Jan 19 13:21:29 2019
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.89 2019/01/18 23:09:55 tnn Exp $
+# $NetBSD: Makefile,v 1.90 2019/01/19 13:21:29 tnn Exp $
 
 DISTNAME=              libdrm-2.4.96
-PKGREVISION=           2
+PKGREVISION=           3
 CATEGORIES=            x11 graphics
 MASTER_SITES=          http://dri.freedesktop.org/libdrm/
 EXTRACT_SUFX=          .tar.bz2

Index: pkgsrc/x11/libdrm/distinfo
diff -u pkgsrc/x11/libdrm/distinfo:1.90 pkgsrc/x11/libdrm/distinfo:1.91
--- pkgsrc/x11/libdrm/distinfo:1.90     Fri Jan 18 23:09:55 2019
+++ pkgsrc/x11/libdrm/distinfo  Sat Jan 19 13:21:29 2019
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.90 2019/01/18 23:09:55 tnn Exp $
+$NetBSD: distinfo,v 1.91 2019/01/19 13:21:29 tnn Exp $
 
 SHA1 (libdrm-2.4.96.tar.bz2) = 51eb4c248a437b3f200bd1cd84461d3e0b60d71e
 RMD160 (libdrm-2.4.96.tar.bz2) = 8e13f0edf61bb0b59aaaf3cdbaadf20916782fe8
@@ -8,8 +8,6 @@ SHA1 (patch-ac) = 67c998df7dfc0dabc86320
 SHA1 (patch-include_drm_drm.h) = 48a912f40bf2b2a1c23edbe4446fa7869212f17b
 SHA1 (patch-libkms_vmwgfx.c) = d2204c0b79098c6c36b7f282b486c58c6354bd1d
 SHA1 (patch-libsync.h) = 51623bae547e7a0c3e41fa282964b2361b1c34ab
-SHA1 (patch-radeon_radeon__bo__gem.c) = f21a669218cefb7ce9e230fd0e53548cbf16c94f
-SHA1 (patch-radeon_radeon__cs__gem.c) = 516b5dd6408c10a4f33f2815b3719e34a16d863a
 SHA1 (patch-xf86drm.c) = ae371519320eb513f38d6856ad617dff5d05278b
-SHA1 (patch-xf86drmMode.c) = 7a0d8ea4a0110b295d8cb4fe870ee523d420ea6b
+SHA1 (patch-xf86drmMode.c) = 5f66d45a63b0915f22d0abe115aace13c53823a8
 SHA1 (patch-xf86drmMode.h) = a28b02887389be8670193c119f711901af61a6b2

Index: pkgsrc/x11/libdrm/patches/patch-xf86drmMode.c
diff -u pkgsrc/x11/libdrm/patches/patch-xf86drmMode.c:1.4 pkgsrc/x11/libdrm/patches/patch-xf86drmMode.c:1.5
--- pkgsrc/x11/libdrm/patches/patch-xf86drmMode.c:1.4   Fri Oct  5 12:57:20 2018
+++ pkgsrc/x11/libdrm/patches/patch-xf86drmMode.c       Sat Jan 19 13:21:29 2019
@@ -1,37 +1,59 @@
-$NetBSD: patch-xf86drmMode.c,v 1.4 2018/10/05 12:57:20 wiz Exp $
+$NetBSD: patch-xf86drmMode.c,v 1.5 2019/01/19 13:21:29 tnn Exp $
 
-Disable checking for hw.dri.%d.modesetting.
-This sysctl is only available if a KMS module is loaded. But the libdrm
-check happens before X got a chance of loading the KMS module.
+FreeBSD/DragonFly/NetBSD support. From FreeBSD ports and NetBSD xsrc
 
---- xf86drmMode.c.orig 2018-10-04 14:50:03.000000000 +0000
+--- xf86drmMode.c.orig 2018-10-16 14:49:03.000000000 +0000
 +++ xf86drmMode.c
-@@ -800,38 +800,20 @@ drm_public int drmCheckModesettingSuppor
+@@ -43,6 +43,7 @@
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+ #ifdef HAVE_SYS_SYSCTL_H
++#include <sys/types.h>
+ #include <sys/sysctl.h>
+ #endif
+ #include <stdio.h>
+@@ -799,42 +800,60 @@ drm_public int drmCheckModesettingSuppor
+       closedir(sysdir);
        if (found)
                return 0;
- #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
+-#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
 -      char kbusid[1024], sbusid[1024];
 -      char oid[128];
 -      int domain, bus, dev, func;
 -      int i, modesetting, ret;
 -      size_t len;
--
++#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__DragonFly__)
++      #define bus_fmt "pci:%04x:%02x:%02x.%u"
++      #define name_fmt "%*s %*s " bus_fmt
++      unsigned int d1 = 0, b1 = 0, s1 = 0, f1 = 0;
++      if (sscanf(busid, bus_fmt, &d1, &b1, &s1, &f1) != 4)
++                return -EINVAL;
++      /*
++       * hw.dri.%i.bus is not always present and hw.dri.%i.name does not
++       * always contain the busid, so try both for best chance of success
++       */
++      for (int i = 0; i < DRM_MAX_MINOR; ++i) {
++              char name[22], value[256];
++              size_t length = sizeof(value);
++              snprintf(name, sizeof(name), "hw.dri.%i.name", i);
++              if (sysctlbyname(name, value, &length, NULL, 0))
++                      continue;
+ 
 -      ret = sscanf(busid, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev,
 -          &func);
 -      if (ret != 4)
-+      return 0;
-+#elif defined(__NetBSD__)
-+      int fd;
-+      static const struct drm_mode_card_res zero_res;
-+      struct drm_mode_card_res res = zero_res;
-+      int ret;
-+ 
-+      fd = drmOpen(NULL, busid);
-+      if (fd == -1)
-               return -EINVAL;
+-              return -EINVAL;
 -      snprintf(kbusid, sizeof(kbusid), "pci:%04x:%02x:%02x.%d", domain, bus,
 -          dev, func);
--
++              value[length] = '\0';
++              unsigned int d2 = 0, b2 = 0, s2 = 0, f2 = 0;
++              switch (sscanf(value, name_fmt, &d2, &b2, &s2, &f2)) {
++              case 0: /* busid not in the name, try busid */
++                      length = sizeof(value);
++                      snprintf(name, sizeof(name), "hw.dri.%i.busid", i);
++                      if (sysctlbyname(name, value, &length, NULL, 0))
++                              continue;
+ 
 -      /* How many GPUs do we expect in the machine ? */
 -      for (i = 0; i < 16; i++) {
 -              snprintf(oid, sizeof(oid), "hw.dri.%d.busid", i);
@@ -39,9 +61,33 @@ check happens before X got a chance of l
 -              ret = sysctlbyname(oid, sbusid, &len, NULL, 0);
 -              if (ret == -1) {
 -                      if (errno == ENOENT)
--                              continue;
++                      value[length] = '\0';
++                      if (sscanf(value, bus_fmt, &d2, &b2, &s2, &f2) != 4)
+                               continue;
 -                      return -EINVAL;
--              }
++                      /* fall through after parsing busid */
++
++              case 4: /* if we jumped here then busid was in the name */ 
++                      if (d1 == d2 && b1 == b2 && s1 == s2 && f1 == f2) {
++                      /*
++                       * Confirm the drm driver for this device supports KMS,
++                       * except on DragonFly where all the drm drivers do so
++                       * but only hw.dri.0.modesetting is present
++                       */ 
++                      #ifndef __DragonFly__
++                              int modesetting = 0;
++                              length = sizeof(modesetting);
++                              snprintf(name, sizeof(name), "hw.dri.%i.modesetting", i);
++                              if (sysctlbyname(name, &modesetting, &length, NULL, 0)
++                               || length != sizeof(modesetting) || !modesetting)
++                                      return -ENOSYS;
++                              else
++                      #endif
++                                      return 0;
++                      }
++              default:
++                      break;
+               }
 -              if (strcmp(sbusid, kbusid) != 0)
 -                      continue;
 -              snprintf(oid, sizeof(oid), "hw.dri.%d.modesetting", i);
@@ -50,15 +96,15 @@ check happens before X got a chance of l
 -              if (ret == -1 || len != sizeof(modesetting))
 -                      return -EINVAL;
 -              return (modesetting ? 0 : -ENOSYS);
--      }
-+      ret = drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res);
-+      drmClose(fd);
-+      if (ret == 0)
-+              return 0;
- #elif defined(__DragonFly__)
-       return 0;
- #elif defined(__OpenBSD__)
-@@ -987,7 +969,7 @@ drm_public int drmModePageFlipTarget(int
+       }
+-#elif defined(__DragonFly__)
+-      return 0;
+-#elif defined(__OpenBSD__)
++#elif defined(__OpenBSD__) || defined(__NetBSD__)
+       int     fd;
+       struct drm_mode_card_res res;
+       drmModeResPtr r = 0;
+@@ -987,7 +1006,7 @@ drm_public int drmModePageFlipTarget(int
  
  drm_public int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
                    uint32_t fb_id, uint32_t flags,



Home | Main Index | Thread Index | Old Index