Source-Changes-HG archive

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

[xsrc/trunk]: xsrc/external/mit merge libdrm 2.4.97 and pixman 0.38.0.



details:   https://anonhg.NetBSD.org/xsrc/rev/c1c92438209b
branches:  trunk
changeset: 10172:c1c92438209b
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Mar 04 08:36:42 2019 +0000

description:
merge libdrm 2.4.97 and pixman 0.38.0.

diffstat:

 external/mit/libdrm/dist/README                     |   59 --
 external/mit/libdrm/dist/amdgpu/amdgpu_bo.c         |   34 +
 external/mit/libdrm/dist/xf86atomic.h               |    2 +
 external/mit/libdrm/dist/xf86drm.c                  |   40 +-
 external/mit/pixman/dist/pixman/pixman-bits-image.c |  418 ++++++++++++++-----
 external/mit/pixman/dist/pixman/pixman-inlines.h    |   25 +
 external/mit/pixman/dist/pixman/pixman-private.h    |   35 +-
 external/mit/pixman/include/config.h                |    6 +-
 8 files changed, 422 insertions(+), 197 deletions(-)

diffs (truncated from 962 to 300 lines):

diff -r 66b4ae4f508f -r c1c92438209b external/mit/libdrm/dist/README
--- a/external/mit/libdrm/dist/README   Mon Mar 04 08:28:59 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-libdrm - userspace library for drm
-
-This  is libdrm,  a userspace  library for  accessing the  DRM, direct
-rendering  manager, on  Linux,  BSD and  other  operating systems that
-support the  ioctl interface.  The library  provides wrapper functions
-for the  ioctls to avoid  exposing the kernel interface  directly, and
-for chipsets with drm memory manager, support for tracking relocations
-and  buffers.   libdrm  is  a  low-level library,  typically  used  by
-graphics drivers  such as the Mesa  DRI drivers, the  X drivers, libva
-and  similar projects.  New  functionality in  the kernel  DRM drivers
-typically requires  a new  libdrm, but a  new libdrm will  always work
-with an older kernel.
-
-
-Compiling
----------
-
-libdrm has two build systems, a legacy autotools build system, and a newer
-meson build system. The meson build system is much faster, and offers a
-slightly different interface, but otherwise provides an equivalent feature set.
-
-To use it:
-
-    meson builddir/
-
-By default this will install into /usr/local, you can change your prefix
-with --prefix=/usr (or `meson configure builddir/ -Dprefix=/usr` after 
-the initial meson setup).
-
-Then use ninja to build and install:
-
-    ninja -C builddir/ install
-
-If you are installing into a system location you will need to run install
-separately, and as root.
-
-
-Alternatively you can invoke autotools configure:
-
-       ./configure
-
-By default, libdrm  will install into the /usr/local/  prefix.  If you
-want  to  install   this  DRM  to  replace  your   system  copy,  pass
---prefix=/usr and  --exec-prefix=/ to configure.  If  you are building
-libdrm  from a  git checkout,  you first  need to  run  the autogen.sh
-script.  You can  pass any options to autogen.sh  that you would other
-wise  pass to configure,  or you  can just  re-run configure  with the
-options you need once autogen.sh finishes.
-
-Next step is to build libdrm:
-
-       make
-
-and once make finishes successfully, install the package using
-
-       make install
-
-If you are installing into a system location, you will need to be root
-to perform the install step.
diff -r 66b4ae4f508f -r c1c92438209b external/mit/libdrm/dist/amdgpu/amdgpu_bo.c
--- a/external/mit/libdrm/dist/amdgpu/amdgpu_bo.c       Mon Mar 04 08:28:59 2019 +0000
+++ b/external/mit/libdrm/dist/amdgpu/amdgpu_bo.c       Mon Mar 04 08:36:42 2019 +0000
@@ -618,6 +618,40 @@
        return r;
 }
 
+drm_public int amdgpu_bo_list_create_raw(amdgpu_device_handle dev,
+                                        uint32_t number_of_buffers,
+                                        struct drm_amdgpu_bo_list_entry *buffers,
+                                        uint32_t *result)
+{
+       union drm_amdgpu_bo_list args;
+       int r;
+
+       memset(&args, 0, sizeof(args));
+       args.in.operation = AMDGPU_BO_LIST_OP_CREATE;
+       args.in.bo_number = number_of_buffers;
+       args.in.bo_info_size = sizeof(struct drm_amdgpu_bo_list_entry);
+       args.in.bo_info_ptr = (uint64_t)(uintptr_t)buffers;
+
+       r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_BO_LIST,
+                               &args, sizeof(args));
+       if (!r)
+               *result = args.out.list_handle;
+       return r;
+}
+
+drm_public int amdgpu_bo_list_destroy_raw(amdgpu_device_handle dev,
+                                         uint32_t bo_list)
+{
+       union drm_amdgpu_bo_list args;
+
+       memset(&args, 0, sizeof(args));
+       args.in.operation = AMDGPU_BO_LIST_OP_DESTROY;
+       args.in.list_handle = bo_list;
+
+       return drmCommandWriteRead(dev->fd, DRM_AMDGPU_BO_LIST,
+                                  &args, sizeof(args));
+}
+
 drm_public int amdgpu_bo_list_create(amdgpu_device_handle dev,
                                     uint32_t number_of_resources,
                                     amdgpu_bo_handle *resources,
diff -r 66b4ae4f508f -r c1c92438209b external/mit/libdrm/dist/xf86atomic.h
--- a/external/mit/libdrm/dist/xf86atomic.h     Mon Mar 04 08:28:59 2019 +0000
+++ b/external/mit/libdrm/dist/xf86atomic.h     Mon Mar 04 08:36:42 2019 +0000
@@ -101,6 +101,8 @@
 #error libdrm requires atomic operations, please define them for your CPU/compiler.
 #endif
 
+#undef HAS_ATOMIC_OPS
+
 static inline int atomic_add_unless(atomic_t *v, int add, int unless)
 {
        int c, old;
diff -r 66b4ae4f508f -r c1c92438209b external/mit/libdrm/dist/xf86drm.c
--- a/external/mit/libdrm/dist/xf86drm.c        Mon Mar 04 08:28:59 2019 +0000
+++ b/external/mit/libdrm/dist/xf86drm.c        Mon Mar 04 08:36:42 2019 +0000
@@ -59,6 +59,8 @@
 #endif
 #include <math.h>
 
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
 /* Not all systems have MAP_FAILED defined */
 #ifndef MAP_FAILED
 #define MAP_FAILED ((void *)-1)
@@ -103,7 +105,7 @@
 #define DRM_MAJOR 226 /* Linux */
 #endif
 
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__DragonFly__)
 struct drm_pciinfo {
        uint16_t        domain;
        uint8_t         bus;
@@ -2988,6 +2990,17 @@
     char path[PATH_MAX + 1];
     char link[PATH_MAX + 1] = "";
     char *name;
+    struct {
+        const char *name;
+        int bus_type;
+    } bus_types[] = {
+        { "/pci", DRM_BUS_PCI },
+        { "/usb", DRM_BUS_USB },
+        { "/platform", DRM_BUS_PLATFORM },
+        { "/spi", DRM_BUS_PLATFORM },
+        { "/host1x", DRM_BUS_HOST1X },
+        { "/virtio", DRM_BUS_VIRTIO },
+    };
 
     snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/subsystem",
              maj, min);
@@ -2999,20 +3012,10 @@
     if (!name)
         return -EINVAL;
 
-    if (strncmp(name, "/pci", 4) == 0)
-        return DRM_BUS_PCI;
-
-    if (strncmp(name, "/usb", 4) == 0)
-        return DRM_BUS_USB;
-
-    if (strncmp(name, "/platform", 9) == 0)
-        return DRM_BUS_PLATFORM;
-
-    if (strncmp(name, "/host1x", 7) == 0)
-        return DRM_BUS_HOST1X;
-
-    if (strncmp(name, "/virtio", 7) == 0)
-        return DRM_BUS_VIRTIO;
+    for (unsigned i = 0; i < ARRAY_SIZE(bus_types); i++) {
+        if (strncmp(name, bus_types[i].name, strlen(bus_types[i].name)) == 0)
+            return bus_types[i].bus_type;
+    }
 
     return -EINVAL;
 #elif defined(__NetBSD__)
@@ -3074,7 +3077,7 @@
 
     /* Success or not, we're done.  */
     return ret;
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) || defined(__DragonFly__)
     return DRM_BUS_PCI;
 #else
 #warning "Missing implementation of drmParseSubsystemType"
@@ -3190,7 +3193,7 @@
 
     /* Success!  */
     return 0;
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) || defined(__DragonFly__)
     struct drm_pciinfo pinfo;
     int fd, type;
 
@@ -3279,7 +3282,6 @@
                                       drmPciDeviceInfoPtr device,
                                       bool ignore_revision)
 {
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
     static const char *attrs[] = {
       "revision", /* Older kernels are missing the file, so check for it first */
       "vendor",
@@ -3399,7 +3401,7 @@
        ret = -errno;
     close(pcifd);
     return ret;
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) || defined(__DragonFly__)
     struct drm_pciinfo pinfo;
     int fd, type;
 
diff -r 66b4ae4f508f -r c1c92438209b external/mit/pixman/dist/pixman/pixman-bits-image.c
--- a/external/mit/pixman/dist/pixman/pixman-bits-image.c       Mon Mar 04 08:28:59 2019 +0000
+++ b/external/mit/pixman/dist/pixman/pixman-bits-image.c       Mon Mar 04 08:36:42 2019 +0000
@@ -36,43 +36,45 @@
 #include "pixman-combine32.h"
 #include "pixman-inlines.h"
 
-static uint32_t *
-_pixman_image_get_scanline_generic_float (pixman_iter_t * iter,
-                                         const uint32_t *mask)
-{
-    pixman_iter_get_scanline_t fetch_32 = iter->data;
-    uint32_t *buffer = iter->buffer;
-
-    fetch_32 (iter, NULL);
-
-    pixman_expand_to_float ((argb_t *)buffer, buffer, PIXMAN_a8r8g8b8, iter->width);
-
-    return iter->buffer;
-}
-
 /* Fetch functions */
 
-static force_inline uint32_t
-fetch_pixel_no_alpha (bits_image_t *image,
-                     int x, int y, pixman_bool_t check_bounds)
+static force_inline void
+fetch_pixel_no_alpha_32 (bits_image_t *image,
+                        int x, int y, pixman_bool_t check_bounds,
+                        void *out)
 {
+    uint32_t *ret = out;
+
     if (check_bounds &&
        (x < 0 || x >= image->width || y < 0 || y >= image->height))
-    {
-       return 0;
-    }
-
-    return image->fetch_pixel_32 (image, x, y);
+       *ret = 0;
+    else
+       *ret = image->fetch_pixel_32 (image, x, y);
 }
 
-typedef uint32_t (* get_pixel_t) (bits_image_t *image,
-                                 int x, int y, pixman_bool_t check_bounds);
+static force_inline void
+fetch_pixel_no_alpha_float (bits_image_t *image,
+                           int x, int y, pixman_bool_t check_bounds,
+                           void *out)
+{
+    argb_t *ret = out;
 
-static force_inline uint32_t
+    if (check_bounds &&
+       (x < 0 || x >= image->width || y < 0 || y >= image->height))
+       ret->a = ret->r = ret->g = ret->b = 0.f;
+    else
+       *ret = image->fetch_pixel_float (image, x, y);
+}
+
+typedef void (* get_pixel_t) (bits_image_t *image,
+                             int x, int y, pixman_bool_t check_bounds, void *out);
+
+static force_inline void
 bits_image_fetch_pixel_nearest (bits_image_t   *image,
                                pixman_fixed_t  x,
                                pixman_fixed_t  y,
-                               get_pixel_t     get_pixel)
+                               get_pixel_t     get_pixel,
+                               void           *out)
 {
     int x0 = pixman_fixed_to_int (x - pixman_fixed_e);
     int y0 = pixman_fixed_to_int (y - pixman_fixed_e);
@@ -82,19 +84,20 @@
        repeat (image->common.repeat, &x0, image->width);
        repeat (image->common.repeat, &y0, image->height);
 
-       return get_pixel (image, x0, y0, FALSE);
+       get_pixel (image, x0, y0, FALSE, out);
     }



Home | Main Index | Thread Index | Old Index