[Mesa-dev] [PATCH 06/11] loader: use HAVE_LIBDRM instead of ! __NOT_HAVE_DRM_H

Ian Romanick idr at freedesktop.org
Thu Jul 9 10:55:04 PDT 2015


I can't really speak to the Android.mk or SConscript changes, but the
rest of this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

You might also see what Jeremy Huddleston Sequoia <jeremyhu at apple.com>
thinks, since most of this exists to support his platform. :)

On 07/08/2015 10:07 AM, Emil Velikov wrote:
> Double negatives in English language are normally avoided, plus the
> former seems cleaner and more consistent.
> 
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  src/loader/Android.mk          | 6 ++----
>  src/loader/Makefile.am         | 5 +----
>  src/loader/SConscript          | 2 --
>  src/loader/loader.c            | 8 ++++----
>  src/loader/pci_id_driver_map.c | 2 +-
>  5 files changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/src/loader/Android.mk b/src/loader/Android.mk
> index 92d9fd2..8690565 100644
> --- a/src/loader/Android.mk
> +++ b/src/loader/Android.mk
> @@ -33,10 +33,8 @@ include $(CLEAR_VARS)
>  LOCAL_SRC_FILES := \
>  	$(LOADER_C_FILES)
>  
> -# swrast only
> -ifeq ($(MESA_GPU_DRIVERS),swrast)
> -LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H
> -else
> +ifneq ($(filter-out swrast,$(MESA_GPU_DRIVERS)),)
> +LOCAL_CFLAGS += -DHAVE_LIBDRM
>  LOCAL_SHARED_LIBRARIES := libdrm
>  endif
>  
> diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am
> index aef1bd6..5190f7f 100644
> --- a/src/loader/Makefile.am
> +++ b/src/loader/Makefile.am
> @@ -48,10 +48,7 @@ libloader_la_CPPFLAGS += \
>  
>  endif
>  
> -if !HAVE_LIBDRM
> -libloader_la_CPPFLAGS += \
> -	-D__NOT_HAVE_DRM_H
> -else
> +if HAVE_LIBDRM
>  libloader_la_CPPFLAGS += \
>  	$(LIBDRM_CFLAGS)
>  
> diff --git a/src/loader/SConscript b/src/loader/SConscript
> index 16d1053..d98f11e 100644
> --- a/src/loader/SConscript
> +++ b/src/loader/SConscript
> @@ -8,8 +8,6 @@ env.Prepend(CPPPATH = [
>      '#include'
>  ])
>  
> -env.Append(CPPDEFINES = ['__NOT_HAVE_DRM_H'])
> -
>  if env['udev']:
>      env.PkgUseModules('UDEV')
>      env.Append(CPPDEFINES = ['HAVE_LIBUDEV'])
> diff --git a/src/loader/loader.c b/src/loader/loader.c
> index 8780587..4ed0a1f 100644
> --- a/src/loader/loader.c
> +++ b/src/loader/loader.c
> @@ -85,7 +85,7 @@
>  #endif
>  #include "loader.h"
>  
> -#ifndef __NOT_HAVE_DRM_H
> +#ifdef HAVE_LIBDRM
>  #include <xf86drm.h>
>  #endif
>  
> @@ -501,7 +501,7 @@ sysfs_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
>  }
>  #endif
>  
> -#if !defined(__NOT_HAVE_DRM_H)
> +#if defined(HAVE_LIBDRM)
>  /* for i915 */
>  #include <i915_drm.h>
>  /* for radeon */
> @@ -584,7 +584,7 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
>     if (sysfs_get_pci_id_for_fd(fd, vendor_id, chip_id))
>        return 1;
>  #endif
> -#if !defined(__NOT_HAVE_DRM_H)
> +#if HAVE_LIBDRM
>     if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id))
>        return 1;
>  #endif
> @@ -695,7 +695,7 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
>  
>     if (!loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) {
>  
> -#ifndef __NOT_HAVE_DRM_H
> +#if HAVE_LIBDRM
>        /* fallback to drmGetVersion(): */
>        drmVersionPtr version = drmGetVersion(fd);
>  
> diff --git a/src/loader/pci_id_driver_map.c b/src/loader/pci_id_driver_map.c
> index cb6f705..3c4657f 100644
> --- a/src/loader/pci_id_driver_map.c
> +++ b/src/loader/pci_id_driver_map.c
> @@ -23,7 +23,7 @@
>  
>  int is_nouveau_vieux(int fd);
>  
> -#ifndef __NOT_HAVE_DRM_H
> +#ifdef HAVE_LIBDRM
>  
>  #include <xf86drm.h>
>  #include <nouveau_drm.h>
> 



More information about the mesa-dev mailing list