18b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol/*
28b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// Copyright (c) 2014 Intel Corporation 
38b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol//
48b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// Licensed under the Apache License, Version 2.0 (the "License");
58b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// you may not use this file except in compliance with the License.
68b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// You may obtain a copy of the License at
78b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol//
88b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol//      http://www.apache.org/licenses/LICENSE-2.0
98b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol//
108b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// Unless required by applicable law or agreed to in writing, software
118b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// distributed under the License is distributed on an "AS IS" BASIS,
128b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// See the License for the specific language governing permissions and
148b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol// limitations under the License.
158b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol*/
168b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#ifndef ANN_OVERLAY_PLANE_H
178b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#define ANN_OVERLAY_PLANE_H
188b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
198b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#include <utils/KeyedVector.h>
208b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#include <hal_public.h>
218b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#include <DisplayPlane.h>
228b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#include <BufferMapper.h>
238b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#include <common/Wsbm.h>
248b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#include <common/OverlayPlaneBase.h>
258b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#include <common/RotationBufferProvider.h>
268b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
278b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujolnamespace android {
288b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujolnamespace intel {
298b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
308b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujolclass AnnOverlayPlane : public OverlayPlaneBase {
318b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujolpublic:
328b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    AnnOverlayPlane(int index, int disp);
338b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual ~AnnOverlayPlane();
348b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
358b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual void setTransform(int transform);
368b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual void setZOrderConfig(ZOrderConfig& config, void *nativeConfig);
378b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
388b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    // plane operations
398b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool flip(void *ctx);
408b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool reset();
418b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool enable();
428b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool disable();
438b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual void postFlip();
448b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual void* getContext() const;
458b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool initialize(uint32_t bufferCount);
468b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual void deinitialize();
478b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool rotatedBufferReady(BufferMapper& mapper, BufferMapper* &rotatedMapper);
488b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool useOverlayRotation(BufferMapper& mapper);
498b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool scaledBufferReady(BufferMapper& mapper, BufferMapper* &scaledMapper, VideoPayloadBuffer *payload);
508b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
518b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujolprivate:
528b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    void signalVideoRotation(BufferMapper& mapper);
538b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    bool isSettingRotBitAllowed();
548b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
558b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujolprotected:
568b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool setDataBuffer(BufferMapper& mapper);
578b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool flush(uint32_t flags);
588b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool bufferOffsetSetup(BufferMapper& mapper);
598b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual bool scalingSetup(BufferMapper& mapper);
608b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
618b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    virtual void resetBackBuffer(int buf);
628b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
638b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    RotationBufferProvider *mRotationBufProvider;
648b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
658b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    // rotation config
668b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    uint32_t mRotationConfig;
678b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    // z order config
688b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    uint32_t mZOrderConfig;
698b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    bool mUseOverlayRotation;
708b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    // hardware context
718b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol    struct intel_dc_plane_ctx mContext;
728b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol};
738b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
748b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol} // namespace intel
758b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol} // namespace android
768b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
778b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol#endif /* ANN_OVERLAY_PLANE_H */
788b0063f7f46289983bd1bf9ca61662b4a2ddf5b6Benjamin Pujol
79