*
**************************************************************************/
+#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"
return TRUE;
}
+#ifdef HAVE_SHM
static char *
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,
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);
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);
}