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_RGB_PLANE_H
17#define ANN_RGB_PLANE_H
18
19#include <utils/KeyedVector.h>
20#include <Hwcomposer.h>
21#include <common/buffers/BufferCache.h>
22#include <DisplayPlane.h>
23
24#include <linux/psb_drm.h>
25
26namespace android {
27namespace intel {
28
29class AnnRGBPlane : public DisplayPlane {
30public:
31    AnnRGBPlane(int index, int type, int disp);
32    virtual ~AnnRGBPlane();
33public:
34    // hardware operations
35    bool enable();
36    bool disable();
37    bool reset();
38    bool isDisabled();
39    bool flip(void *ctx);
40    void postFlip();
41
42    void* getContext() const;
43    void setZOrderConfig(ZOrderConfig& config, void *nativeConfig);
44
45    bool setDataBuffer(uint32_t handle);
46protected:
47    bool setDataBuffer(BufferMapper& mapper);
48    bool enablePlane(bool enabled);
49private:
50    void setFramebufferTarget(uint32_t handle);
51protected:
52    struct intel_dc_plane_ctx mContext;
53
54private:
55    // scaling buffer vector max size
56    enum {
57        MAX_SCALING_BUF_COUNT = 3,
58    };
59    KeyedVector<uint32_t, uint32_t> mScalingBufferMap;
60};
61
62} // namespace intel
63} // namespace android
64
65#endif /* ANN_RGB_PLANE_H */
66