blob: e2fc0d2eec608724e122914be240dd729745f0ba [file] [log] [blame]
Haoxiang Li95917b12019-11-15 11:29:05 -08001//
2// Copyright (C) 2019 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#pragma once
17
Changyeon Jo4ff8fb02020-02-05 21:56:59 -080018#include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
Haoxiang Li95917b12019-11-15 11:29:05 -080019#include <gui/IGraphicBufferProducer.h>
Changyeon Jo75c8aa92019-12-30 11:12:53 -080020#include <gui/ISurfaceComposer.h>
Haoxiang Li95917b12019-11-15 11:29:05 -080021#include <gui/Surface.h>
22#include <gui/SurfaceComposerClient.h>
Changyeon Joe1dd30a2020-01-06 16:51:23 -080023#include <ui/DisplayConfig.h>
24#include <ui/DisplayState.h>
Changyeon Jo75c8aa92019-12-30 11:12:53 -080025#include <tuple>
26#include <vector>
Haoxiang Li95917b12019-11-15 11:29:05 -080027
28namespace android {
29namespace frameworks {
30namespace automotive {
31namespace display {
32namespace V1_0 {
33namespace implementation {
34
35using ::android::hardware::Return;
Haoxiang Li95917b12019-11-15 11:29:05 -080036using ::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer;
Changyeon Jo75c8aa92019-12-30 11:12:53 -080037using ::android::sp;
38
39
40typedef struct DisplayDesc {
41 sp<IBinder> token;
42 sp<SurfaceControl> surfaceControl;
43} DisplayDesc;
44
Haoxiang Li95917b12019-11-15 11:29:05 -080045
Changyeon Jo4ff8fb02020-02-05 21:56:59 -080046class AutomotiveDisplayProxyService : public IAutomotiveDisplayProxyService {
Haoxiang Li95917b12019-11-15 11:29:05 -080047public:
Changyeon Jo75c8aa92019-12-30 11:12:53 -080048 Return<sp<IGraphicBufferProducer>> getIGraphicBufferProducer(uint64_t id) override;
49 Return<bool> showWindow(uint64_t id) override;
50 Return<bool> hideWindow(uint64_t id) override;
51 Return<void> getDisplayIdList(getDisplayIdList_cb _cb) override;
52 Return<void> getDisplayInfo(uint64_t, getDisplayInfo_cb _cb) override;
Haoxiang Li95917b12019-11-15 11:29:05 -080053
54private:
Changyeon Jo75c8aa92019-12-30 11:12:53 -080055 uint8_t getDisplayPort(const uint64_t id) { return (id & 0xF); }
56
57 std::unordered_map<uint64_t, DisplayDesc> mDisplays;
Haoxiang Li95917b12019-11-15 11:29:05 -080058};
Changyeon Jo75c8aa92019-12-30 11:12:53 -080059
Haoxiang Li95917b12019-11-15 11:29:05 -080060} // namespace implementation
61} // namespace V1_0
62} // namespace display
63} // namespace automotive
64} // namespace frameworks
65} // namespace android
66