1/*
2// Copyright (c) 2014 Intel Corporation 
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16#ifndef ANN_OVERLAY_PLANE_H
17#define ANN_OVERLAY_PLANE_H
18
19#include <utils/KeyedVector.h>
20#include <hal_public.h>
21#include <DisplayPlane.h>
22#include <BufferMapper.h>
23#include <ips/common/Wsbm.h>
24#include <ips/common/OverlayPlaneBase.h>
25#include <ips/common/RotationBufferProvider.h>
26
27namespace android {
28namespace intel {
29
30class AnnOverlayPlane : public OverlayPlaneBase {
31public:
32    AnnOverlayPlane(int index, int disp);
33    virtual ~AnnOverlayPlane();
34
35    bool setDataBuffer(uint32_t handle);
36
37    virtual void setTransform(int transform);
38    virtual void setZOrderConfig(ZOrderConfig& config, void *nativeConfig);
39
40    // plane operations
41    virtual bool flip(void *ctx);
42    virtual bool reset();
43    virtual bool enable();
44    virtual bool disable();
45    virtual void postFlip();
46    virtual void* getContext() const;
47    virtual bool initialize(uint32_t bufferCount);
48    virtual void deinitialize();
49    virtual bool rotatedBufferReady(BufferMapper& mapper, BufferMapper* &rotatedMapper);
50    virtual bool useOverlayRotation(BufferMapper& mapper);
51
52private:
53    void signalVideoRotation(BufferMapper& mapper);
54    bool isSettingRotBitAllowed();
55protected:
56    virtual bool setDataBuffer(BufferMapper& mapper);
57    virtual bool flush(uint32_t flags);
58    virtual bool bufferOffsetSetup(BufferMapper& mapper);
59    virtual bool coordinateSetup(BufferMapper& mapper);
60    virtual bool scalingSetup(BufferMapper& mapper);
61
62    virtual void resetBackBuffer(int buf);
63
64    RotationBufferProvider *mRotationBufProvider;
65
66    // rotation config
67    uint32_t mRotationConfig;
68    // z order config
69    uint32_t mZOrderConfig;
70    bool mUseOverlayRotation;
71    // hardware context
72    struct intel_dc_plane_ctx mContext;
73
74};
75
76} // namespace intel
77} // namespace android
78
79#endif /* ANN_OVERLAY_PLANE_H */
80
81