Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: xsrc/external/mit/libdrm/dist
In article <20140321180950.24A7798%cvs.netbsd.org@localhost>,
Taylor R Campbell <source-changes-d%NetBSD.org@localhost> wrote:
>-=-=-=-=-=-
>
>Module Name: xsrc
>Committed By: riastradh
>Date: Fri Mar 21 18:09:50 UTC 2014
>
>Modified Files:
> xsrc/external/mit/libdrm/dist: xf86drm.c
> xsrc/external/mit/libdrm/dist/include/drm: drm.h
>
>Log Message:
>Use the NetBSD-specific mmapping ioctl for drmMap.
>
>
>To generate a diff of this commit:
>cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/libdrm/dist/xf86drm.c
>cvs rdiff -u -r1.1.1.4 -r1.2 xsrc/external/mit/libdrm/dist/include/drm/drm.h
>
>Please note that diffs are not public domain; they are subject to the
>copyright notices on the relevant files.
>
>
>-=-=-=-=-=-
>
>Modified files:
>
>Index: xsrc/external/mit/libdrm/dist/xf86drm.c
>diff -u xsrc/external/mit/libdrm/dist/xf86drm.c:1.5
>xsrc/external/mit/libdrm/dist/xf86drm.c:1.6
>--- xsrc/external/mit/libdrm/dist/xf86drm.c:1.5 Mon Mar 17 07:52:19 2014
>+++ xsrc/external/mit/libdrm/dist/xf86drm.c Fri Mar 21 18:09:50 2014
>@@ -1138,6 +1138,10 @@ int drmClose(int fd)
> int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address)
> {
> static unsigned long pagesize_mask = 0;
That ifdef could just be DRM_IOCTL_MMAP
>+#ifdef __NetBSD__ /* XXX */
>+ static const struct drm_mmap zero_mmap_req;
>+ struct drm_mmap mmap_req = zero_mmap_req;
struct drm_mmap map_req = { 0 }; works just fine?
>+#endif
>
> if (fd < 0)
> return -EINVAL;
>@@ -1147,9 +1151,20 @@ int drmMap(int fd, drm_handle_t handle,
>
> size = (size + pagesize_mask) & ~pagesize_mask;
>
That ifdef could just be DRM_IOCTL_MMAP
>+#ifdef __NetBSD__
>+ mmap_req.dnm_addr = NULL;
>+ mmap_req.dnm_size = size;
>+ mmap_req.dnm_prot = (PROT_READ | PROT_WRITE);
>+ mmap_req.dnm_flags = MAP_SHARED;
>+ mmap_req.dnm_offset = handle;
>+ if (drmIoctl(fd, DRM_IOCTL_MMAP, &mmap_req) == -1)
>+ return -errno;
>+ *address = mmap_req.dnm_addr;
>+#else
> *address = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle);
> if (*address == MAP_FAILED)
> return -errno;
>+#endif
> return 0;
> }
>
>
>Index: xsrc/external/mit/libdrm/dist/include/drm/drm.h
>diff -u xsrc/external/mit/libdrm/dist/include/drm/drm.h:1.1.1.4
>xsrc/external/mit/libdrm/dist/include/drm/drm.h:1.2
>--- xsrc/external/mit/libdrm/dist/include/drm/drm.h:1.1.1.4 Mon Mar 17
>07:51:43 2014
>+++ xsrc/external/mit/libdrm/dist/include/drm/drm.h Fri Mar 21 18:09:49 2014
>@@ -751,6 +751,20 @@ struct drm_prime_handle {
> #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct
>drm_mode_obj_set_property)
> #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct
> drm_mode_cursor2)
>
>+#ifdef __NetBSD__
>+/*
>+ * Instrumenting mmap is trickier than just making an ioctl to do it.
>+ */
>+struct drm_mmap {
>+ void *dnm_addr; /* in/out */
>+ size_t dnm_size; /* in */
>+ int dnm_prot; /* in */
>+ int dnm_flags; /* in */
>+ off_t dnm_offset; /* in */
>+};
>+#define DRM_IOCTL_MMAP DRM_IOWR(0xff, struct drm_mmap)
>+#endif
>+
> /**
> * Device specific ioctls should only be in their respective headers
> * The device specific ioctl range is from 0x40 to 0x99.
>
>
>-=-=-=-=-=-
Home |
Main Index |
Thread Index |
Old Index