blob: b3ca0f8ed0f7da72dd787f0806513111fc99cd0a [file] [log] [blame]
Sean Pauled2ec4b2016-03-10 15:35:40 -05001/*
2 * Copyright (C) 2016 The Android Open Source Project
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
Roman Stratiienkobde95662022-12-10 20:27:58 +020017#pragma once
Matvii Zorin0ddc3292020-07-27 18:29:15 +030018
Sean Pauled2ec4b2016-03-10 15:35:40 -050019#include <hardware/hwcomposer2.h>
Roman Stratiienkoaa3cd542020-08-29 11:26:16 +030020
Drew Davenport93443182023-12-14 09:25:45 +000021#include "drm/DrmHwc.h"
Roman Stratiienkoaa3cd542020-08-29 11:26:16 +030022
Sean Pauled2ec4b2016-03-10 15:35:40 -050023namespace android {
24
Drew Davenport93443182023-12-14 09:25:45 +000025class DrmHwcTwo : public DrmHwc {
Sean Pauled2ec4b2016-03-10 15:35:40 -050026 public:
Drew Davenport93443182023-12-14 09:25:45 +000027 DrmHwcTwo() = default;
Roman Stratiienko3dacd472022-01-11 19:18:34 +020028 ~DrmHwcTwo() override = default;
Sean Paulac874152016-03-10 16:00:26 -050029
Drew Davenport93443182023-12-14 09:25:45 +000030 HWC2::Error RegisterCallback(int32_t descriptor, hwc2_callback_data_t data,
31 hwc2_function_pointer_t function);
32
33 // DrmHwc
34 void SendVsyncEventToClient(hwc2_display_t displayid, int64_t timestamp,
35 uint32_t vsync_period) const override;
36 void SendVsyncPeriodTimingChangedEventToClient(
37 hwc2_display_t displayid, int64_t timestamp) const override;
38 void SendRefreshEventToClient(uint64_t displayid) override;
39 void SendHotplugEventToClient(hwc2_display_t displayid,
40 bool connected) override;
41
42 private:
Roman Stratiienko863a3c22021-09-29 13:00:29 +030043 std::pair<HWC2_PFN_HOTPLUG, hwc2_callback_data_t> hotplug_callback_{};
44 std::pair<HWC2_PFN_VSYNC, hwc2_callback_data_t> vsync_callback_{};
Roman Stratiienko6b405052022-12-10 19:09:10 +020045#if __ANDROID_API__ > 29
Roman Stratiienko11ef8c52021-09-29 13:01:39 +030046 std::pair<HWC2_PFN_VSYNC_2_4, hwc2_callback_data_t> vsync_2_4_callback_{};
Roman Stratiienkod0c035b2022-01-21 15:12:56 +020047 std::pair<HWC2_PFN_VSYNC_PERIOD_TIMING_CHANGED, hwc2_callback_data_t>
48 period_timing_changed_callback_{};
Roman Stratiienko11ef8c52021-09-29 13:01:39 +030049#endif
Roman Stratiienko863a3c22021-09-29 13:00:29 +030050 std::pair<HWC2_PFN_REFRESH, hwc2_callback_data_t> refresh_callback_{};
Sean Pauled2ec4b2016-03-10 15:35:40 -050051};
Sean Paulf72cccd2018-08-27 13:59:08 -040052} // namespace android