diff options
author | Chad Versace <[email protected]> | 2018-07-18 17:43:35 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2018-08-06 11:09:38 -0700 |
commit | aaa41cd297f91583f0e5bddb11b736c0d03e333d (patch) | |
tree | f881a9d3c5b8c8c3b13394c18f3a50bc7b74985f /src/gallium/winsys/sw | |
parent | 6229ee87c76a6bb4e2b4003ccbb01b5e4b9c9f65 (diff) |
drisw: Fix build on Android Nougat, which lacks shm (v2)
In commit cf54bd5e8, dri_sw_winsys.c began using <sys/shm.h> to support
the new functions putImageShm, getImageShm in DRI_SWRastLoader. But
Android began supporting System V shared memory only in Oreo. Nougat has
no shm headers.
Fix the build by ifdef'ing out the shm code on Nougat.
Fixes: cf54bd5e8 "drisw: use shared memory when possible"
Reviewed-by: Dave Airlie <[email protected]>
Cc: Marc-André Lureau <[email protected]>
Diffstat (limited to 'src/gallium/winsys/sw')
-rw-r--r-- | src/gallium/winsys/sw/dri/dri_sw_winsys.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c index 40007200a5d..d519bcfedd3 100644 --- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c +++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c @@ -26,8 +26,12 @@ * **************************************************************************/ +#if !defined(ANDROID) || ANDROID_API_LEVEL >= 26 +/* Android's libc began supporting shm in Oreo */ +#define HAVE_SHM #include <sys/ipc.h> #include <sys/shm.h> +#endif #include "pipe/p_compiler.h" #include "pipe/p_format.h" @@ -83,6 +87,7 @@ dri_sw_is_displaytarget_format_supported( struct sw_winsys *ws, return TRUE; } +#ifdef HAVE_SHM static char * alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size) { @@ -101,6 +106,7 @@ alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size) return addr; } +#endif static struct sw_displaytarget * dri_sw_displaytarget_create(struct sw_winsys *winsys, @@ -131,8 +137,11 @@ dri_sw_displaytarget_create(struct sw_winsys *winsys, size = dri_sw_dt->stride * nblocksy; dri_sw_dt->shmid = -1; + +#ifdef HAVE_SHM if (ws->lf->put_image_shm) dri_sw_dt->data = alloc_shm(dri_sw_dt, size); +#endif if(!dri_sw_dt->data) dri_sw_dt->data = align_malloc(size, alignment); @@ -156,8 +165,10 @@ 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 shmdt(dri_sw_dt->data); shmctl(dri_sw_dt->shmid, IPC_RMID, 0); +#endif } else { align_free(dri_sw_dt->data); } |