Index: graphics/libdrm/Makefile =================================================================== --- graphics/libdrm/Makefile +++ graphics/libdrm/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= libdrm -PORTVERSION= 2.4.99 +PORTVERSION= 2.4.100 PORTEPOCH= 1 CATEGORIES= graphics x11 MASTER_SITES= https://dri.freedesktop.org/libdrm/ Index: graphics/libdrm/distinfo =================================================================== --- graphics/libdrm/distinfo +++ graphics/libdrm/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1562265364 -SHA256 (libdrm-2.4.99.tar.bz2) = 4dbf539c7ed25dbb2055090b77ab87508fc46be39a9379d15fed4b5517e1da5e -SIZE (libdrm-2.4.99.tar.bz2) = 853659 +TIMESTAMP = 1578786811 +SHA256 (libdrm-2.4.100.tar.bz2) = c77cc828186c9ceec3e56ae202b43ee99eb932b4a87255038a80e8a1060d0a5d +SIZE (libdrm-2.4.100.tar.bz2) = 855793 Index: graphics/libdrm/files/patch-meson.build =================================================================== --- graphics/libdrm/files/patch-meson.build +++ graphics/libdrm/files/patch-meson.build @@ -1,23 +0,0 @@ -- sys/sysctl.h isn't self-sufficient -- tests don't use Bash features - ---- meson.build.orig 2019-04-19 15:52:29 UTC -+++ meson.build -@@ -181,7 +181,7 @@ endif - dep_m = cc.find_library('m', required : false) - foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] - config.set('HAVE_' + header.underscorify().to_upper(), -- cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))) -+ cc.compiles('#include \n#include <@0@>'.format(header), name : '@0@ works'.format(header))) - endforeach - if cc.has_header_symbol('sys/sysmacros.h', 'major') - config.set10('MAJOR_IN_SYSMACROS', true) -@@ -249,7 +249,7 @@ endif - with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found() - - # Used for tets --prog_bash = find_program('bash') -+prog_bash = find_program('sh') - - config.set10('HAVE_VISIBILITY', - cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''', Index: graphics/libdrm/files/patch-xf86drm.h =================================================================== --- graphics/libdrm/files/patch-xf86drm.h +++ graphics/libdrm/files/patch-xf86drm.h @@ -1,36 +0,0 @@ ---- xf86drm.h.orig 2018-03-05 21:06:45 UTC -+++ xf86drm.h -@@ -78,16 +78,26 @@ extern "C" { - - #ifdef __OpenBSD__ - #define DRM_DIR_NAME "/dev" --#define DRM_DEV_NAME "%s/drm%d" --#define DRM_CONTROL_DEV_NAME "%s/drmC%d" --#define DRM_RENDER_DEV_NAME "%s/drmR%d" -+#define DRM_PRIMARY_MINOR_NAME "drm" -+#define DRM_CONTROL_MINOR_NAME "drmC" -+#define DRM_RENDER_MINOR_NAME "drmR" - #else - #define DRM_DIR_NAME "/dev/dri" --#define DRM_DEV_NAME "%s/card%d" --#define DRM_CONTROL_DEV_NAME "%s/controlD%d" --#define DRM_RENDER_DEV_NAME "%s/renderD%d" --#define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ -+#define DRM_PRIMARY_MINOR_NAME "card" -+#define DRM_CONTROL_MINOR_NAME "controlD" -+#define DRM_RENDER_MINOR_NAME "renderD" - #endif -+ -+#define DRM_DEV_NAME "%s/" DRM_PRIMARY_MINOR_NAME "%d" -+#define DRM_CONTROL_DEV_NAME "%s/" DRM_CONTROL_MINOR_NAME "%d" -+#define DRM_RENDER_DEV_NAME "%s/" DRM_RENDER_MINOR_NAME "%d" -+ -+#define DRM_NODE_NAME_MAX \ -+ (sizeof(DRM_DIR_NAME) + \ -+ MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), \ -+ sizeof(DRM_CONTROL_MINOR_NAME), \ -+ sizeof(DRM_RENDER_MINOR_NAME)) \ -+ + 3) /* length of the node number */ - - #define DRM_ERR_NO_DEVICE (-1001) - #define DRM_ERR_NO_ACCESS (-1002) Index: graphics/libdrm/files/patch-xf86drm.c =================================================================== --- graphics/libdrm/files/patch-xf86drm.c +++ graphics/libdrm/files/patch-xf86drm.c @@ -21,30 +21,20 @@ /* Not all systems have MAP_FAILED defined */ #ifndef MAP_FAILED #define MAP_FAILED ((void *)-1) -@@ -69,18 +76,8 @@ +@@ -69,8 +76,8 @@ #include "util_math.h" --#ifdef __OpenBSD__ --#define DRM_PRIMARY_MINOR_NAME "drm" --#define DRM_CONTROL_MINOR_NAME "drmC" --#define DRM_RENDER_MINOR_NAME "drmR" --#else --#define DRM_PRIMARY_MINOR_NAME "card" --#define DRM_CONTROL_MINOR_NAME "controlD" --#define DRM_RENDER_MINOR_NAME "renderD" --#endif -- #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#define DRM_MAJOR 145 +#define DRM_MAJOR 0 /* Major ID unused on systems with devfs */ #endif #ifdef __NetBSD__ -@@ -222,6 +219,89 @@ drm_public drmHashEntry *drmGetEntry(int fd) +@@ -222,6 +229,75 @@ drm_public drmHashEntry *drmGetEntry(int fd) return entry; } - + +static int drmGetMinorBase(int type) +{ + switch (type) { @@ -89,20 +79,6 @@ +} +#endif + -+static const char *drmGetDeviceName(int type) -+{ -+ switch (type) { -+ case DRM_NODE_PRIMARY: -+ return DRM_DEV_NAME; -+ case DRM_NODE_CONTROL: -+ return DRM_CONTROL_DEV_NAME; -+ case DRM_NODE_RENDER: -+ return DRM_RENDER_DEV_NAME; -+ default: -+ return NULL; -+ } -+} -+ +static int drmGetNodeNumber(const char *name) +{ + size_t name_len = strnlen(name, DRM_NODE_NAME_MAX); @@ -131,35 +107,12 @@ /** * Compare two busid strings * -@@ -326,8 +406,8 @@ static int chown_check_return(const char *path, uid_t - static int drmOpenDevice(dev_t dev, int minor, int type) - { - stat_t st; -- const char *dev_name; -- char buf[64]; -+ const char *dev_name = drmGetDeviceName(type); -+ char buf[DRM_NODE_NAME_MAX]; - int fd; - mode_t devmode = DRM_DEV_MODE, serv_mode; - gid_t serv_group; -@@ -335,21 +415,14 @@ static int drmOpenDevice(dev_t dev, int minor, int typ +@@ -340,10 +416,14 @@ gid_t group = DRM_DEV_GID; #endif -- switch (type) { -- case DRM_NODE_PRIMARY: -- dev_name = DRM_DEV_NAME; -- break; -- case DRM_NODE_CONTROL: -- dev_name = DRM_CONTROL_DEV_NAME; -- break; -- case DRM_NODE_RENDER: -- dev_name = DRM_RENDER_DEV_NAME; -- break; -- default: -+ if (!dev_name) + if (!dev_name) return -EINVAL; -- }; +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + sprintf(buf, dev_name, DRM_DIR_NAME, minor + drmGetMinorBase(type)); @@ -169,32 +122,18 @@ drmMsg("drmOpenDevice: node name is %s\n", buf); if (drm_server_info && drm_server_info->get_perms) { -@@ -453,27 +526,20 @@ wait_for_udev: +@@ -453,16 +533,20 @@ wait_for_udev: static int drmOpenMinor(int minor, int create, int type) { int fd; -- char buf[64]; -- const char *dev_name; -+ char buf[DRM_NODE_NAME_MAX]; -+ const char *dev_name = drmGetDeviceName(type); + char buf[DRM_NODE_NAME_MAX]; + const char *dev_name = drmGetDeviceName(type); if (create) return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type); -- switch (type) { -- case DRM_NODE_PRIMARY: -- dev_name = DRM_DEV_NAME; -- break; -- case DRM_NODE_CONTROL: -- dev_name = DRM_CONTROL_DEV_NAME; -- break; -- case DRM_NODE_RENDER: -- dev_name = DRM_RENDER_DEV_NAME; -- break; -- default: -+ if (!dev_name) + if (!dev_name) return -EINVAL; -- }; +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + sprintf(buf, dev_name, DRM_DIR_NAME, minor + drmGetMinorBase(type)); @@ -204,7 +143,7 @@ if ((fd = open(buf, O_RDWR | O_CLOEXEC, 0)) >= 0) return fd; return -errno; -@@ -514,51 +580,6 @@ drm_public int drmAvailable(void) +@@ -514,51 +598,6 @@ drm_public int drmAvailable(void) return retval; } @@ -256,7 +195,7 @@ /** * Open the device by bus ID. * -@@ -2743,28 +2764,22 @@ drm_public int drmDropMaster(int fd) +@@ -2743,28 +2782,22 @@ drm_public int drmDropMaster(int fd) drm_public char *drmGetDeviceNameFromFd(int fd) { @@ -291,7 +230,7 @@ } static bool drmNodeIsDRM(int maj, int min) -@@ -2777,13 +2792,26 @@ static bool drmNodeIsDRM(int maj, int min) +@@ -2777,13 +2810,26 @@ static bool drmNodeIsDRM(int maj, int min) maj, min); return stat(path, &sbuf) == 0; #else @@ -320,7 +259,7 @@ int maj, min, type; if (fstat(fd, &sbuf)) -@@ -2801,6 +2829,7 @@ drm_public int drmGetNodeTypeFromFd(int fd) +@@ -2801,6 +2847,7 @@ drm_public int drmGetNodeTypeFromFd(int fd) if (type == -1) errno = ENODEV; return type; @@ -328,7 +267,7 @@ } drm_public int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, -@@ -2841,7 +2870,7 @@ static char *drmGetMinorNameForFD(int fd, int type) +@@ -2841,7 +2888,7 @@ static char *drmGetMinorNameForFD(int fd, int type) #ifdef __linux__ DIR *sysdir; struct dirent *ent; @@ -337,7 +276,7 @@ const char *name = drmGetMinorName(type); int len; char dev_name[64], buf[64]; -@@ -2879,13 +2908,35 @@ static char *drmGetMinorNameForFD(int fd, int type) +@@ -2879,13 +2926,32 @@ static char *drmGetMinorNameForFD(int fd, int type) closedir(sysdir); return NULL; @@ -361,43 +300,16 @@ + snprintf(name, DRM_NODE_NAME_MAX, dev_name, DRM_DIR_NAME, newnum); + return name; #else -- struct stat sbuf; -- char buf[PATH_MAX + 1]; -- const char *dev_name; -+ stat_t sbuf; -+ char buf[DRM_NODE_NAME_MAX]; -+ const char *dev_name = drmGetDeviceName(type); + struct stat sbuf; + char buf[PATH_MAX + 1]; + const char *dev_name = drmGetDeviceName(type); unsigned int maj, min; - int n, base; + int n; -+ if (!dev_name) -+ return NULL; -+ if (fstat(fd, &sbuf)) return NULL; -@@ -2895,20 +2946,6 @@ static char *drmGetMinorNameForFD(int fd, int type) - if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) - return NULL; - -- switch (type) { -- case DRM_NODE_PRIMARY: -- dev_name = DRM_DEV_NAME; -- break; -- case DRM_NODE_CONTROL: -- dev_name = DRM_CONTROL_DEV_NAME; -- break; -- case DRM_NODE_RENDER: -- dev_name = DRM_RENDER_DEV_NAME; -- break; -- default: -- return NULL; -- }; -- - base = drmGetMinorBase(type); - if (base < 0) - return NULL; -@@ -3032,7 +3069,7 @@ static int drmParseSubsystemType(int maj, int min) +@@ -3032,7 +3098,7 @@ static int drmParseSubsystemType(int maj, int min) } return -EINVAL; @@ -406,7 +318,7 @@ return DRM_BUS_PCI; #else #warning "Missing implementation of drmParseSubsystemType" -@@ -3035,7 +3072,8 @@ get_pci_path(int maj, int min, char *pci_path) +@@ -3035,7 +3101,8 @@ get_pci_path(int maj, int min, char *pci_path) *term = 0; } @@ -416,7 +328,7 @@ { #ifdef __linux__ unsigned int domain, bus, dev, func; -@@ -3084,6 +3122,60 @@ static int drmParsePciBusInfo(int maj, int min, drmPci +@@ -3084,6 +3151,60 @@ static int drmParsePciBusInfo(int maj, int min, drmPci info->func = pinfo.func; return 0; @@ -477,16 +389,12 @@ #else #warning "Missing implementation of drmParsePciBusInfo" return -EINVAL; -@@ -3118,32 +3210,6 @@ drm_public int drmDevicesEqual(drmDevicePtr a, drmDevi +@@ -3118,32 +3239,6 @@ drm_public int drmDevicesEqual(drmDevicePtr a, drmDevi return 0; } -static int drmGetNodeType(const char *name) -{ -- if (strncmp(name, DRM_PRIMARY_MINOR_NAME, -- sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0) -- return DRM_NODE_PRIMARY; -- - if (strncmp(name, DRM_CONTROL_MINOR_NAME, - sizeof(DRM_CONTROL_MINOR_NAME ) - 1) == 0) - return DRM_NODE_CONTROL; @@ -495,6 +403,10 @@ - sizeof(DRM_RENDER_MINOR_NAME) - 1) == 0) - return DRM_NODE_RENDER; - +- if (strncmp(name, DRM_PRIMARY_MINOR_NAME, +- sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0) +- return DRM_NODE_PRIMARY; +- - return -EINVAL; -} - @@ -510,7 +422,7 @@ #ifdef __linux__ static int parse_separate_sysfs_files(int maj, int min, drmPciDeviceInfoPtr device, -@@ -3216,6 +3282,7 @@ static int parse_config_sysfs_file(int maj, int min, +@@ -3216,6 +3311,7 @@ static int parse_config_sysfs_file(int maj, int min, #endif static int drmParsePciDeviceInfo(int maj, int min, @@ -518,7 +430,7 @@ drmPciDeviceInfoPtr device, uint32_t flags) { -@@ -3252,6 +3319,43 @@ static int drmParsePciDeviceInfo(int maj, int min, +@@ -3252,6 +3348,43 @@ static int drmParsePciDeviceInfo(int maj, int min, device->subdevice_id = pinfo.subdevice_id; return 0; @@ -562,7 +474,7 @@ #else #warning "Missing implementation of drmParsePciDeviceInfo" return -EINVAL; -@@ -3332,7 +3436,7 @@ static drmDevicePtr drmDeviceAlloc(unsigned int type, +@@ -3332,7 +3465,7 @@ static drmDevicePtr drmDeviceAlloc(unsigned int type, unsigned int i; char *ptr; @@ -571,7 +483,7 @@ extra = DRM_NODE_MAX * (sizeof(void *) + max_node_length); size = sizeof(*device) + extra + bus_size + device_size; -@@ -3378,7 +3482,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, +@@ -3378,7 +3511,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, dev->businfo.pci = (drmPciBusInfoPtr)addr; @@ -580,7 +492,7 @@ if (ret) goto free_device; -@@ -3387,7 +3491,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, +@@ -3387,7 +3520,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, addr += sizeof(drmPciBusInfo); dev->deviceinfo.pci = (drmPciDeviceInfoPtr)addr; @@ -589,7 +501,7 @@ if (ret) goto free_device; } -@@ -3727,8 +3831,8 @@ process_device(drmDevicePtr *device, const char *d_nam +@@ -3727,8 +3860,8 @@ process_device(drmDevicePtr *device, const char *d_nam int req_subsystem_type, bool fetch_deviceinfo, uint32_t flags) { @@ -600,7 +512,7 @@ int node_type, subsystem_type; unsigned int maj, min; -@@ -3736,7 +3840,7 @@ process_device(drmDevicePtr *device, const char *d_nam +@@ -3736,7 +3869,7 @@ process_device(drmDevicePtr *device, const char *d_nam if (node_type < 0) return -1; @@ -609,7 +521,7 @@ if (stat(node, &sbuf)) return -1; -@@ -3784,7 +3888,7 @@ static void drmFoldDuplicatedDevices(drmDevicePtr loca +@@ -3784,7 +3917,7 @@ static void drmFoldDuplicatedDevices(drmDevicePtr loca local_devices[i]->available_nodes |= local_devices[j]->available_nodes; node_type = log2(local_devices[j]->available_nodes); memcpy(local_devices[i]->nodes[node_type], @@ -618,7 +530,7 @@ drmFreeDevice(&local_devices[j]); } } -@@ -3824,7 +3928,7 @@ drm_device_has_rdev(drmDevicePtr device, dev_t find_rd +@@ -3824,7 +3957,7 @@ drm_device_has_rdev(drmDevicePtr device, dev_t find_rd * Get information about the opened drm device * * \param fd file descriptor of the drm device @@ -627,7 +539,7 @@ * \param device the address of a drmDevicePtr where the information * will be allocated in stored * -@@ -3842,8 +3946,8 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, d +@@ -3842,8 +3975,8 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, d * Avoid stat'ing all of /dev needlessly by implementing this custom path. */ drmDevicePtr d; @@ -638,38 +550,7 @@ const char *dev_name; int node_type, subsystem_type; int maj, min, n, ret, base; -@@ -3864,26 +3968,16 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, d - if (node_type == -1) - return -ENODEV; - -- switch (node_type) { -- case DRM_NODE_PRIMARY: -- dev_name = DRM_DEV_NAME; -- break; -- case DRM_NODE_CONTROL: -- dev_name = DRM_CONTROL_DEV_NAME; -- break; -- case DRM_NODE_RENDER: -- dev_name = DRM_RENDER_DEV_NAME; -- break; -- default: -+ dev_name = drmGetDeviceName(node_type); -+ if (!dev_name) - return -EINVAL; -- }; - - base = drmGetMinorBase(node_type); - if (base < 0) - return -EINVAL; - -- n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min - base); -- if (n == -1 || n >= PATH_MAX) -+ n = snprintf(node, sizeof(node), dev_name, DRM_DIR_NAME, min - base); -+ if (n == -1 || n >= sizeof(node)) - return -errno; - if (stat(node, &sbuf)) - return -EINVAL; -@@ -3989,7 +4083,7 @@ drm_public int drmGetDevice(int fd, drmDevicePtr *devi +@@ -3989,7 +4122,7 @@ drm_public int drmGetDevice(int fd, drmDevicePtr *devi /** * Get drm devices on the system * @@ -678,7 +559,7 @@ * \param devices the array of devices with drmDevicePtr elements * can be NULL to get the device number first * \param max_devices the maximum number of devices for the array -@@ -4074,7 +4168,7 @@ drm_public int drmGetDevices(drmDevicePtr devices[], i +@@ -4074,7 +4207,7 @@ drm_public int drmGetDevices(drmDevicePtr devices[], i drm_public char *drmGetDeviceNameFromFd2(int fd) { #ifdef __linux__ @@ -687,7 +568,7 @@ char path[PATH_MAX + 1], *value; unsigned int maj, min; -@@ -4097,9 +4191,26 @@ drm_public char *drmGetDeviceNameFromFd2(int fd) +@@ -4097,9 +4230,26 @@ drm_public char *drmGetDeviceNameFromFd2(int fd) free(value); return strdup(path); @@ -716,34 +597,3 @@ const char *dev_name; int node_type; int maj, min, n, base; -@@ -4117,26 +4228,16 @@ drm_public char *drmGetDeviceNameFromFd2(int fd) - if (node_type == -1) - return NULL; - -- switch (node_type) { -- case DRM_NODE_PRIMARY: -- dev_name = DRM_DEV_NAME; -- break; -- case DRM_NODE_CONTROL: -- dev_name = DRM_CONTROL_DEV_NAME; -- break; -- case DRM_NODE_RENDER: -- dev_name = DRM_RENDER_DEV_NAME; -- break; -- default: -+ dev_name = drmGetDeviceName(node_type); -+ if (!dev_name) - return NULL; -- }; - - base = drmGetMinorBase(node_type); - if (base < 0) - return NULL; - -- n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min - base); -- if (n == -1 || n >= PATH_MAX) -+ n = snprintf(node, sizeof(node), dev_name, DRM_DIR_NAME, min - base); -+ if (n == -1 || n >= sizeof(node)) - return NULL; - - return strdup(node);