From af01feafc30152baf8e0a5cfddbf02bd14731fd2 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 24 Feb 2012 18:25:41 -0800 Subject: remove dependency on android_native{s_priv|buffer}.h Change-Id: Ie4b95f7061c240f37c504414259f92d72c4ffc89 --- core/jni/android_app_NativeActivity.cpp | 2 +- core/jni/com_google_android_gles_jni_EGLImpl.cpp | 2 + include/gui/SurfaceTextureClient.h | 4 +- include/media/stagefright/HardwareAPI.h | 2 +- include/private/ui/android_natives_priv.h | 17 ---- include/surfaceflinger/Surface.h | 1 - include/ui/ANativeObjectBase.h | 102 ++++++++++++++++++++ include/ui/EGLNativeSurface.h | 55 ----------- include/ui/FramebufferNativeWindow.h | 8 +- include/ui/GraphicBuffer.h | 7 +- include/ui/android_native_buffer.h | 22 ----- include/ui/egl/android_natives.h | 103 --------------------- libs/rs/driver/rsdGL.cpp | 3 +- libs/ui/FramebufferNativeWindow.cpp | 10 +- libs/ui/GraphicBuffer.cpp | 17 ---- .../colorconversion/SoftwareRenderer.cpp | 2 +- media/libstagefright/include/SoftwareRenderer.h | 2 +- opengl/libagl/TextureObjectManager.cpp | 2 - opengl/libagl/egl.cpp | 6 +- opengl/libagl/texture.cpp | 1 - .../libcameraservice/CameraHardwareInterface.h | 1 - 21 files changed, 124 insertions(+), 245 deletions(-) delete mode 100644 include/private/ui/android_natives_priv.h create mode 100644 include/ui/ANativeObjectBase.h delete mode 100644 include/ui/EGLNativeSurface.h delete mode 100644 include/ui/android_native_buffer.h delete mode 100644 include/ui/egl/android_natives.h diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp index 4b3324b..7c88dfc 100644 --- a/core/jni/android_app_NativeActivity.cpp +++ b/core/jni/android_app_NativeActivity.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index 4fe7600..0f334c3 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include #include diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h index 971a1b8..aa7fe48 100644 --- a/include/gui/SurfaceTextureClient.h +++ b/include/gui/SurfaceTextureClient.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -31,7 +31,7 @@ namespace android { class Surface; class SurfaceTextureClient - : public EGLNativeBase + : public ANativeObjectBase { public: SurfaceTextureClient(const sp& surfaceTexture); diff --git a/include/media/stagefright/HardwareAPI.h b/include/media/stagefright/HardwareAPI.h index 32eed3f..17efd35 100644 --- a/include/media/stagefright/HardwareAPI.h +++ b/include/media/stagefright/HardwareAPI.h @@ -19,7 +19,7 @@ #define HARDWARE_API_H_ #include -#include +#include #include #include diff --git a/include/private/ui/android_natives_priv.h b/include/private/ui/android_natives_priv.h deleted file mode 100644 index 6b9f524..0000000 --- a/include/private/ui/android_natives_priv.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h index 0460bbd..06eff8a 100644 --- a/include/surfaceflinger/Surface.h +++ b/include/surfaceflinger/Surface.h @@ -26,7 +26,6 @@ #include #include -#include #include diff --git a/include/ui/ANativeObjectBase.h b/include/ui/ANativeObjectBase.h new file mode 100644 index 0000000..76e850f --- /dev/null +++ b/include/ui/ANativeObjectBase.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_ANDROID_NATIVES_H +#define ANDROID_ANDROID_NATIVES_H + +#include +#include + +#include +#include + +// --------------------------------------------------------------------------- + +/* FIXME: this is legacy for pixmaps */ +typedef struct egl_native_pixmap_t +{ + int32_t version; /* must be 32 */ + int32_t width; + int32_t height; + int32_t stride; + uint8_t* data; + uint8_t format; + uint8_t rfu[3]; + union { + uint32_t compressedFormat; + int32_t vstride; + }; + int32_t reserved; +} egl_native_pixmap_t; + +/*****************************************************************************/ + +#ifdef __cplusplus + +#include + +namespace android { + +/* + * This helper class turns a ANativeXXX object type into a C++ + * reference-counted object; with proper type conversions. + */ +template +class ANativeObjectBase : public NATIVE_TYPE, public REF +{ +public: + // Disambiguate between the incStrong in REF and NATIVE_TYPE + void incStrong(const void* id) const { + REF::incStrong(id); + } + void decStrong(const void* id) const { + REF::decStrong(id); + } + +protected: + typedef ANativeObjectBase BASE; + ANativeObjectBase() : NATIVE_TYPE(), REF() { + NATIVE_TYPE::common.incRef = incRef; + NATIVE_TYPE::common.decRef = decRef; + } + static inline TYPE* getSelf(NATIVE_TYPE* self) { + return static_cast(self); + } + static inline TYPE const* getSelf(NATIVE_TYPE const* self) { + return static_cast(self); + } + static inline TYPE* getSelf(android_native_base_t* base) { + return getSelf(reinterpret_cast(base)); + } + static inline TYPE const * getSelf(android_native_base_t const* base) { + return getSelf(reinterpret_cast(base)); + } + static void incRef(android_native_base_t* base) { + ANativeObjectBase* self = getSelf(base); + self->incStrong(self); + } + static void decRef(android_native_base_t* base) { + ANativeObjectBase* self = getSelf(base); + self->decStrong(self); + } +}; + +} // namespace android +#endif // __cplusplus + +/*****************************************************************************/ + +#endif /* ANDROID_ANDROID_NATIVES_H */ diff --git a/include/ui/EGLNativeSurface.h b/include/ui/EGLNativeSurface.h deleted file mode 100644 index 7964e7c..0000000 --- a/include/ui/EGLNativeSurface.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_EGL_NATIVE_SURFACE_H -#define ANDROID_EGL_NATIVE_SURFACE_H - -#include -#include - -#include -#include - -#include - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -template -class EGLNativeSurface : public egl_native_window_t, public LightRefBase -{ -public: - EGLNativeSurface() { - memset(egl_native_window_t::reserved, 0, - sizeof(egl_native_window_t::reserved)); - memset(egl_native_window_t::reserved_proc, 0, - sizeof(egl_native_window_t::reserved_proc)); - memset(egl_native_window_t::oem, 0, - sizeof(egl_native_window_t::oem)); - } -protected: - EGLNativeSurface& operator = (const EGLNativeSurface& rhs); - EGLNativeSurface(const EGLNativeSurface& rhs); - inline ~EGLNativeSurface() { }; -}; - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#endif // ANDROID_EGL_SURFACE_H - diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h index 302d012..b202b95 100644 --- a/include/ui/FramebufferNativeWindow.h +++ b/include/ui/FramebufferNativeWindow.h @@ -24,11 +24,9 @@ #include #include -#include - -#include -#include +#include +#include #define NUM_FRAME_BUFFERS 2 @@ -44,7 +42,7 @@ class NativeBuffer; // --------------------------------------------------------------------------- class FramebufferNativeWindow - : public EGLNativeBase< + : public ANativeObjectBase< ANativeWindow, FramebufferNativeWindow, LightRefBase > diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h index 6ab01f4..f318cd8 100644 --- a/include/ui/GraphicBuffer.h +++ b/include/ui/GraphicBuffer.h @@ -20,11 +20,11 @@ #include #include -#include +#include #include #include #include -#include + struct ANativeWindowBuffer; @@ -37,7 +37,7 @@ class GraphicBufferMapper; // =========================================================================== class GraphicBuffer - : public EGLNativeBase< + : public ANativeObjectBase< ANativeWindowBuffer, GraphicBuffer, LightRefBase >, public Flattenable @@ -93,7 +93,6 @@ public: status_t lock(uint32_t usage, void** vaddr); status_t lock(uint32_t usage, const Rect& rect, void** vaddr); - status_t lock(GGLSurface* surface, uint32_t usage); status_t unlock(); ANativeWindowBuffer* getNativeBuffer() const; diff --git a/include/ui/android_native_buffer.h b/include/ui/android_native_buffer.h deleted file mode 100644 index b6e1db4..0000000 --- a/include/ui/android_native_buffer.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_ANDROID_NATIVES_PRIV_H -#define ANDROID_ANDROID_NATIVES_PRIV_H - -#include - -#endif /* ANDROID_ANDROID_NATIVES_PRIV_H */ diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h deleted file mode 100644 index 9ac50a5..0000000 --- a/include/ui/egl/android_natives.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_ANDROID_NATIVES_H -#define ANDROID_ANDROID_NATIVES_H - -#include -#include - -#include -#include -// FIXME: remove this header, it's for legacy use. native_window is pulled from frameworks/base/native/include/android/ -#include -// --------------------------------------------------------------------------- - -/* FIXME: this is legacy for pixmaps */ -typedef struct egl_native_pixmap_t -{ - int32_t version; /* must be 32 */ - int32_t width; - int32_t height; - int32_t stride; - uint8_t* data; - uint8_t format; - uint8_t rfu[3]; - union { - uint32_t compressedFormat; - int32_t vstride; - }; - int32_t reserved; -} egl_native_pixmap_t; - -/*****************************************************************************/ - -#ifdef __cplusplus - -#include - -namespace android { - -/* - * This helper class turns an EGL android_native_xxx type into a C++ - * reference-counted object; with proper type conversions. - */ -template -class EGLNativeBase : public NATIVE_TYPE, public REF -{ -public: - // Disambiguate between the incStrong in REF and NATIVE_TYPE - void incStrong(const void* id) const { - REF::incStrong(id); - } - void decStrong(const void* id) const { - REF::decStrong(id); - } - -protected: - typedef EGLNativeBase BASE; - EGLNativeBase() : NATIVE_TYPE(), REF() { - NATIVE_TYPE::common.incRef = incRef; - NATIVE_TYPE::common.decRef = decRef; - } - static inline TYPE* getSelf(NATIVE_TYPE* self) { - return static_cast(self); - } - static inline TYPE const* getSelf(NATIVE_TYPE const* self) { - return static_cast(self); - } - static inline TYPE* getSelf(android_native_base_t* base) { - return getSelf(reinterpret_cast(base)); - } - static inline TYPE const * getSelf(android_native_base_t const* base) { - return getSelf(reinterpret_cast(base)); - } - static void incRef(android_native_base_t* base) { - EGLNativeBase* self = getSelf(base); - self->incStrong(self); - } - static void decRef(android_native_base_t* base) { - EGLNativeBase* self = getSelf(base); - self->decStrong(self); - } -}; - -} // namespace android -#endif // __cplusplus - -/*****************************************************************************/ - -#endif /* ANDROID_ANDROID_NATIVES_H */ diff --git a/libs/rs/driver/rsdGL.cpp b/libs/rs/driver/rsdGL.cpp index 7c66857..8033b08 100644 --- a/libs/rs/driver/rsdGL.cpp +++ b/libs/rs/driver/rsdGL.cpp @@ -16,7 +16,8 @@ #include #include -#include + +#include #include #include diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index 26d4823..dec99b6 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -27,25 +27,21 @@ #include #include -#include +#include #include +#include #include -#include -#include - #include #include -#include - // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- class NativeBuffer - : public EGLNativeBase< + : public ANativeObjectBase< ANativeWindowBuffer, NativeBuffer, LightRefBase > diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index f549a37..57063e5 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -28,8 +28,6 @@ #include #include -#include - namespace android { // =========================================================================== @@ -182,21 +180,6 @@ status_t GraphicBuffer::unlock() return res; } -status_t GraphicBuffer::lock(GGLSurface* sur, uint32_t usage) -{ - void* vaddr; - status_t res = GraphicBuffer::lock(usage, &vaddr); - if (res == NO_ERROR && sur) { - sur->version = sizeof(GGLSurface); - sur->width = width; - sur->height = height; - sur->stride = stride; - sur->format = format; - sur->data = static_cast(vaddr); - } - return res; -} - size_t GraphicBuffer::getFlattenedSize() const { return (8 + (handle ? handle->numInts : 0))*sizeof(int); } diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp index e892f92..297f2c9 100644 --- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp +++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include diff --git a/media/libstagefright/include/SoftwareRenderer.h b/media/libstagefright/include/SoftwareRenderer.h index 8f2ea95..7ab0042 100644 --- a/media/libstagefright/include/SoftwareRenderer.h +++ b/media/libstagefright/include/SoftwareRenderer.h @@ -20,7 +20,7 @@ #include #include -#include +#include namespace android { diff --git a/opengl/libagl/TextureObjectManager.cpp b/opengl/libagl/TextureObjectManager.cpp index 6a006aa..06d45cc 100644 --- a/opengl/libagl/TextureObjectManager.cpp +++ b/opengl/libagl/TextureObjectManager.cpp @@ -19,8 +19,6 @@ #include "context.h" #include "TextureObjectManager.h" -#include - namespace android { // ---------------------------------------------------------------------------- diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index eb55bee..92d32a2 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -39,8 +40,6 @@ #include #include -#include - #include "context.h" #include "state.h" #include "texture.h" @@ -49,13 +48,14 @@ #undef NELEM #define NELEM(x) (sizeof(x)/sizeof(*(x))) +// ---------------------------------------------------------------------------- EGLBoolean EGLAPI eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height); - // ---------------------------------------------------------------------------- namespace android { + // ---------------------------------------------------------------------------- const unsigned int NUM_DISPLAYS = 1; diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp index 88e8651..08536df 100644 --- a/opengl/libagl/texture.cpp +++ b/opengl/libagl/texture.cpp @@ -23,7 +23,6 @@ #include "texture.h" #include "TextureObjectManager.h" -#include #include namespace android { diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h index 2ac69f7..78e225f 100644 --- a/services/camera/libcameraservice/CameraHardwareInterface.h +++ b/services/camera/libcameraservice/CameraHardwareInterface.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include -- cgit v1.1