pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/x11/libdrm libbdrm: sync patch-xf86drmMode.c with NetB...
details: https://anonhg.NetBSD.org/pkgsrc/rev/f10aa9a6e5b1
branches: trunk
changeset: 318084:f10aa9a6e5b1
user: tnn <tnn%pkgsrc.org@localhost>
date: Sat Jan 19 13:21:29 2019 +0000
description:
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.
diffstat:
x11/libdrm/Makefile | 4 +-
x11/libdrm/distinfo | 6 +-
x11/libdrm/patches/patch-radeon_radeon__bo__gem.c | 16 ---
x11/libdrm/patches/patch-radeon_radeon__cs__gem.c | 16 ---
x11/libdrm/patches/patch-xf86drmMode.c | 108 +++++++++++++++------
5 files changed, 81 insertions(+), 69 deletions(-)
diffs (216 lines):
diff -r 26d566240a8f -r f10aa9a6e5b1 x11/libdrm/Makefile
--- a/x11/libdrm/Makefile Sat Jan 19 12:49:32 2019 +0000
+++ b/x11/libdrm/Makefile Sat Jan 19 13:21:29 2019 +0000
@@ -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
diff -r 26d566240a8f -r f10aa9a6e5b1 x11/libdrm/distinfo
--- a/x11/libdrm/distinfo Sat Jan 19 12:49:32 2019 +0000
+++ b/x11/libdrm/distinfo Sat Jan 19 13:21:29 2019 +0000
@@ -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-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
diff -r 26d566240a8f -r f10aa9a6e5b1 x11/libdrm/patches/patch-radeon_radeon__bo__gem.c
--- a/x11/libdrm/patches/patch-radeon_radeon__bo__gem.c Sat Jan 19 12:49:32 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-$NetBSD: patch-radeon_radeon__bo__gem.c,v 1.2 2019/01/18 23:09:55 tnn Exp $
-
---- radeon/radeon_bo_gem.c.orig 2014-09-28 16:19:54.000000000 +0000
-+++ radeon/radeon_bo_gem.c
-@@ -252,9 +252,10 @@ static int bo_set_tiling(struct radeon_b
- static int bo_get_tiling(struct radeon_bo_int *boi, uint32_t *tiling_flags,
- uint32_t *pitch)
- {
-- struct drm_radeon_gem_set_tiling args = {};
-+ struct drm_radeon_gem_set_tiling args;
- int r;
-
-+ memset(&args, 0, sizeof args);
- args.handle = boi->handle;
-
- r = drmCommandWriteRead(boi->bom->fd,
diff -r 26d566240a8f -r f10aa9a6e5b1 x11/libdrm/patches/patch-radeon_radeon__cs__gem.c
--- a/x11/libdrm/patches/patch-radeon_radeon__cs__gem.c Sat Jan 19 12:49:32 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-$NetBSD: patch-radeon_radeon__cs__gem.c,v 1.1 2014/10/26 10:20:10 wiz Exp $
-
---- radeon/radeon_cs_gem.c.orig 2014-09-28 16:19:54.000000000 +0000
-+++ radeon/radeon_cs_gem.c
-@@ -525,9 +525,10 @@ static struct radeon_cs_funcs radeon_cs_
-
- static int radeon_get_device_id(int fd, uint32_t *device_id)
- {
-- struct drm_radeon_info info = {};
-+ struct drm_radeon_info info;
- int r;
-
-+ memset(&info, 0, sizeof info);
- *device_id = 0;
- info.request = RADEON_INFO_DEVICE_ID;
- info.value = (uintptr_t)device_id;
diff -r 26d566240a8f -r f10aa9a6e5b1 x11/libdrm/patches/patch-xf86drmMode.c
--- a/x11/libdrm/patches/patch-xf86drmMode.c Sat Jan 19 12:49:32 2019 +0000
+++ b/x11/libdrm/patches/patch-xf86drmMode.c Sat Jan 19 13:21:29 2019 +0000
@@ -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 $
+
+FreeBSD/DragonFly/NetBSD support. From FreeBSD ports and NetBSD xsrc
-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.
-
---- 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 @@
- 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 @@
- 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