OpenGL/common/Object.cpp \
OpenGL/common/MatrixStack.cpp \
-COMMON_CFLAGS := -DLOG_TAG=\"swiftshader\" -Wno-unused-parameter -Wno-implicit-exception-spec-mismatch -Wno-overloaded-virtual -fno-operator-names -msse2 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -std=c++11 -Xclang -fuse-init-array
+COMMON_CFLAGS := \
+ -DLOG_TAG=\"swiftshader\" \
+ -Wno-unused-parameter \
+ -Wno-implicit-exception-spec-mismatch \
+ -Wno-overloaded-virtual \
+ -fno-operator-names \
+ -msse2 \
+ -D__STDC_CONSTANT_MACROS \
+ -D__STDC_LIMIT_MACROS \
+ -DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
+ -std=c++11
ifneq ($(filter gce_x86 gce calypso, $(TARGET_DEVICE)),)
COMMON_CFLAGS += -DDISPLAY_LOGO=0
endif
+ifneq (16,${PLATFORM_SDK_VERSION})
+COMMON_CFLAGS += -Xclang -fuse-init-array
+else
+COMMON_CFLAGS += -D__STDC_INT64__
+endif
+
include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := swiftshader_top_release
LOCAL_CFLAGS += -DLOG_TAG=\"libLLVM_swiftshader\" \
-Wno-unused-parameter \
-Wno-implicit-exception-spec-mismatch \
- -Wno-overloaded-virtual \
- -Xclang -fuse-init-array
+ -Wno-overloaded-virtual
+
+ifneq (16,${PLATFORM_SDK_VERSION})
+LOCAL_CFLAGS += -Xclang -fuse-init-array
+else
+LOCAL_CFLAGS += -D__STDC_INT64__
+endif
LOCAL_CFLAGS += -fomit-frame-pointer -Os -ffunction-sections -fdata-sections
LOCAL_CFLAGS += -fno-operator-names -msse2 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
#include "FrameBufferAndroid.hpp"
#include <cutils/log.h>
-#include <ui/Fence.h>
namespace sw
{
+ inline int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer)
+ {
+ #if ANDROID_PLATFORM_SDK_VERSION > 16
+ return native_window_dequeue_buffer_and_wait(window, buffer);
+ #else
+ return window->dequeueBuffer(window, buffer);
+ #endif
+ }
+
+ inline int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd)
+ {
+ #if ANDROID_PLATFORM_SDK_VERSION > 16
+ return window->queueBuffer(window, buffer, fenceFd);
+ #else
+ return window->queueBuffer(window, buffer);
+ #endif
+ }
+
+ inline int cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd)
+ {
+ #if ANDROID_PLATFORM_SDK_VERSION > 16
+ return window->cancelBuffer(window, buffer, fenceFd);
+ #else
+ return window->cancelBuffer(window, buffer);
+ #endif
+ }
+
FrameBufferAndroid::FrameBufferAndroid(ANativeWindow* window, int width, int height)
: FrameBuffer(width, height, false, false),
nativeWindow(window), buffer(0), gralloc(0)
if (buffer)
{
// Probably doesn't have to cancel assuming a success queueing earlier
- nativeWindow->cancelBuffer(nativeWindow, buffer, -1);
+ cancelBuffer(nativeWindow, buffer, -1);
buffer = 0;
}
nativeWindow->common.decRef(&nativeWindow->common);
copy(source, sourceFormat, sourceStride);
if (buffer)
{
- nativeWindow->queueBuffer(nativeWindow, buffer, -1);
+ queueBuffer(nativeWindow, buffer, -1);
if (locked)
{
locked = 0;
void* FrameBufferAndroid::lock()
{
- int fenceFd = -1;
- if (nativeWindow->dequeueBuffer(nativeWindow, &buffer, &fenceFd) != android::NO_ERROR)
- {
- return NULL;
- }
-
- android::sp<android::Fence> fence(new android::Fence(fenceFd));
- if (fence->wait(android::Fence::TIMEOUT_NEVER) != android::NO_ERROR)
+ if (dequeueBuffer(nativeWindow, &buffer) != 0)
{
- nativeWindow->cancelBuffer(nativeWindow, buffer, fenceFd);
return NULL;
}
if (gralloc->lock(
gralloc, buffer->handle,
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
- 0, 0, buffer->width, buffer->height, &locked)
- != android::NO_ERROR)
+ 0, 0, buffer->width, buffer->height, &locked) != 0)
{
ALOGE("%s failed to lock buffer %p", __FUNCTION__, buffer);
return NULL;
return;
}
locked = 0;
- if (gralloc->unlock(gralloc, buffer->handle) != android::NO_ERROR)
+ if (gralloc->unlock(gralloc, buffer->handle) != 0)
{
ALOGE("%s: badness unlock failed", __FUNCTION__);
}
return GL_RGB565;
case HAL_PIXEL_FORMAT_YV12:
return SW_YV12_BT601;
- case HAL_PIXEL_FORMAT_BLOB:
- case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
default:
ALOGE("%s badness unsupported HAL format=%x", __FUNCTION__, halFormat);
}
return GL_UNSIGNED_SHORT_5_6_5;
case HAL_PIXEL_FORMAT_YV12:
return GL_UNSIGNED_BYTE;
- case HAL_PIXEL_FORMAT_BLOB:
- case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
default:
ALOGE("%s badness unsupported HAL format=%x", __FUNCTION__, halFormat);
}
-msse2 \
-D__STDC_CONSTANT_MACROS \
-D__STDC_LIMIT_MACROS \
- -std=c++11 \
- -Xclang -fuse-init-array
+ -std=c++11
+
+ifneq (16,${PLATFORM_SDK_VERSION})
+COMMON_CFLAGS += -Xclang -fuse-init-array
+else
+COMMON_CFLAGS += -D__STDC_INT64__
+endif
COMMON_SRC_FILES := \
preprocessor/Diagnostics.cpp \
-DEGL_EGLEXT_PROTOTYPES \
-Wno-unused-parameter \
-Wno-implicit-exception-spec-mismatch \
- -Wno-overloaded-virtual \
- -Xclang -fuse-init-array
+ -Wno-overloaded-virtual
+
+ifneq (16,${PLATFORM_SDK_VERSION})
+COMMON_CFLAGS += -Xclang -fuse-init-array
+else
+COMMON_CFLAGS += -D__STDC_INT64__
+endif
COMMON_SRC_FILES := \
Config.cpp \
if(backBuffer && frameBuffer)\r
{\r
void *source = backBuffer->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);\r
- frameBuffer->flip(source, backBuffer->Surface::getInternalFormat(), backBuffer->getInternalPitchB());\r
+ frameBuffer->flip(source, backBuffer->sw::Surface::getInternalFormat(), backBuffer->getInternalPitchB());\r
backBuffer->unlockInternal();\r
\r
checkForResize();\r
-DGL_GLEXT_PROTOTYPES \
-Wno-unused-parameter \
-Wno-implicit-exception-spec-mismatch \
- -Wno-overloaded-virtual \
- -Xclang -fuse-init-array
+ -Wno-overloaded-virtual
+
+ifneq (16,${PLATFORM_SDK_VERSION})
+COMMON_CFLAGS += -Xclang -fuse-init-array
+else
+COMMON_CFLAGS += -D__STDC_INT64__
+endif
COMMON_SRC_FILES := \
-DGL_GLEXT_PROTOTYPES \
-Wno-unused-parameter \
-Wno-implicit-exception-spec-mismatch \
- -Wno-overloaded-virtual \
- -Xclang -fuse-init-array
+ -Wno-overloaded-virtual
+
+ifneq (16,${PLATFORM_SDK_VERSION})
+COMMON_CFLAGS += -Xclang -fuse-init-array
+else
+COMMON_CFLAGS += -D__STDC_INT64__
+endif
COMMON_SRC_FILES := \
Buffer.cpp \