summaryrefslogtreecommitdiff
path: root/libhwc2.1/pixel-display.h
blob: df437afd95041e8475d17f249c279e0395a6e1ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * Copyright (C) 2021 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.
 */

#pragma once

#include <aidl/com/google/hardware/pixel/display/BnDisplay.h>

#include "./histogram_mediator.h"
#include "ExynosDevice.h"

namespace aidl {
namespace com {
namespace google {
namespace hardware {
namespace pixel {
namespace display {

using aidl::android::hardware::common::NativeHandle;
using RoiRect = histogram::RoiRect;
using Weight = histogram::Weight;
using HistogramPos = histogram::HistogramPos;
using Priority = histogram::Priority;
using HistogramErrorCode = histogram::HistogramErrorCode;

// Default implementation
class Display : public BnDisplay {
public:
    Display(ExynosDisplay *display) : mDisplay(display), mMediator(display) {}

    ndk::ScopedAStatus isHbmSupported(bool *_aidl_return) override;
    ndk::ScopedAStatus setHbmState(HbmState state) override;
    ndk::ScopedAStatus getHbmState(HbmState *_aidl_return) override;
    ndk::ScopedAStatus isLbeSupported(bool *_aidl_return) override;
    ndk::ScopedAStatus setLbeState(LbeState state) override;
    ndk::ScopedAStatus setLbeAmbientLight(int ambientLux) override;
    ndk::ScopedAStatus getLbeState(LbeState *_aidl_return) override;
    ndk::ScopedAStatus isLhbmSupported(bool *_aidl_return) override;
    ndk::ScopedAStatus setLhbmState(bool enabled) override;
    ndk::ScopedAStatus getLhbmState(bool *_aidl_return) override;
    ndk::ScopedAStatus setCompensationImageHandle(const NativeHandle &native_handle,
                                                  const std::string &imageName,
                                                  int *_aidl_return) override;
    ndk::ScopedAStatus setMinIdleRefreshRate(int fps, int *_aidl_return) override;
    ndk::ScopedAStatus setRefreshRateThrottle(int delayMs, int *_aidl_return) override;
    ndk::ScopedAStatus histogramSample(const RoiRect &roi, const Weight &weight, HistogramPos pos,
                                       Priority pri, std::vector<char16_t> *histogrambuffer,
                                       HistogramErrorCode *_aidl_return) override;
    ndk::ScopedAStatus getPanelCalibrationStatus(PanelCalibrationStatus *_aidl_return) override;
    ndk::ScopedAStatus isDbmSupported(bool *_aidl_return) override;
    ndk::ScopedAStatus setDbmState(bool enabled) override;
    ndk::ScopedAStatus setPeakRefreshRate(int rate) override;
    ndk::ScopedAStatus setLowPowerMode(bool enabled) override;
    ndk::ScopedAStatus isOperationRateSupported(bool *_aidl_return) override;

private:
    bool runMediator(const RoiRect &roi, const Weight &weight, const HistogramPos &pos,
                       std::vector<char16_t> *histogrambuffer);
    ExynosDisplay *mDisplay = nullptr;
    histogram::HistogramMediator mMediator;
};
} // namespace display
} // namespace pixel
} // namespace hardware
} // namespace google
} // namespace com
} // namespace aidl