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:

committed by
Eric Engestrom

parent
1cbe2ad394
commit
6a9dd62882
@@ -98,6 +98,11 @@ ifeq ($(filter 5 6 7 8 9, $(MESA_ANDROID_MAJOR_VERSION)),)
|
|||||||
LOCAL_CFLAGS += -DHAVE_TIMESPEC_GET
|
LOCAL_CFLAGS += -DHAVE_TIMESPEC_GET
|
||||||
endif
|
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 ($(strip $(MESA_ENABLE_ASM)),true)
|
||||||
ifeq ($(TARGET_ARCH),x86)
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
LOCAL_CFLAGS += \
|
LOCAL_CFLAGS += \
|
||||||
|
@@ -1036,7 +1036,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major')
|
|||||||
pre_args += '-DMAJOR_IN_MKDEV'
|
pre_args += '-DMAJOR_IN_MKDEV'
|
||||||
endif
|
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))
|
if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h))
|
||||||
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
|
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
|
||||||
endif
|
endif
|
||||||
|
@@ -371,6 +371,9 @@ def generate(env):
|
|||||||
if check_functions(env, ['timespec_get']):
|
if check_functions(env, ['timespec_get']):
|
||||||
cppdefines += ['HAVE_TIMESPEC_GET']
|
cppdefines += ['HAVE_TIMESPEC_GET']
|
||||||
|
|
||||||
|
if check_header(env, 'sys/shm.h'):
|
||||||
|
cppdefines += ['HAVE_SYS_SHM_H']
|
||||||
|
|
||||||
if platform == 'windows':
|
if platform == 'windows':
|
||||||
cppdefines += [
|
cppdefines += [
|
||||||
'WIN32',
|
'WIN32',
|
||||||
|
@@ -26,9 +26,7 @@
|
|||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if !defined(ANDROID) || ANDROID_API_LEVEL >= 26
|
#ifdef HAVE_SYS_SHM_H
|
||||||
/* Android's libc began supporting shm in Oreo */
|
|
||||||
#define HAVE_SHM
|
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -88,7 +86,7 @@ dri_sw_is_displaytarget_format_supported( struct sw_winsys *ws,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SHM
|
#ifdef HAVE_SYS_SHM_H
|
||||||
static char *
|
static char *
|
||||||
alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size)
|
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;
|
dri_sw_dt->shmid = -1;
|
||||||
|
|
||||||
#ifdef HAVE_SHM
|
#ifdef HAVE_SYS_SHM_H
|
||||||
if (ws->lf->put_image_shm)
|
if (ws->lf->put_image_shm)
|
||||||
dri_sw_dt->data = alloc_shm(dri_sw_dt, size);
|
dri_sw_dt->data = alloc_shm(dri_sw_dt, size);
|
||||||
#endif
|
#endif
|
||||||
@@ -166,7 +164,7 @@ dri_sw_displaytarget_destroy(struct sw_winsys *ws,
|
|||||||
struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
|
struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
|
||||||
|
|
||||||
if (dri_sw_dt->shmid >= 0) {
|
if (dri_sw_dt->shmid >= 0) {
|
||||||
#ifdef HAVE_SHM
|
#ifdef HAVE_SYS_SHM_H
|
||||||
shmdt(dri_sw_dt->data);
|
shmdt(dri_sw_dt->data);
|
||||||
shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
|
shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user