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 <common/Wsbm.h>
24#include <common/OverlayPlaneBase.h>
25#include <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    virtual void setTransform(int transform);
36    virtual void setZOrderConfig(ZOrderConfig& config, void *nativeConfig);
37
38    // plane operations
39    virtual bool flip(void *ctx);
40    virtual bool reset();
41    virtual bool enable();
42    virtual bool disable();
43    virtual void postFlip();
44    virtual void* getContext() const;
45    virtual bool initialize(uint32_t bufferCount);
46    virtual void deinitialize();
47    virtual bool rotatedBufferReady(BufferMapper& mapper, BufferMapper* &rotatedMapper);
48    virtual bool useOverlayRotation(BufferMapper& mapper);
49    virtual bool scaledBufferReady(BufferMapper& mapper, BufferMapper* &scaledMapper, VideoPayloadBuffer *payload);
50
51private:
52    void signalVideoRotation(BufferMapper& mapper);
53    bool isSettingRotBitAllowed();
54
55protected:
56    virtual bool setDataBuffer(BufferMapper& mapper);
57    virtual bool flush(uint32_t flags);
58    virtual bool bufferOffsetSetup(BufferMapper& mapper);
59    virtual bool scalingSetup(BufferMapper& mapper);
60
61    virtual void resetBackBuffer(int buf);
62
63    RotationBufferProvider *mRotationBufProvider;
64
65    // rotation config
66    uint32_t mRotationConfig;
67    // z order config
68    uint32_t mZOrderConfig;
69    bool mUseOverlayRotation;
70    // hardware context
71    struct intel_dc_plane_ctx mContext;
72};
73
74} // namespace intel
75} // namespace android
76
77#endif /* ANN_OVERLAY_PLANE_H */
78
79