diff options
Diffstat (limited to 'media/omx-plugin/include/ics/ui')
-rw-r--r-- | media/omx-plugin/include/ics/ui/GraphicBuffer.h | 159 | ||||
-rw-r--r-- | media/omx-plugin/include/ics/ui/PixelFormat.h | 137 | ||||
-rw-r--r-- | media/omx-plugin/include/ics/ui/Point.h | 87 | ||||
-rw-r--r-- | media/omx-plugin/include/ics/ui/Rect.h | 149 | ||||
-rw-r--r-- | media/omx-plugin/include/ics/ui/android_native_buffer.h | 22 | ||||
-rw-r--r-- | media/omx-plugin/include/ics/ui/egl/android_natives.h | 103 |
6 files changed, 0 insertions, 657 deletions
diff --git a/media/omx-plugin/include/ics/ui/GraphicBuffer.h b/media/omx-plugin/include/ics/ui/GraphicBuffer.h deleted file mode 100644 index 6ab01f4c9..000000000 --- a/media/omx-plugin/include/ics/ui/GraphicBuffer.h +++ /dev/null @@ -1,159 +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_GRAPHIC_BUFFER_H -#define ANDROID_GRAPHIC_BUFFER_H - -#include <stdint.h> -#include <sys/types.h> - -#include <ui/android_native_buffer.h> -#include <ui/PixelFormat.h> -#include <ui/Rect.h> -#include <utils/Flattenable.h> -#include <pixelflinger/pixelflinger.h> - -struct ANativeWindowBuffer; - -namespace android { - -class GraphicBufferMapper; - -// =========================================================================== -// GraphicBuffer -// =========================================================================== - -class GraphicBuffer - : public EGLNativeBase< - ANativeWindowBuffer, - GraphicBuffer, - LightRefBase<GraphicBuffer> >, public Flattenable -{ -public: - - enum { - USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER, - USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY, - USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN, - USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK, - - USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER, - USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY, - USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN, - USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK, - - USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, - - USAGE_PROTECTED = GRALLOC_USAGE_PROTECTED, - - USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE, - USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER, - USAGE_HW_2D = GRALLOC_USAGE_HW_2D, - USAGE_HW_COMPOSER = GRALLOC_USAGE_HW_COMPOSER, - USAGE_HW_VIDEO_ENCODER = GRALLOC_USAGE_HW_VIDEO_ENCODER, - USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK - }; - - GraphicBuffer(); - - // creates w * h buffer - GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t 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); - - // create a buffer from an existing ANativeWindowBuffer - GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership); - - // 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; } - PixelFormat getPixelFormat() const { return format; } - Rect getBounds() const { return Rect(width, height); } - - status_t reallocate(uint32_t w, uint32_t h, PixelFormat f, uint32_t usage); - - 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; - - void setIndex(int index); - int getIndex() const; - - // for debugging - static void dumpAllocationsToSystemLog(); - -private: - virtual ~GraphicBuffer(); - - enum { - ownNone = 0, - ownHandle = 1, - ownData = 2, - }; - - inline const GraphicBufferMapper& getBufferMapper() const { - return mBufferMapper; - } - inline GraphicBufferMapper& getBufferMapper() { - return mBufferMapper; - } - uint8_t mOwner; - -private: - friend class Surface; - friend class BpSurface; - friend class BnSurface; - friend class SurfaceTextureClient; - friend class LightRefBase<GraphicBuffer>; - GraphicBuffer(const GraphicBuffer& rhs); - GraphicBuffer& operator = (const GraphicBuffer& rhs); - const GraphicBuffer& operator = (const GraphicBuffer& rhs) const; - - status_t initSize(uint32_t w, uint32_t h, PixelFormat format, - uint32_t usage); - - void free_handle(); - - // Flattenable interface - size_t getFlattenedSize() const; - size_t getFdCount() const; - status_t flatten(void* buffer, size_t size, - int fds[], size_t count) const; - status_t unflatten(void const* buffer, size_t size, - int fds[], size_t count); - - - GraphicBufferMapper& mBufferMapper; - ssize_t mInitCheck; - int mIndex; - - // If we're wrapping another buffer then this reference will make sure it - // doesn't get freed. - sp<ANativeWindowBuffer> mWrappedBuffer; -}; - -}; // namespace android - -#endif // ANDROID_GRAPHIC_BUFFER_H diff --git a/media/omx-plugin/include/ics/ui/PixelFormat.h b/media/omx-plugin/include/ics/ui/PixelFormat.h deleted file mode 100644 index 848c5a114..000000000 --- a/media/omx-plugin/include/ics/ui/PixelFormat.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2005 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. - */ - -// - -// Pixel formats used across the system. -// These formats might not all be supported by all renderers, for instance -// skia or SurfaceFlinger are not required to support all of these formats -// (either as source or destination) - -// XXX: we should consolidate these formats and skia's - -#ifndef UI_PIXELFORMAT_H -#define UI_PIXELFORMAT_H - -#include <stdint.h> -#include <sys/types.h> -#include <utils/Errors.h> -#include <pixelflinger/format.h> -#include <hardware/hardware.h> - -namespace android { - -enum { - // - // these constants need to match those - // in graphics/PixelFormat.java & pixelflinger/format.h - // - PIXEL_FORMAT_UNKNOWN = 0, - PIXEL_FORMAT_NONE = 0, - - // logical pixel formats used by the SurfaceFlinger ----------------------- - PIXEL_FORMAT_CUSTOM = -4, - // Custom pixel-format described by a PixelFormatInfo structure - - PIXEL_FORMAT_TRANSLUCENT = -3, - // System chooses a format that supports translucency (many alpha bits) - - PIXEL_FORMAT_TRANSPARENT = -2, - // System chooses a format that supports transparency - // (at least 1 alpha bit) - - PIXEL_FORMAT_OPAQUE = -1, - // System chooses an opaque format (no alpha bits required) - - // real pixel formats supported for rendering ----------------------------- - - PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA - PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0 - PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB - PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB - PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA - PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB - PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB - PIXEL_FORMAT_A_8 = GGL_PIXEL_FORMAT_A_8, // 8-bit A - PIXEL_FORMAT_L_8 = GGL_PIXEL_FORMAT_L_8, // 8-bit L (R=G=B=L) - PIXEL_FORMAT_LA_88 = GGL_PIXEL_FORMAT_LA_88, // 16-bit LA - PIXEL_FORMAT_RGB_332 = GGL_PIXEL_FORMAT_RGB_332, // 8-bit RGB - - // New formats can be added if they're also defined in - // pixelflinger/format.h -}; - -typedef int32_t PixelFormat; - -struct PixelFormatInfo -{ - enum { - INDEX_ALPHA = 0, - INDEX_RED = 1, - INDEX_GREEN = 2, - INDEX_BLUE = 3 - }; - - enum { // components - ALPHA = 1, - RGB = 2, - RGBA = 3, - LUMINANCE = 4, - LUMINANCE_ALPHA = 5, - OTHER = 0xFF - }; - - struct szinfo { - uint8_t h; - uint8_t l; - }; - - inline PixelFormatInfo() : version(sizeof(PixelFormatInfo)) { } - size_t getScanlineSize(unsigned int width) const; - size_t getSize(size_t ci) const { - return (ci <= 3) ? (cinfo[ci].h - cinfo[ci].l) : 0; - } - size_t version; - PixelFormat format; - size_t bytesPerPixel; - size_t bitsPerPixel; - union { - szinfo cinfo[4]; - struct { - uint8_t h_alpha; - uint8_t l_alpha; - uint8_t h_red; - uint8_t l_red; - uint8_t h_green; - uint8_t l_green; - uint8_t h_blue; - uint8_t l_blue; - }; - }; - uint8_t components; - uint8_t reserved0[3]; - uint32_t reserved1; -}; - -// Consider caching the results of these functions are they're not -// guaranteed to be fast. -ssize_t bytesPerPixel(PixelFormat format); -ssize_t bitsPerPixel(PixelFormat format); -status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info); - -}; // namespace android - -#endif // UI_PIXELFORMAT_H diff --git a/media/omx-plugin/include/ics/ui/Point.h b/media/omx-plugin/include/ics/ui/Point.h deleted file mode 100644 index 1653120a6..000000000 --- a/media/omx-plugin/include/ics/ui/Point.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2006 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_UI_POINT -#define ANDROID_UI_POINT - -#include <utils/TypeHelpers.h> - -namespace android { - -class Point -{ -public: - int x; - int y; - - // we don't provide copy-ctor and operator= on purpose - // because we want the compiler generated versions - - // Default constructor doesn't initialize the Point - inline Point() { - } - inline Point(int x, int y) : x(x), y(y) { - } - - inline bool operator == (const Point& rhs) const { - return (x == rhs.x) && (y == rhs.y); - } - inline bool operator != (const Point& rhs) const { - return !operator == (rhs); - } - - inline bool isOrigin() const { - return !(x|y); - } - - // operator < defines an order which allows to use points in sorted - // vectors. - bool operator < (const Point& rhs) const { - return y<rhs.y || (y==rhs.y && x<rhs.x); - } - - inline Point& operator - () { - x = -x; - y = -y; - return *this; - } - - inline Point& operator += (const Point& rhs) { - x += rhs.x; - y += rhs.y; - return *this; - } - inline Point& operator -= (const Point& rhs) { - x -= rhs.x; - y -= rhs.y; - return *this; - } - - const Point operator + (const Point& rhs) const { - const Point result(x+rhs.x, y+rhs.y); - return result; - } - const Point operator - (const Point& rhs) const { - const Point result(x-rhs.x, y-rhs.y); - return result; - } -}; - -ANDROID_BASIC_TYPES_TRAITS(Point) - -}; // namespace android - -#endif // ANDROID_UI_POINT diff --git a/media/omx-plugin/include/ics/ui/Rect.h b/media/omx-plugin/include/ics/ui/Rect.h deleted file mode 100644 index 9e98bc562..000000000 --- a/media/omx-plugin/include/ics/ui/Rect.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2006 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_UI_RECT -#define ANDROID_UI_RECT - -#include <utils/TypeHelpers.h> -#include <ui/Point.h> - -#include <android/rect.h> - -namespace android { - -class Rect : public ARect -{ -public: - typedef ARect::value_type value_type; - - // we don't provide copy-ctor and operator= on purpose - // because we want the compiler generated versions - - inline Rect() { - } - inline Rect(int32_t w, int32_t h) { - left = top = 0; right = w; bottom = h; - } - inline Rect(int32_t l, int32_t t, int32_t r, int32_t b) { - left = l; top = t; right = r; bottom = b; - } - inline Rect(const Point& lt, const Point& rb) { - left = lt.x; top = lt.y; right = rb.x; bottom = rb.y; - } - - void makeInvalid(); - - inline void clear() { - left = top = right = bottom = 0; - } - - // a valid rectangle has a non negative width and height - inline bool isValid() const { - return (width()>=0) && (height()>=0); - } - - // an empty rect has a zero width or height, or is invalid - inline bool isEmpty() const { - return (width()<=0) || (height()<=0); - } - - inline void set(const Rect& rhs) { - operator = (rhs); - } - - // rectangle's width - inline int32_t width() const { - return right-left; - } - - // rectangle's height - inline int32_t height() const { - return bottom-top; - } - - void setLeftTop(const Point& lt) { - left = lt.x; - top = lt.y; - } - - void setRightBottom(const Point& rb) { - right = rb.x; - bottom = rb.y; - } - - // the following 4 functions return the 4 corners of the rect as Point - Point leftTop() const { - return Point(left, top); - } - Point rightBottom() const { - return Point(right, bottom); - } - Point rightTop() const { - return Point(right, top); - } - Point leftBottom() const { - return Point(left, bottom); - } - - // comparisons - inline bool operator == (const Rect& rhs) const { - return (left == rhs.left) && (top == rhs.top) && - (right == rhs.right) && (bottom == rhs.bottom); - } - - inline bool operator != (const Rect& rhs) const { - return !operator == (rhs); - } - - // operator < defines an order which allows to use rectangles in sorted - // vectors. - bool operator < (const Rect& rhs) const; - - Rect& offsetToOrigin() { - right -= left; - bottom -= top; - left = top = 0; - return *this; - } - Rect& offsetTo(const Point& p) { - return offsetTo(p.x, p.y); - } - Rect& offsetBy(const Point& dp) { - return offsetBy(dp.x, dp.y); - } - Rect& operator += (const Point& rhs) { - return offsetBy(rhs.x, rhs.y); - } - Rect& operator -= (const Point& rhs) { - return offsetBy(-rhs.x, -rhs.y); - } - const Rect operator + (const Point& rhs) const; - const Rect operator - (const Point& rhs) const; - - void translate(int32_t dx, int32_t dy) { // legacy, don't use. - offsetBy(dx, dy); - } - - Rect& offsetTo(int32_t x, int32_t y); - Rect& offsetBy(int32_t x, int32_t y); - bool intersect(const Rect& with, Rect* result) const; -}; - -ANDROID_BASIC_TYPES_TRAITS(Rect) - -}; // namespace android - -#endif // ANDROID_UI_RECT diff --git a/media/omx-plugin/include/ics/ui/android_native_buffer.h b/media/omx-plugin/include/ics/ui/android_native_buffer.h deleted file mode 100644 index b6e1db460..000000000 --- a/media/omx-plugin/include/ics/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 <ui/egl/android_natives.h> - -#endif /* ANDROID_ANDROID_NATIVES_PRIV_H */ diff --git a/media/omx-plugin/include/ics/ui/egl/android_natives.h b/media/omx-plugin/include/ics/ui/egl/android_natives.h deleted file mode 100644 index 9ac50a5a3..000000000 --- a/media/omx-plugin/include/ics/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 <sys/types.h> -#include <string.h> - -#include <hardware/gralloc.h> -#include <system/window.h> -// FIXME: remove this header, it's for legacy use. native_window is pulled from frameworks/base/native/include/android/ -#include <android/native_window.h> -// --------------------------------------------------------------------------- - -/* 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 <utils/RefBase.h> - -namespace android { - -/* - * This helper class turns an EGL android_native_xxx type into a C++ - * reference-counted object; with proper type conversions. - */ -template <typename NATIVE_TYPE, typename TYPE, typename REF> -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<NATIVE_TYPE, TYPE, REF> 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<TYPE*>(self); - } - static inline TYPE const* getSelf(NATIVE_TYPE const* self) { - return static_cast<TYPE const *>(self); - } - static inline TYPE* getSelf(android_native_base_t* base) { - return getSelf(reinterpret_cast<NATIVE_TYPE*>(base)); - } - static inline TYPE const * getSelf(android_native_base_t const* base) { - return getSelf(reinterpret_cast<NATIVE_TYPE const*>(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 */ |