drm: Branch 'master' - 3 commits

[email protected] (Emil Velikov) Thu, 22 Mar 2018 16:51:40 +0000 (UTC)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 Android.mk      |    4 +++-
 omap/Android.mk |   13 +++++++++++++
 xf86drm.c       |   22 +++-------------------
 3 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit bb45ce4e3ac751315bfd7fbfd9e1425bf515ec0d
Author: John Stultz <[email protected]>
Date:   Tue Mar 20 17:48:23 2018 +0000

    libdrm: Use readdir instead of readdir_r to avoid build warnings
    
    Building libdrm under AOSP, we see the following build warning:
    external/libdrm/xf86drm.c:2861:12: warning: 'readdir_r' is deprecated: readdir_r is deprecated; use readdir instead [-Wdeprecated-declarations]
        while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) {
               ^
    
    Building on Linux with glibc produces the same warning.
    Thus, this patch replaces readdir_r with readdir.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102031
    Cc: Robert Foss <[email protected]>
    Cc: Rob Herring <[email protected]>
    Cc: Stefan Schake <[email protected]>
    Cc: John Stultz <[email protected]>
    Signed-off-by: John Stultz <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>
    [Emil Velikov: remove unused variables, Eric]
    Signed-off-by: Emil Velikov <[email protected]>
    Reviewed-by: Eric Engestrom <[email protected]>

diff --git a/xf86drm.c b/xf86drm.c
index 689e8fe9..3a9d0ed2 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2819,12 +2819,11 @@ static char *drmGetMinorNameForFD(int fd, int type)
 {
 #ifdef __linux__
     DIR *sysdir;
-    struct dirent *pent, *ent;
+    struct dirent *ent;
     struct stat sbuf;
     const char *name = drmGetMinorName(type);
     int len;
     char dev_name[64], buf[64];
-    long name_max;
     int maj, min;
 
     if (!name)
@@ -2847,30 +2846,16 @@ static char *drmGetMinorNameForFD(int fd, int type)
     if (!sysdir)
         return NULL;
 
-    name_max = fpathconf(dirfd(sysdir), _PC_NAME_MAX);
-    if (name_max == -1)
-        goto out_close_dir;
-
-    pent = malloc(offsetof(struct dirent, d_name) + name_max + 1);
-    if (pent == NULL)
-         goto out_close_dir;
-
-    while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) {
+    while ((ent = readdir(sysdir))) {
         if (strncmp(ent->d_name, name, len) == 0) {
             snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME "/%s",
                  ent->d_name);
 
-            free(pent);
             closedir(sysdir);
-
             return strdup(dev_name);
         }
     }
-
-    free(pent);
-
-out_close_dir:
-    closedir(sysdir);
+    return NULL;
 #else
     struct stat sbuf;
     char buf[PATH_MAX + 1];
@@ -2911,7 +2896,6 @@ out_close_dir:
 
     return strdup(buf);
 #endif
-    return NULL;
 }
 
 char *drmGetPrimaryDeviceNameFromFd(int fd)
commit 32ee9c0e0566ee6642c3df02315a2595105c0c87
Author: Stefan Schake <[email protected]>
Date:   Sun Mar 18 02:26:59 2018 +0100

    android: Add missing include exports
    
    They were set for the static library but not the shared variant.
    
    Signed-off-by: Stefan Schake <[email protected]>
    Acked-by: John Stultz <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/Android.mk b/Android.mk
index 8611c5e3..1b77c538 100644
--- a/Android.mk
+++ b/Android.mk
@@ -53,7 +53,9 @@ LOCAL_MODULE := libdrm
 
 LOCAL_SRC_FILES := $(LIBDRM_FILES)
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
-        $(LOCAL_PATH)/include/drm
+	$(LOCAL_PATH) \
+	$(LOCAL_PATH)/include/drm \
+	$(LOCAL_PATH)/android
 
 LOCAL_SHARED_LIBRARIES := \
 	libcutils
commit d930ef82b2fe32d793e78ce536567ead7cc973d7
Author: Gowtham Tammana <[email protected]>
Date:   Wed Feb 28 12:54:51 2018 -0600

    omap: add Android build support
    
    Add Android.mk file to build libdrm_omap library.
    
    Signed-off-by: Gowtham Tammana <[email protected]>
    Signed-off-by: Andrew F. Davis <[email protected]>

diff --git a/omap/Android.mk b/omap/Android.mk
new file mode 100644
index 00000000..b25cca13
--- /dev/null
+++ b/omap/Android.mk
@@ -0,0 +1,13 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libdrm_omap
+LOCAL_VENDOR_MODULE := true
+
+LOCAL_SRC_FILES := omap_drm.c
+
+LOCAL_SHARED_LIBRARIES := libdrm
+
+include $(LIBDRM_COMMON_MK)
+
+include $(BUILD_SHARED_LIBRARY)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--