Commit 3b876b94 by Greg Hartman Committed by Nicolas Capens

Fixes for JBMR0 compile (API 16)

Change-Id: Ibb2ebd66116f3dfd0008217153006bd6c7a49b9e Reviewed-on: https://swiftshader-review.googlesource.com/4322Reviewed-by: 's avatarGreg Hartman <ghartman@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 0b916198
......@@ -82,12 +82,28 @@ COMMON_SRC_FILES += \
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
......
......@@ -399,8 +399,13 @@ LOCAL_SRC_FILES += \
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)
......@@ -22,7 +48,7 @@ namespace sw
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);
......@@ -33,7 +59,7 @@ namespace sw
copy(source, sourceFormat, sourceStride);
if (buffer)
{
nativeWindow->queueBuffer(nativeWindow, buffer, -1);
queueBuffer(nativeWindow, buffer, -1);
if (locked)
{
locked = 0;
......@@ -45,16 +71,8 @@ namespace sw
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;
}
......@@ -63,8 +81,7 @@ namespace sw
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;
......@@ -99,7 +116,7 @@ namespace sw
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__);
}
......
......@@ -26,8 +26,6 @@ GLenum GLPixelFormatFromAndroid(int halFormat)
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);
}
......@@ -48,8 +46,6 @@ GLenum GLPixelTypeFromAndroid(int 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);
}
......
......@@ -24,8 +24,13 @@ COMMON_CFLAGS := \
-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 \
......
......@@ -7,8 +7,13 @@ COMMON_CFLAGS := \
-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 \
......
......@@ -257,7 +257,7 @@ void WindowSurface::swap()
if(backBuffer && frameBuffer)
{
void *source = backBuffer->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
frameBuffer->flip(source, backBuffer->Surface::getInternalFormat(), backBuffer->getInternalPitchB());
frameBuffer->flip(source, backBuffer->sw::Surface::getInternalFormat(), backBuffer->getInternalPitchB());
backBuffer->unlockInternal();
checkForResize();
......
......@@ -13,8 +13,13 @@ COMMON_CFLAGS := \
-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 := \
......
......@@ -12,8 +12,13 @@ COMMON_CFLAGS := \
-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 \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment