drisw: move build logic to build systems
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
1cbe2ad394
commit
6a9dd62882
|
@ -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 += \
|
||||
|
|
|
@ -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_@0@'.format(h.to_upper().underscorify())
|
||||
endif
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue