blob: 7b5a15787195a61f7f68b8952800c6ae8bf9ca22 [file] [log] [blame]
Vishnu Naircb8be502022-10-12 19:03:23 +00001/*
2 * Copyright 2022 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
17#pragma once
18
19#include <binder/Binder.h>
20#include <gui/LayerMetadata.h>
21#include <utils/StrongPointer.h>
22#include <cstdint>
23#include <limits>
24#include <optional>
25constexpr uint32_t UNASSIGNED_LAYER_ID = std::numeric_limits<uint32_t>::max();
26
27namespace android {
28class SurfaceFlinger;
29class Client;
30} // namespace android
31
32namespace android::surfaceflinger {
33
34struct LayerCreationArgs {
35 static std::atomic<uint32_t> sSequence;
36
37 LayerCreationArgs(android::SurfaceFlinger*, sp<android::Client>, std::string name,
38 uint32_t flags, gui::LayerMetadata,
39 std::optional<uint32_t> id = std::nullopt);
40 LayerCreationArgs(const LayerCreationArgs&);
41
42 android::SurfaceFlinger* flinger;
43 sp<android::Client> client;
44 std::string name;
45 uint32_t flags; // ISurfaceComposerClient flags
46 gui::LayerMetadata metadata;
47 pid_t ownerPid;
48 uid_t ownerUid;
49 uint32_t textureName;
50 uint32_t sequence;
51 bool addToRoot = true;
52 wp<IBinder> parentHandle = nullptr;
53 wp<IBinder> mirrorLayerHandle = nullptr;
54};
55
56} // namespace android::surfaceflinger