2008-12-18 02:05:43 +00:00
|
|
|
/*
|
|
|
|
* 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_OVERLAY_H
|
|
|
|
#define ANDROID_OVERLAY_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <utils/Errors.h>
|
|
|
|
#include <utils/IInterface.h>
|
|
|
|
#include <utils/RefBase.h>
|
2009-01-10 01:51:23 +00:00
|
|
|
#include <utils/threads.h>
|
|
|
|
|
2008-12-18 02:05:43 +00:00
|
|
|
#include <ui/PixelFormat.h>
|
2009-01-10 01:51:23 +00:00
|
|
|
#include <ui/IOverlay.h>
|
2008-12-18 02:05:43 +00:00
|
|
|
|
|
|
|
#include <hardware/overlay.h>
|
|
|
|
|
|
|
|
namespace android {
|
|
|
|
|
|
|
|
class IMemory;
|
|
|
|
class IMemoryHeap;
|
|
|
|
|
2009-01-10 01:51:23 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class OverlayRef : public LightRefBase<OverlayRef>
|
|
|
|
{
|
|
|
|
public:
|
2009-01-20 22:03:58 +00:00
|
|
|
OverlayRef(overlay_handle_t, const sp<IOverlay>&,
|
2009-01-10 01:51:23 +00:00
|
|
|
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();
|
|
|
|
|
2009-01-20 22:03:58 +00:00
|
|
|
overlay_handle_t mOverlayHandle;
|
2009-01-16 00:12:10 +00:00
|
|
|
sp<IOverlay> mOverlayChannel;
|
2009-01-10 01:51:23 +00:00
|
|
|
uint32_t mWidth;
|
|
|
|
uint32_t mHeight;
|
|
|
|
int32_t mFormat;
|
|
|
|
int32_t mWidthStride;
|
|
|
|
int32_t mHeightStride;
|
|
|
|
bool mOwnHandle;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-12-18 02:05:43 +00:00
|
|
|
class Overlay : public virtual RefBase
|
|
|
|
{
|
|
|
|
public:
|
2009-01-10 01:51:23 +00:00
|
|
|
Overlay(const sp<OverlayRef>& overlayRef);
|
2008-12-18 02:05:43 +00:00
|
|
|
|
|
|
|
/* destroys this overlay */
|
|
|
|
void destroy();
|
|
|
|
|
|
|
|
/* get the HAL handle for this overlay */
|
2009-01-20 22:03:58 +00:00
|
|
|
overlay_handle_t getHandleRef() const;
|
2009-01-10 01:51:23 +00:00
|
|
|
|
|
|
|
/* blocks until an overlay buffer is available and return that buffer. */
|
2009-01-16 00:12:10 +00:00
|
|
|
status_t dequeueBuffer(overlay_buffer_t* buffer);
|
2009-01-10 01:51:23 +00:00
|
|
|
|
|
|
|
/* release the overlay buffer and post it */
|
2009-01-16 00:12:10 +00:00
|
|
|
status_t queueBuffer(overlay_buffer_t buffer);
|
2009-01-10 01:51:23 +00:00
|
|
|
|
|
|
|
/* returns the address of a given buffer if supported, NULL otherwise. */
|
|
|
|
void* getBufferAddress(overlay_buffer_t buffer);
|
|
|
|
|
2008-12-18 02:05:43 +00:00
|
|
|
/* 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;
|
2009-02-14 01:26:28 +00:00
|
|
|
int32_t getBufferCount() const;
|
2009-01-10 01:51:23 +00:00
|
|
|
status_t getStatus() const;
|
|
|
|
|
2008-12-18 02:05:43 +00:00
|
|
|
private:
|
|
|
|
virtual ~Overlay();
|
|
|
|
|
2009-01-10 01:51:23 +00:00
|
|
|
sp<OverlayRef> mOverlayRef;
|
|
|
|
overlay_data_device_t *mOverlayData;
|
|
|
|
status_t mStatus;
|
2008-12-18 02:05:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
}; // namespace android
|
|
|
|
|
|
|
|
#endif // ANDROID_OVERLAY_H
|