Mesa (master): drisw: move build logic to build systems

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 21 11:36:03 UTC 2019


Module: Mesa
Branch: master
Commit: 6a9dd62882b9e2b57394a192cc66e886128df026
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a9dd62882b9e2b57394a192cc66e886128df026

Author: Eric Engestrom <eric.engestrom at intel.com>
Date:   Fri Nov 23 17:04:25 2018 +0000

drisw: move build logic to build systems

Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 Android.common.mk                         |  5 +++++
 meson.build                               |  2 +-
 scons/gallium.py                          |  3 +++
 src/gallium/winsys/sw/dri/dri_sw_winsys.c | 10 ++++------
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 36d97c52dd1..327f13f5a38 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -98,6 +98,11 @@ ifeq ($(filter 5 6 7 8 9, $(MESA_ANDROID_MAJOR_VERSION)),)
 LOCAL_CFLAGS += -DHAVE_TIMESPEC_GET
 endif
 
+# Android's libc began supporting shm in Oreo
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26 && echo true),true)
+LOCAL_CFLAGS += -DHAVE_SYS_SHM_H
+endif
+
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
 ifeq ($(TARGET_ARCH),x86)
 LOCAL_CFLAGS += \
diff --git a/meson.build b/meson.build
index 28689857dc3..d8a48bd6994 100644
--- a/meson.build
+++ b/meson.build
@@ -1036,7 +1036,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major')
   pre_args += '-DMAJOR_IN_MKDEV'
 endif
 
-foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h']
+foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h']
   if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h))
     pre_args += '-DHAVE_ at 0@'.format(h.to_upper().underscorify())
   endif
diff --git a/scons/gallium.py b/scons/gallium.py
index 61bbeb2399f..c2713992b36 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -371,6 +371,9 @@ def generate(env):
         if check_functions(env, ['timespec_get']):
             cppdefines += ['HAVE_TIMESPEC_GET']
 
+        if check_header(env, 'sys/shm.h'):
+            cppdefines += ['HAVE_SYS_SHM_H']
+
     if platform == 'windows':
         cppdefines += [
             'WIN32',
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index 3273813bf50..eacee295ee1 100644
--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -26,9 +26,7 @@
  *
  **************************************************************************/
 
-#if !defined(ANDROID) || ANDROID_API_LEVEL >= 26
-/* Android's libc began supporting shm in Oreo */
-#define HAVE_SHM
+#ifdef HAVE_SYS_SHM_H
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #endif
@@ -88,7 +86,7 @@ dri_sw_is_displaytarget_format_supported( struct sw_winsys *ws,
    return TRUE;
 }
 
-#ifdef HAVE_SHM
+#ifdef HAVE_SYS_SHM_H
 static char *
 alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size)
 {
@@ -139,7 +137,7 @@ dri_sw_displaytarget_create(struct sw_winsys *winsys,
 
    dri_sw_dt->shmid = -1;
 
-#ifdef HAVE_SHM
+#ifdef HAVE_SYS_SHM_H
    if (ws->lf->put_image_shm)
       dri_sw_dt->data = alloc_shm(dri_sw_dt, size);
 #endif
@@ -166,7 +164,7 @@ dri_sw_displaytarget_destroy(struct sw_winsys *ws,
    struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
 
    if (dri_sw_dt->shmid >= 0) {
-#ifdef HAVE_SHM
+#ifdef HAVE_SYS_SHM_H
       shmdt(dri_sw_dt->data);
       shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
 #endif




More information about the mesa-commit mailing list