diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:51:23 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:51:23 -0800 |
commit | 276293246ea9cbc0a578a7697cc48930376ec0e9 (patch) | |
tree | 03804488c60dda65699333d2311c8d1842ec4b65 /include | |
parent | e09fd9e819c23dc90bca68375645e15544861330 (diff) | |
download | frameworks_native-276293246ea9cbc0a578a7697cc48930376ec0e9.zip frameworks_native-276293246ea9cbc0a578a7697cc48930376ec0e9.tar.gz frameworks_native-276293246ea9cbc0a578a7697cc48930376ec0e9.tar.bz2 |
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'include')
-rw-r--r-- | include/ui/Camera.h | 5 | ||||
-rw-r--r-- | include/ui/CameraHardwareInterface.h | 5 | ||||
-rw-r--r-- | include/ui/EGLNativeSurface.h | 13 | ||||
-rw-r--r-- | include/ui/ICamera.h | 9 | ||||
-rw-r--r-- | include/ui/IOverlay.h | 2 | ||||
-rw-r--r-- | include/ui/ISurface.h | 4 | ||||
-rw-r--r-- | include/ui/Overlay.h | 78 | ||||
-rw-r--r-- | include/ui/PixelFormat.h | 4 | ||||
-rw-r--r-- | include/ui/Region.h | 2 | ||||
-rw-r--r-- | include/utils/MemoryHeapBase.h | 5 | ||||
-rw-r--r-- | include/utils/RefBase.h | 24 |
11 files changed, 103 insertions, 48 deletions
diff --git a/include/ui/Camera.h b/include/ui/Camera.h index 124f07f..44acce5 100644 --- a/include/ui/Camera.h +++ b/include/ui/Camera.h @@ -78,6 +78,8 @@ public: status_t reconnect(); void disconnect(); + status_t lock(); + status_t unlock(); status_t getStatus() { return mStatus; } @@ -91,6 +93,9 @@ public: // stop preview mode void stopPreview(); + // get preview state + bool previewEnabled(); + // autoFocus - status returned from callback status_t autoFocus(); diff --git a/include/ui/CameraHardwareInterface.h b/include/ui/CameraHardwareInterface.h index 14ac96e..2bd53dd 100644 --- a/include/ui/CameraHardwareInterface.h +++ b/include/ui/CameraHardwareInterface.h @@ -96,6 +96,11 @@ public: virtual void stopPreview() = 0; /** + * Returns true if preview is enabled. + */ + virtual bool previewEnabled() = 0; + + /** * Start auto focus, the callback routine is called * once when focusing is complete. autoFocus() will * be called again if another auto focus is needed. diff --git a/include/ui/EGLNativeSurface.h b/include/ui/EGLNativeSurface.h index 7c9ce99..c303cd8 100644 --- a/include/ui/EGLNativeSurface.h +++ b/include/ui/EGLNativeSurface.h @@ -30,10 +30,10 @@ namespace android { // --------------------------------------------------------------------------- template <class TYPE> -class EGLNativeSurface : public egl_native_window_t +class EGLNativeSurface : public egl_native_window_t, public LightRefBase<TYPE> { public: - EGLNativeSurface() : mCount(0) { + EGLNativeSurface() { memset(egl_native_window_t::reserved, 0, sizeof(egl_native_window_t::reserved)); memset(egl_native_window_t::reserved_proc, 0, @@ -41,19 +41,10 @@ public: memset(egl_native_window_t::oem, 0, sizeof(egl_native_window_t::oem)); } - inline void incStrong(void*) const { - android_atomic_inc(&mCount); - } - inline void decStrong(void*) const { - if (android_atomic_dec(&mCount) == 1) { - delete static_cast<const TYPE*>(this); - } - } protected: EGLNativeSurface& operator = (const EGLNativeSurface& rhs); EGLNativeSurface(const EGLNativeSurface& rhs); inline ~EGLNativeSurface() { }; - mutable volatile int32_t mCount; }; // --------------------------------------------------------------------------- diff --git a/include/ui/ICamera.h b/include/ui/ICamera.h index 99c0d86..ea2fcee 100644 --- a/include/ui/ICamera.h +++ b/include/ui/ICamera.h @@ -39,6 +39,12 @@ public: // connect new client with existing camera remote virtual status_t connect(const sp<ICameraClient>& client) = 0; + // prevent other processes from using this ICamera interface + virtual status_t lock() = 0; + + // allow other processes to use this ICamera interface + virtual status_t unlock() = 0; + // pass the buffered ISurface to the camera service virtual status_t setPreviewDisplay(const sp<ISurface>& surface) = 0; @@ -52,6 +58,9 @@ public: // stop preview mode virtual void stopPreview() = 0; + // get preview state + virtual bool previewEnabled() = 0; + // auto focus virtual status_t autoFocus() = 0; diff --git a/include/ui/IOverlay.h b/include/ui/IOverlay.h index 323ff07..699b1b0 100644 --- a/include/ui/IOverlay.h +++ b/include/ui/IOverlay.h @@ -33,8 +33,6 @@ public: DECLARE_META_INTERFACE(Overlay); virtual void destroy() = 0; // one-way - - virtual ssize_t swapBuffers() = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/ui/ISurface.h b/include/ui/ISurface.h index ff031d5..9a7383c 100644 --- a/include/ui/ISurface.h +++ b/include/ui/ISurface.h @@ -30,7 +30,7 @@ namespace android { typedef int32_t SurfaceID; class IMemoryHeap; -class Overlay; +class OverlayRef; class ISurface : public IInterface { @@ -44,7 +44,7 @@ public: virtual void unregisterBuffers() = 0; - virtual sp<Overlay> createOverlay( + virtual sp<OverlayRef> createOverlay( uint32_t w, uint32_t h, int32_t format) = 0; }; diff --git a/include/ui/Overlay.h b/include/ui/Overlay.h index f24780f..23cdee8 100644 --- a/include/ui/Overlay.h +++ b/include/ui/Overlay.h @@ -23,62 +23,82 @@ #include <utils/Errors.h> #include <utils/IInterface.h> #include <utils/RefBase.h> +#include <utils/threads.h> + #include <ui/PixelFormat.h> +#include <ui/IOverlay.h> #include <hardware/overlay.h> namespace android { -class IOverlay; class IMemory; class IMemoryHeap; +// ---------------------------------------------------------------------------- + +class OverlayRef : public LightRefBase<OverlayRef> +{ +public: + OverlayRef(overlay_handle_t const*, const sp<IOverlay>&, + uint32_t w, uint32_t h, int32_t f, uint32_t ws, uint32_t hs); + + static sp<OverlayRef> readFromParcel(const Parcel& data); + static status_t writeToParcel(Parcel* reply, const sp<OverlayRef>& o); + +private: + friend class LightRefBase<OverlayRef>; + friend class Overlay; + + OverlayRef(); + virtual ~OverlayRef(); + + overlay_handle_t const *mOverlayHandle; + sp<IOverlay> mOverlayChanel; + uint32_t mWidth; + uint32_t mHeight; + int32_t mFormat; + int32_t mWidthStride; + int32_t mHeightStride; + bool mOwnHandle; +}; + +// ---------------------------------------------------------------------------- + class Overlay : public virtual RefBase { public: - Overlay(overlay_t* overlay, - const sp<IOverlay>& o, const sp<IMemoryHeap>& heap); + Overlay(const sp<OverlayRef>& overlayRef); /* destroys this overlay */ void destroy(); - /* post/swaps buffers */ - status_t swapBuffers(); - /* get the HAL handle for this overlay */ overlay_handle_t const* getHandleRef() const; - - /* returns the offset of the current buffer */ - size_t getBufferOffset() const; - - /* returns a heap to this overlay. this may not be supported. */ - sp<IMemoryHeap> getHeap() const; - + + /* blocks until an overlay buffer is available and return that buffer. */ + overlay_buffer_t dequeueBuffer(); + + /* release the overlay buffer and post it */ + int queueBuffer(overlay_buffer_t buffer); + + /* returns the address of a given buffer if supported, NULL otherwise. */ + void* getBufferAddress(overlay_buffer_t buffer); + /* get physical informations about the overlay */ uint32_t getWidth() const; uint32_t getHeight() const; int32_t getFormat() const; int32_t getWidthStride() const; int32_t getHeightStride() const; - - static sp<Overlay> readFromParcel(const Parcel& data); - static status_t writeToParcel(Parcel* reply, const sp<Overlay>& o); - + status_t getStatus() const; + private: - Overlay(overlay_handle_t*, const sp<IOverlay>&, const sp<IMemoryHeap>&, - uint32_t w, uint32_t h, int32_t f, uint32_t ws, uint32_t hs); - virtual ~Overlay(); - sp<IOverlay> mOverlay; - sp<IMemoryHeap> mHeap; - size_t mCurrentBufferOffset; - overlay_handle_t const *mOverlayHandle; - uint32_t mWidth; - uint32_t mHeight; - int32_t mFormat; - int32_t mWidthStride; - int32_t mHeightStride; + sp<OverlayRef> mOverlayRef; + overlay_data_device_t *mOverlayData; + status_t mStatus; }; // ---------------------------------------------------------------------------- diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h index c61df32..b65c959 100644 --- a/include/ui/PixelFormat.h +++ b/include/ui/PixelFormat.h @@ -43,7 +43,7 @@ enum { // logical pixel formats used by the SurfaceFlinger ----------------------- PIXEL_FORMAT_CUSTOM = -4, - // Custom pixel-format described by a PixelFormatInfo sructure + // Custom pixel-format described by a PixelFormatInfo structure PIXEL_FORMAT_TRANSLUCENT = -3, // System chooses a format that supports translucency (many alpha bits) @@ -96,7 +96,7 @@ struct PixelFormatInfo uint32_t reserved[2]; }; -// considere caching the results of these functions are they're not +// 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); diff --git a/include/ui/Region.h b/include/ui/Region.h index a0c4608..7689673 100644 --- a/include/ui/Region.h +++ b/include/ui/Region.h @@ -27,7 +27,7 @@ #include <hardware/copybit.h> -#include <corecg/SkRegion.h> +#include <core/SkRegion.h> namespace android { // --------------------------------------------------------------------------- diff --git a/include/utils/MemoryHeapBase.h b/include/utils/MemoryHeapBase.h index ff89738..574acf4 100644 --- a/include/utils/MemoryHeapBase.h +++ b/include/utils/MemoryHeapBase.h @@ -32,7 +32,10 @@ class MemoryHeapBase : public virtual BnMemoryHeap public: enum { READ_ONLY = IMemoryHeap::READ_ONLY, - MAP_ONCE = IMemoryHeap::MAP_ONCE + MAP_ONCE = IMemoryHeap::MAP_ONCE, + // memory won't be mapped locally, but will be mapped in the remote + // process. + DONT_MAP_LOCALLY = 0x00000100 }; /* diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h index e37b56f..cbda0fd 100644 --- a/include/utils/RefBase.h +++ b/include/utils/RefBase.h @@ -17,6 +17,7 @@ #ifndef ANDROID_REF_BASE_H #define ANDROID_REF_BASE_H +#include <cutils/atomic.h> #include <utils/TextOutput.h> #include <stdint.h> @@ -142,6 +143,29 @@ private: // --------------------------------------------------------------------------- +template <class T> +class LightRefBase +{ +public: + inline LightRefBase() : mCount(0) { } + inline void incStrong(const void* id) const { + android_atomic_inc(&mCount); + } + inline void decStrong(const void* id) const { + if (android_atomic_dec(&mCount) == 1) { + delete static_cast<const T*>(this); + } + } + +protected: + inline ~LightRefBase() { } + +private: + mutable volatile int32_t mCount; +}; + +// --------------------------------------------------------------------------- + template <typename T> class sp { |