Merge "Enable clang for libui/libgui/surfaceflinger"

This commit is contained in:
Dan Albert 2014-12-05 17:47:58 +00:00 committed by Gerrit Code Review
commit 5588d9000c
17 changed files with 75 additions and 80 deletions

View File

@ -98,7 +98,7 @@ private:
String8 mStringType;
String8 mRequiredPermission;
int32_t mMaxDelay;
int32_t mFlags;
uint32_t mFlags;
static void flattenString8(void*& buffer, size_t& size, const String8& string8);
static bool unflattenString8(void const*& buffer, size_t& size, String8& outputString8);
};

View File

@ -14,11 +14,13 @@
* limitations under the License.
*/
#ifndef INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP
#warning "FramebufferNativeWindow is deprecated"
#endif
#ifndef ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
#define ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
#warning "FramebufferNativeWindow is deprecated"
#include <stdint.h>
#include <sys/types.h>

View File

@ -72,11 +72,11 @@ public:
GraphicBuffer();
// creates w * h buffer
GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage);
GraphicBuffer(int w, int h, PixelFormat format, int usage);
// create a buffer from an existing handle
GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage,
uint32_t stride, native_handle_t* handle, bool keepOwnership);
GraphicBuffer(int w, int h, PixelFormat format, int usage,
int stride, native_handle_t* handle, bool keepOwnership);
// create a buffer from an existing ANativeWindowBuffer
GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership);
@ -84,15 +84,15 @@ public:
// return status
status_t initCheck() const;
uint32_t getWidth() const { return width; }
uint32_t getHeight() const { return height; }
uint32_t getStride() const { return stride; }
uint32_t getUsage() const { return usage; }
int getWidth() const { return width; }
int getHeight() const { return height; }
int getStride() const { return stride; }
int getUsage() const { return usage; }
PixelFormat getPixelFormat() const { return format; }
Rect getBounds() const { return Rect(width, height); }
uint64_t getId() const { return mId; }
status_t reallocate(uint32_t w, uint32_t h, PixelFormat f, uint32_t usage);
status_t reallocate(int w, int h, PixelFormat f, int usage);
status_t lock(uint32_t usage, void** vaddr);
status_t lock(uint32_t usage, const Rect& rect, void** vaddr);

View File

@ -1,7 +1,10 @@
LOCAL_PATH:= $(call my-dir)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
LOCAL_CLANG := true
LOCAL_CPPFLAGS := -std=c++11
LOCAL_SRC_FILES := \
IGraphicBufferConsumer.cpp \
IConsumerListener.cpp \
BitTube.cpp \
@ -47,7 +50,7 @@ LOCAL_SHARED_LIBRARIES := \
liblog
LOCAL_MODULE:= libgui
LOCAL_MODULE := libgui
ifeq ($(TARGET_BOARD_PLATFORM), tegra)
LOCAL_CFLAGS += -DDONT_USE_FENCE_SYNC

View File

@ -157,7 +157,7 @@ void SensorEventQueue::sendAck(const ASensorEvent* events, int count) {
ssize_t size = ::send(mSensorChannel->getFd(), &mNumAcksToSend, sizeof(mNumAcksToSend),
MSG_DONTWAIT | MSG_NOSIGNAL);
if (size < 0) {
ALOGE("sendAck failure %d %d", size, mNumAcksToSend);
ALOGE("sendAck failure %zd %d", size, mNumAcksToSend);
} else {
mNumAcksToSend = 0;
}

View File

@ -752,14 +752,14 @@ status_t ScreenshotClient::update(const sp<IBinder>& display,
status_t ScreenshotClient::update(const sp<IBinder>& display, Rect sourceCrop,
bool useIdentityTransform) {
return ScreenshotClient::update(display, sourceCrop, 0, 0, 0, -1UL,
return ScreenshotClient::update(display, sourceCrop, 0, 0, 0, -1U,
useIdentityTransform, ISurfaceComposer::eRotateNone);
}
status_t ScreenshotClient::update(const sp<IBinder>& display, Rect sourceCrop,
uint32_t reqWidth, uint32_t reqHeight, bool useIdentityTransform) {
return ScreenshotClient::update(display, sourceCrop, reqWidth, reqHeight,
0, -1UL, useIdentityTransform, ISurfaceComposer::eRotateNone);
0, -1U, useIdentityTransform, ISurfaceComposer::eRotateNone);
}
void ScreenshotClient::release() {

View File

@ -12,10 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
LOCAL_PATH:= $(call my-dir)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
LOCAL_CLANG := true
LOCAL_CPPFLAGS := -std=c++11
LOCAL_SRC_FILES := \
Fence.cpp \
FramebufferNativeWindow.cpp \
FrameStats.cpp \
@ -38,7 +41,7 @@ ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),)
LOCAL_CFLAGS += -DFRAMEBUFFER_FORCE_FORMAT=$(BOARD_FRAMEBUFFER_FORCE_FORMAT)
endif
LOCAL_MODULE:= libui
LOCAL_MODULE := libui
include $(BUILD_SHARED_LIBRARY)

View File

@ -29,7 +29,9 @@
#include <ui/ANativeObjectBase.h>
#include <ui/Fence.h>
#define INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP
#include <ui/FramebufferNativeWindow.h>
#undef INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP
#include <ui/Rect.h>
#include <EGL/egl.h>

View File

@ -45,31 +45,29 @@ GraphicBuffer::GraphicBuffer()
: BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
mInitCheck(NO_ERROR), mId(getUniqueId())
{
width =
height =
stride =
format =
width =
height =
stride =
format =
usage = 0;
handle = NULL;
}
GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
PixelFormat reqFormat, uint32_t reqUsage)
GraphicBuffer::GraphicBuffer(int w, int h, PixelFormat reqFormat, int reqUsage)
: BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
mInitCheck(NO_ERROR), mId(getUniqueId())
{
width =
height =
stride =
format =
width =
height =
stride =
format =
usage = 0;
handle = NULL;
mInitCheck = initSize(w, h, reqFormat, reqUsage);
}
GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
PixelFormat inFormat, uint32_t inUsage,
uint32_t inStride, native_handle_t* inHandle, bool keepOwnership)
GraphicBuffer::GraphicBuffer(int w, int h, PixelFormat inFormat, int inUsage,
int inStride, native_handle_t* inHandle, bool keepOwnership)
: BASE(), mOwner(keepOwnership ? ownHandle : ownNone),
mBufferMapper(GraphicBufferMapper::get()),
mInitCheck(NO_ERROR), mId(getUniqueId())
@ -131,8 +129,7 @@ ANativeWindowBuffer* GraphicBuffer::getNativeBuffer() const
const_cast<GraphicBuffer*>(this));
}
status_t GraphicBuffer::reallocate(uint32_t w, uint32_t h, PixelFormat f,
uint32_t reqUsage)
status_t GraphicBuffer::reallocate(int w, int h, PixelFormat f, int reqUsage)
{
if (mOwner != ownData)
return INVALID_OPERATION;
@ -171,10 +168,10 @@ status_t GraphicBuffer::lock(uint32_t usage, void** vaddr)
status_t GraphicBuffer::lock(uint32_t usage, const Rect& rect, void** vaddr)
{
if (rect.left < 0 || rect.right > this->width ||
if (rect.left < 0 || rect.right > this->width ||
rect.top < 0 || rect.bottom > this->height) {
ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
rect.left, rect.top, rect.right, rect.bottom,
rect.left, rect.top, rect.right, rect.bottom,
this->width, this->height);
return BAD_VALUE;
}
@ -314,7 +311,7 @@ status_t GraphicBuffer::unflatten(
if (numFds >= maxNumber || numInts >= (maxNumber - 10)) {
width = height = stride = format = usage = 0;
handle = NULL;
ALOGE("unflatten: numFds or numInts is too large: %d, %d",
ALOGE("unflatten: numFds or numInts is too large: %zd, %zd",
numFds, numInts);
return BAD_VALUE;
}

View File

@ -1,10 +1,10 @@
LOCAL_PATH:= $(call my-dir)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_SRC_FILES:= \
LOCAL_SRC_FILES := \
Client.cpp \
DisplayDevice.cpp \
DispSync.cpp \
@ -37,7 +37,7 @@ LOCAL_SRC_FILES:= \
RenderEngine/GLES20RenderEngine.cpp
LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
ifeq ($(TARGET_BOARD_PLATFORM),omap4)
@ -84,7 +84,7 @@ else
endif
LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
LOCAL_CFLAGS += -std=c++11
LOCAL_CPPFLAGS := -std=c++11
LOCAL_SHARED_LIBRARIES := \
libcutils \
@ -100,7 +100,7 @@ LOCAL_SHARED_LIBRARIES := \
libgui \
libpowermanager
LOCAL_MODULE:= libsurfaceflinger
LOCAL_MODULE := libsurfaceflinger
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
@ -110,11 +110,13 @@ include $(BUILD_SHARED_LIBRARY)
# build surfaceflinger's executable
include $(CLEAR_VARS)
LOCAL_LDFLAGS := -Wl,--version-script,art/sigchainlib/version-script.txt -Wl,--export-dynamic
LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CPPFLAGS:= -std=c++11
LOCAL_CLANG := true
LOCAL_SRC_FILES:= \
LOCAL_LDFLAGS := -Wl,--version-script,art/sigchainlib/version-script.txt -Wl,--export-dynamic
LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CPPFLAGS := -std=c++11
LOCAL_SRC_FILES := \
main_surfaceflinger.cpp
LOCAL_SHARED_LIBRARIES := \
@ -127,7 +129,7 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
LOCAL_MODULE:= surfaceflinger
LOCAL_MODULE := surfaceflinger
ifdef TARGET_32_BIT_SURFACEFLINGER
LOCAL_32_BIT_ONLY := true
@ -141,9 +143,13 @@ include $(BUILD_EXECUTABLE)
# uses jni which may not be available in PDK
ifneq ($(wildcard libnativehelper/include),)
include $(CLEAR_VARS)
LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_SRC_FILES:= \
LOCAL_CLANG := true
LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CPPFLAGS := -std=c++11
LOCAL_SRC_FILES := \
DdmConnection.cpp
LOCAL_SHARED_LIBRARIES := \
@ -151,7 +157,7 @@ LOCAL_SHARED_LIBRARIES := \
liblog \
libdl
LOCAL_MODULE:= libsurfaceflinger_ddmconnection
LOCAL_MODULE := libsurfaceflinger_ddmconnection
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code

View File

@ -59,12 +59,14 @@ void DdmConnection::start(const char* name) {
}
jint (*JNI_CreateJavaVM)(JavaVM** p_vm, JNIEnv** p_env, void* vm_args);
JNI_CreateJavaVM = (__typeof__(JNI_CreateJavaVM))dlsym(libart_dso, "JNI_CreateJavaVM");
JNI_CreateJavaVM = reinterpret_cast<decltype(JNI_CreateJavaVM)>(
dlsym(libart_dso, "JNI_CreateJavaVM"));
ALOGE_IF(!JNI_CreateJavaVM, "DdmConnection: %s", dlerror());
jint (*registerNatives)(JNIEnv* env, jclass clazz);
registerNatives = (__typeof__(registerNatives))dlsym(libandroid_runtime_dso,
"Java_com_android_internal_util_WithFramework_registerNatives");
registerNatives = reinterpret_cast<decltype(registerNatives)>(
dlsym(libandroid_runtime_dso,
"Java_com_android_internal_util_WithFramework_registerNatives"));
ALOGE_IF(!registerNatives, "DdmConnection: %s", dlerror());
if (!JNI_CreateJavaVM || !registerNatives) {

View File

@ -517,6 +517,6 @@ void DisplayDevice::dump(String8& result) const {
tr[0][2], tr[1][2], tr[2][2]);
String8 surfaceDump;
mDisplaySurface->dump(surfaceDump);
mDisplaySurface->dumpAsString(surfaceDump);
result.append(surfaceDump);
}

View File

@ -70,7 +70,7 @@ public:
// frame's buffer.
virtual void onFrameCommitted() = 0;
virtual void dump(String8& result) const = 0;
virtual void dumpAsString(String8& result) const = 0;
virtual void resizeBuffers(const uint32_t w, const uint32_t h) = 0;

View File

@ -160,23 +160,7 @@ status_t FramebufferSurface::compositionComplete()
return mHwc.fbCompositionComplete();
}
// Since DisplaySurface and ConsumerBase both have a method with this
// signature, results will vary based on the static pointer type the caller is
// using:
// void dump(FrameBufferSurface* fbs, String8& s) {
// // calls FramebufferSurface::dump()
// fbs->dump(s);
//
// // calls ConsumerBase::dump() since it is non-virtual
// static_cast<ConsumerBase*>(fbs)->dump(s);
//
// // calls FramebufferSurface::dump() since it is virtual
// static_cast<DisplaySurface*>(fbs)->dump(s);
// }
// To make sure that all of these end up doing the same thing, we just redirect
// to ConsumerBase::dump() here. It will take the internal lock, and then call
// virtual dumpLocked(), which is where the real work happens.
void FramebufferSurface::dump(String8& result) const {
void FramebufferSurface::dumpAsString(String8& result) const {
ConsumerBase::dump(result);
}

View File

@ -44,10 +44,7 @@ public:
virtual status_t compositionComplete();
virtual status_t advanceFrame();
virtual void onFrameCommitted();
// Implementation of DisplaySurface::dump(). Note that ConsumerBase also
// has a non-virtual dump() with the same signature.
virtual void dump(String8& result) const;
virtual void dumpAsString(String8& result) const;
// Cannot resize a buffers in a FramebufferSurface. Only works with virtual
// displays.

View File

@ -254,7 +254,7 @@ void VirtualDisplaySurface::onFrameCommitted() {
resetPerFrameState();
}
void VirtualDisplaySurface::dump(String8& /* result */) const {
void VirtualDisplaySurface::dumpAsString(String8& /* result */) const {
}
void VirtualDisplaySurface::resizeBuffers(const uint32_t w, const uint32_t h) {

View File

@ -86,8 +86,7 @@ public:
virtual status_t compositionComplete();
virtual status_t advanceFrame();
virtual void onFrameCommitted();
using BBinder::dump;
virtual void dump(String8& result) const;
virtual void dumpAsString(String8& result) const;
virtual void resizeBuffers(const uint32_t w, const uint32_t h);
private: