drm: Branch 'master' - 4 commits

[email protected] (Emil Velikov)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 Makefile.am                      |    1 
 README                           |    2 -
 include/drm/README               |    2 -
 intel/intel_bufmgr_fake.c        |    4 +--
 intel/intel_bufmgr_gem.c         |    6 ++--
 radeon/radeon_cs_gem.c           |   10 +++----
 radeon/radeon_surface.c          |    2 -
 tests/kms/kms-universal-planes.c |    2 -
 xf86drm.c                        |   51 +++++++++++++++++++++++++++++++++++++++
 xf86drm.h                        |    5 +++
 10 files changed, 71 insertions(+), 14 deletions(-)

New commits:
commit 1924b6704aa34bb3dd044b8e1e29558c521c6902
Author: Grazvydas Ignotas <[email protected]>
Date:   Sun Nov 20 20:25:46 2016 +0200

    libdrm: random typo fixes
    
    Just some trivial boring typo fixes all over the tree.
    READMEs and comments only.
    
    Signed-off-by: Grazvydas Ignotas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/README b/README
index 603a1c1..7eeae38 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 libdrm - userspace library for drm
 
 This  is libdrm,  a userspace  library for  accessing the  DRM, direct
-rendering  manager, on  Linux,  BSD and  other  operating systes  that
+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
diff --git a/include/drm/README b/include/drm/README
index c3292f3..a50b02c 100644
--- a/include/drm/README
+++ b/include/drm/README
@@ -89,7 +89,7 @@ Nearly all headers:
 Status: Trivial.
 
 Most UMS headers:
- - Not using fixed size interers - compat ioctls are broken.
+ - Not using fixed size integers - compat ioctls are broken.
 Status: ?
 Promote to fixed size ints, which match the current (32bit) ones.
 
diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c
index 24b3732..641df6a 100644
--- a/intel/intel_bufmgr_fake.c
+++ b/intel/intel_bufmgr_fake.c
@@ -737,7 +737,7 @@ drm_intel_bufmgr_fake_wait_idle(drm_intel_bufmgr_fake *bufmgr_fake)
 /**
  * Wait for rendering to a buffer to complete.
  *
- * It is assumed that the bathcbuffer which performed the rendering included
+ * It is assumed that the batchbuffer which performed the rendering included
  * the necessary flushing.
  */
 static void
@@ -1200,7 +1200,7 @@ static int
 		assert(!(bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED)));
 
 		/* Actually, should be able to just wait for a fence on the
-		 * mmory, hich we would be tracking when we free it.  Waiting
+		 * memory, which we would be tracking when we free it. Waiting
 		 * for idle is a sufficiently large hammer for now.
 		 */
 		drm_intel_bufmgr_fake_wait_idle(bufmgr_fake);
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 5fc022a..75949b9 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -256,7 +256,7 @@ struct _drm_intel_bo_gem {
 	 * Boolean of whether the GPU is definitely not accessing the buffer.
 	 *
 	 * This is only valid when reusable, since non-reusable
-	 * buffers are those that have been shared wth other
+	 * buffers are those that have been shared with other
 	 * processes, so we don't know their state.
 	 */
 	bool idle;
@@ -294,7 +294,7 @@ struct _drm_intel_bo_gem {
 	 */
 	int reloc_tree_fences;
 
-	/** Flags that we may need to do the SW_FINSIH ioctl on unmap. */
+	/** Flags that we may need to do the SW_FINISH ioctl on unmap. */
 	bool mapped_cpu_write;
 };
 
@@ -1719,7 +1719,7 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo)
 	}
 
 	/* We need to unmap after every innovation as we cannot track
-	 * an open vma for every bo as that will exhaasut the system
+	 * an open vma for every bo as that will exhaust the system
 	 * limits and cause later failures.
 	 */
 	if (--bo_gem->map_count == 0) {
diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index 23f33af..f3dccb6 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -189,7 +189,7 @@ static int cs_gem_write_reloc(struct radeon_cs_int *cs,
     /* check domains */
     if ((read_domain && write_domain) || (!read_domain && !write_domain)) {
         /* in one CS a bo can only be in read or write domain but not
-         * in read & write domain at the same sime
+         * in read & write domain at the same time
          */
         return -EINVAL;
     }
@@ -242,7 +242,7 @@ static int cs_gem_write_reloc(struct radeon_cs_int *cs,
     }
     /* new relocation */
     if (csg->base.crelocs >= csg->nrelocs) {
-        /* allocate more memory (TODO: should use a slab allocatore maybe) */
+        /* allocate more memory (TODO: should use a slab allocator maybe) */
         uint32_t *tmp, size;
         size = ((csg->nrelocs + 1) * sizeof(struct radeon_bo*));
         tmp = (uint32_t*)realloc(csg->relocs_bo, size);
@@ -268,7 +268,7 @@ static int cs_gem_write_reloc(struct radeon_cs_int *cs,
     reloc->flags = flags;
     csg->chunks[1].length_dw += RELOC_SIZE;
     radeon_bo_ref(bo);
-    /* bo might be referenced from another context so have to use atomic opertions */
+    /* bo might be referenced from another context so have to use atomic operations */
     atomic_add((atomic_t *)radeon_gem_get_reloc_in_cs(bo), cs->id);
     cs->relocs_total_size += boi->size;
     radeon_cs_write_dword((struct radeon_cs *)cs, 0xc0001000);
@@ -449,7 +449,7 @@ static int cs_gem_emit(struct radeon_cs_int *cs)
                             &csg->cs, sizeof(struct drm_radeon_cs));
     for (i = 0; i < csg->base.crelocs; i++) {
         csg->relocs_bo[i]->space_accounted = 0;
-        /* bo might be referenced from another context so have to use atomic opertions */
+        /* bo might be referenced from another context so have to use atomic operations */
         atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id);
         radeon_bo_unref((struct radeon_bo *)csg->relocs_bo[i]);
         csg->relocs_bo[i] = NULL;
@@ -481,7 +481,7 @@ static int cs_gem_erase(struct radeon_cs_int *cs)
     if (csg->relocs_bo) {
         for (i = 0; i < csg->base.crelocs; i++) {
             if (csg->relocs_bo[i]) {
-                /* bo might be referenced from another context so have to use atomic opertions */
+                /* bo might be referenced from another context so have to use atomic operations */
                 atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id);
                 radeon_bo_unref((struct radeon_bo *)csg->relocs_bo[i]);
                 csg->relocs_bo[i] = NULL;
diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index 16a8b00..965be24 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -981,7 +981,7 @@ static int eg_surface_best(struct radeon_surface_manager *surf_man,
     /* bankw or bankh greater than 1 increase alignment requirement, not
      * sure if it's worth using smaller bankw & bankh to stick with 2D
      * tiling on small surface rather than falling back to 1D tiling.
-     * Use recommanded value based on tile size for now.
+     * Use recommended value based on tile size for now.
      *
      * fmask buffer has different optimal value figure them out once we
      * use it.
commit 1fc32f1cc5046fe76f2d5094fc576e097ea031e7
Author: Grazvydas Ignotas <[email protected]>
Date:   Sun Nov 20 20:25:47 2016 +0200

    tests: kms: fix shadowed declaration warning
    
    There is no need to maintain the value in the shadowed variable from
    what I can see.
    
    Signed-off-by: Grazvydas Ignotas <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/tests/kms/kms-universal-planes.c b/tests/kms/kms-universal-planes.c
index d8e5fc4..89057bb 100644
--- a/tests/kms/kms-universal-planes.c
+++ b/tests/kms/kms-universal-planes.c
@@ -212,9 +212,9 @@ int main(int argc, char *argv[])
 		printf("Planes: %u\n", device->num_planes);
 
 		for (i = 0; i < device->num_planes; i++) {
-			struct kms_plane *plane = device->planes[i];
 			const char *type = NULL;
 
+			plane = device->planes[i];
 			switch (plane->type) {
 			case DRM_PLANE_TYPE_OVERLAY:
 				type = "overlay";
commit 37d790f7d449874d0bf199d9ca9871d12b4d599a
Author: Emil Velikov <[email protected]>
Date:   Thu Nov 10 17:26:50 2016 +0000

    xf86drm: introduce drmGetDeviceNameFromFd2
    
    The original version considered only card devices, while this will pick
    the device/node name regardless - card, control, renderD, other...
    
    Current implementation is "linux" specific, in such that it relies on
    sysfs/uevent file. At the same time this gives us the flexibility to
    support any nodes even future ones, as long as they're within DRM_MAJOR.
    
    Shamelessly copied from mesa, latter by: Gary Wong <[email protected]>
    Signed-off-by: Emil Velikov <[email protected]>
    Reviewed-by: Nicolai Hähnle <[email protected]>

diff --git a/xf86drm.c b/xf86drm.c
index 9b97bbb..ed924a7 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3303,3 +3303,54 @@ free_locals:
     free(local_devices);
     return ret;
 }
+
+char *drmGetDeviceNameFromFd2(int fd)
+{
+#ifdef __linux__
+    struct stat sbuf;
+    char *device_name = NULL;
+    unsigned int maj, min;
+    FILE *f;
+    char buf[512];
+    static const char match[9] = "\nDEVNAME=";
+    int expected = 1;
+
+
+    if (fstat(fd, &sbuf))
+        return NULL;
+
+    maj = major(sbuf.st_rdev);
+    min = minor(sbuf.st_rdev);
+
+    if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode))
+        return NULL;
+
+    snprintf(buf, sizeof(buf), "/sys/dev/char/%d:%d/uevent", maj, min);
+    if (!(f = fopen(buf, "r")))
+        return NULL;
+
+    while (expected < sizeof(match)) {
+        int c = getc(f);
+
+        if (c == EOF) {
+            fclose(f);
+            return NULL;
+        } else if (c == match[expected] )
+            expected++;
+        else
+            expected = 0;
+    }
+
+    strcpy(buf, "/dev/");
+    if (fgets(buf + 5, sizeof(buf) - 5, f)) {
+        buf[strcspn(buf, "\n")] = '\0';
+        device_name = strdup(buf);
+    }
+
+    fclose(f);
+    return device_name;
+#else
+#warning "Missing implementation of drmGetDeviceNameFromFd2"
+    return NULL;
+#endif
+}
diff --git a/xf86drm.h b/xf86drm.h
index 481d882..4da6bd3 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -753,6 +753,11 @@ typedef struct _drmEventContext {
 extern int drmHandleEvent(int fd, drmEventContextPtr evctx);
 
 extern char *drmGetDeviceNameFromFd(int fd);
+
+/* Improved version of drmGetDeviceNameFromFd which attributes for any type of
+ * device/node - card, control or renderD.
+ */
+extern char *drmGetDeviceNameFromFd2(int fd);
 extern int drmGetNodeTypeFromFd(int fd);
 
 extern int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd);
commit 7e0bc3bf1c247e1d53733d0e2e2ada52d29b5327
Author: Emil Velikov <[email protected]>
Date:   Sat Nov 12 20:45:25 2016 +0000

    automake: make the build less chatty
    
    Having the "Entering|Leaving directory X" messages it not required nor
    useful in vast majority of the cases.
    
    One can always have them printed by `make -w' or by overriding the
    AM_MAKEFLAGS variable.
    
    Signed-off-by: Emil Velikov <[email protected]>

diff --git a/Makefile.am b/Makefile.am
index 2e46bde..dfb8fcd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,7 @@ include Makefile.sources
 
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
+AM_MAKEFLAGS = -s
 AM_DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-udev \
 	--enable-libkms \

------------------------------------------------------------------------------

--
_______________________________________________
Dri-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.