2009-03-04 03:31:44 +00:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2012-02-26 02:48:35 +00:00
|
|
|
#ifndef ANDROID_GUI_ISURFACE_COMPOSER_H
|
|
|
|
#define ANDROID_GUI_ISURFACE_COMPOSER_H
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <utils/RefBase.h>
|
|
|
|
#include <utils/Errors.h>
|
2014-03-20 17:28:31 +00:00
|
|
|
#include <utils/Timers.h>
|
|
|
|
#include <utils/Vector.h>
|
2010-02-10 01:46:37 +00:00
|
|
|
|
2009-05-20 02:08:10 +00:00
|
|
|
#include <binder/IInterface.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2014-03-20 17:28:31 +00:00
|
|
|
#include <ui/FrameStats.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
#include <ui/PixelFormat.h>
|
|
|
|
|
2012-02-26 02:48:35 +00:00
|
|
|
#include <gui/IGraphicBufferAlloc.h>
|
|
|
|
#include <gui/ISurfaceComposerClient.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2010-02-10 01:46:37 +00:00
|
|
|
namespace android {
|
2009-03-04 03:31:44 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2011-11-29 21:07:24 +00:00
|
|
|
class ComposerState;
|
2012-07-25 03:43:54 +00:00
|
|
|
class DisplayState;
|
2014-09-09 22:07:07 +00:00
|
|
|
struct DisplayInfo;
|
2011-11-18 01:49:17 +00:00
|
|
|
class IDisplayEventConnection;
|
|
|
|
class IMemoryHeap;
|
2014-05-22 22:59:05 +00:00
|
|
|
class Rect;
|
2011-04-20 21:20:59 +00:00
|
|
|
|
2013-01-09 00:06:15 +00:00
|
|
|
/*
|
|
|
|
* This class defines the Binder IPC interface for accessing various
|
|
|
|
* SurfaceFlinger features.
|
|
|
|
*/
|
2012-08-09 02:42:09 +00:00
|
|
|
class ISurfaceComposer: public IInterface {
|
2009-03-04 03:31:44 +00:00
|
|
|
public:
|
|
|
|
DECLARE_META_INTERFACE(SurfaceComposer);
|
|
|
|
|
2012-08-09 02:42:09 +00:00
|
|
|
// flags for setTransactionState()
|
2011-10-13 00:39:00 +00:00
|
|
|
enum {
|
2012-08-09 02:42:09 +00:00
|
|
|
eSynchronous = 0x01,
|
2012-10-16 01:24:43 +00:00
|
|
|
eAnimation = 0x02,
|
2011-10-13 00:39:00 +00:00
|
|
|
};
|
|
|
|
|
2012-08-09 23:29:12 +00:00
|
|
|
enum {
|
|
|
|
eDisplayIdMain = 0,
|
|
|
|
eDisplayIdHdmi = 1
|
|
|
|
};
|
|
|
|
|
2014-09-04 23:20:31 +00:00
|
|
|
enum Rotation {
|
|
|
|
eRotateNone = 0,
|
|
|
|
eRotate90 = 1,
|
|
|
|
eRotate180 = 2,
|
|
|
|
eRotate270 = 3
|
|
|
|
};
|
|
|
|
|
2009-03-04 03:31:44 +00:00
|
|
|
/* create connection with surface flinger, requires
|
|
|
|
* ACCESS_SURFACE_FLINGER permission
|
|
|
|
*/
|
2010-05-28 21:22:23 +00:00
|
|
|
virtual sp<ISurfaceComposerClient> createConnection() = 0;
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2011-01-13 02:30:40 +00:00
|
|
|
/* create a graphic buffer allocator
|
|
|
|
*/
|
|
|
|
virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
|
|
|
|
|
2012-08-09 23:29:12 +00:00
|
|
|
/* return an IDisplayEventConnection */
|
|
|
|
virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0;
|
|
|
|
|
2013-08-08 19:15:49 +00:00
|
|
|
/* create a virtual display
|
2012-08-09 23:29:12 +00:00
|
|
|
* requires ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
2012-10-20 01:19:11 +00:00
|
|
|
virtual sp<IBinder> createDisplay(const String8& displayName,
|
|
|
|
bool secure) = 0;
|
2012-08-09 23:29:12 +00:00
|
|
|
|
2013-08-08 19:15:49 +00:00
|
|
|
/* destroy a virtual display
|
|
|
|
* requires ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
|
|
|
virtual void destroyDisplay(const sp<IBinder>& display) = 0;
|
|
|
|
|
2012-08-09 23:29:12 +00:00
|
|
|
/* get the token for the existing default displays. possible values
|
|
|
|
* for id are eDisplayIdMain and eDisplayIdHdmi.
|
|
|
|
*/
|
|
|
|
virtual sp<IBinder> getBuiltInDisplay(int32_t id) = 0;
|
|
|
|
|
2010-02-10 01:46:37 +00:00
|
|
|
/* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
|
2012-08-09 02:42:09 +00:00
|
|
|
virtual void setTransactionState(const Vector<ComposerState>& state,
|
|
|
|
const Vector<DisplayState>& displays, uint32_t flags) = 0;
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
/* signal that we're done booting.
|
2010-02-10 01:46:37 +00:00
|
|
|
* Requires ACCESS_SURFACE_FLINGER permission
|
2009-03-04 03:31:44 +00:00
|
|
|
*/
|
|
|
|
virtual void bootFinished() = 0;
|
|
|
|
|
2012-12-18 17:49:45 +00:00
|
|
|
/* verify that an IGraphicBufferProducer was created by SurfaceFlinger.
|
2012-08-09 23:29:12 +00:00
|
|
|
*/
|
|
|
|
virtual bool authenticateSurfaceTexture(
|
2012-12-18 17:49:45 +00:00
|
|
|
const sp<IGraphicBufferProducer>& surface) const = 0;
|
2012-08-09 23:29:12 +00:00
|
|
|
|
2014-05-25 08:36:31 +00:00
|
|
|
/* set display power mode. depending on the mode, it can either trigger
|
|
|
|
* screen on, off or low power mode and wait for it to complete.
|
2013-03-16 01:31:56 +00:00
|
|
|
* requires ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
2014-05-25 08:36:31 +00:00
|
|
|
virtual void setPowerMode(const sp<IBinder>& display, int mode) = 0;
|
2012-06-19 01:06:45 +00:00
|
|
|
|
2014-05-02 22:26:25 +00:00
|
|
|
/* returns information for each configuration of the given display
|
2012-08-25 03:00:51 +00:00
|
|
|
* intended to be used to get information about built-in displays */
|
2014-05-02 22:26:25 +00:00
|
|
|
virtual status_t getDisplayConfigs(const sp<IBinder>& display,
|
|
|
|
Vector<DisplayInfo>* configs) = 0;
|
|
|
|
|
|
|
|
/* indicates which of the configurations returned by getDisplayInfo is
|
|
|
|
* currently active */
|
|
|
|
virtual int getActiveConfig(const sp<IBinder>& display) = 0;
|
|
|
|
|
|
|
|
/* specifies which configuration (of those returned by getDisplayInfo)
|
|
|
|
* should be used */
|
|
|
|
virtual status_t setActiveConfig(const sp<IBinder>& display, int id) = 0;
|
2013-03-01 21:42:57 +00:00
|
|
|
|
2013-03-16 01:31:56 +00:00
|
|
|
/* Capture the specified screen. requires READ_FRAME_BUFFER permission
|
|
|
|
* This function will fail if there is a secure window on screen.
|
|
|
|
*/
|
2013-03-01 21:42:57 +00:00
|
|
|
virtual status_t captureScreen(const sp<IBinder>& display,
|
|
|
|
const sp<IGraphicBufferProducer>& producer,
|
2014-05-22 22:59:05 +00:00
|
|
|
Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
|
2014-02-14 23:03:43 +00:00
|
|
|
uint32_t minLayerZ, uint32_t maxLayerZ,
|
2014-09-04 23:20:31 +00:00
|
|
|
bool useIdentityTransform,
|
|
|
|
Rotation rotation = eRotateNone) = 0;
|
2014-03-20 17:28:31 +00:00
|
|
|
|
|
|
|
/* Clears the frame statistics for animations.
|
|
|
|
*
|
|
|
|
* Requires the ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
|
|
|
virtual status_t clearAnimationFrameStats() = 0;
|
|
|
|
|
|
|
|
/* Gets the frame statistics for animations.
|
|
|
|
*
|
|
|
|
* Requires the ACCESS_SURFACE_FLINGER permission.
|
|
|
|
*/
|
|
|
|
virtual status_t getAnimationFrameStats(FrameStats* outStats) const = 0;
|
2009-03-04 03:31:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2012-08-09 02:42:09 +00:00
|
|
|
class BnSurfaceComposer: public BnInterface<ISurfaceComposer> {
|
2009-03-04 03:31:44 +00:00
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
// Note: BOOT_FINISHED must remain this value, it is called from
|
|
|
|
// Java by ActivityManagerService.
|
|
|
|
BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
|
|
|
|
CREATE_CONNECTION,
|
2011-01-13 02:30:40 +00:00
|
|
|
CREATE_GRAPHIC_BUFFER_ALLOC,
|
2012-08-09 23:29:12 +00:00
|
|
|
CREATE_DISPLAY_EVENT_CONNECTION,
|
|
|
|
CREATE_DISPLAY,
|
2013-08-08 19:15:49 +00:00
|
|
|
DESTROY_DISPLAY,
|
2012-08-09 23:29:12 +00:00
|
|
|
GET_BUILT_IN_DISPLAY,
|
2011-06-29 02:09:31 +00:00
|
|
|
SET_TRANSACTION_STATE,
|
2011-03-08 20:18:54 +00:00
|
|
|
AUTHENTICATE_SURFACE,
|
2014-05-02 22:26:25 +00:00
|
|
|
GET_DISPLAY_CONFIGS,
|
|
|
|
GET_ACTIVE_CONFIG,
|
|
|
|
SET_ACTIVE_CONFIG,
|
2012-06-19 01:06:45 +00:00
|
|
|
CONNECT_DISPLAY,
|
2013-03-01 21:42:57 +00:00
|
|
|
CAPTURE_SCREEN,
|
2014-03-20 17:28:31 +00:00
|
|
|
CLEAR_ANIMATION_FRAME_STATS,
|
2014-05-25 08:36:31 +00:00
|
|
|
GET_ANIMATION_FRAME_STATS,
|
|
|
|
SET_POWER_MODE,
|
2009-03-04 03:31:44 +00:00
|
|
|
};
|
|
|
|
|
2012-08-09 02:42:09 +00:00
|
|
|
virtual status_t onTransact(uint32_t code, const Parcel& data,
|
|
|
|
Parcel* reply, uint32_t flags = 0);
|
2009-03-04 03:31:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
}; // namespace android
|
|
|
|
|
2012-02-26 02:48:35 +00:00
|
|
|
#endif // ANDROID_GUI_ISURFACE_COMPOSER_H
|