summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/vi/layer.h
blob: e4c9c98646e59dfff9d0f14c8e4fede66aebdc3a (plain) (blame)
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
80
81
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "common/common_types.h"

namespace Service::VI {

class Display;

class Layer {
public:
    constexpr Layer() = default;

    void Initialize(u64 id, u64 owner_aruid, Display* display, s32 consumer_binder_id,
                    s32 producer_binder_id) {
        m_id = id;
        m_owner_aruid = owner_aruid;
        m_display = display;
        m_consumer_binder_id = consumer_binder_id;
        m_producer_binder_id = producer_binder_id;
        m_is_initialized = true;
    }

    void Finalize() {
        m_id = {};
        m_owner_aruid = {};
        m_display = {};
        m_consumer_binder_id = {};
        m_producer_binder_id = {};
        m_is_initialized = {};
    }

    void Open() {
        m_is_open = true;
    }

    void Close() {
        m_is_open = false;
    }

    u64 GetId() const {
        return m_id;
    }

    u64 GetOwnerAruid() const {
        return m_owner_aruid;
    }

    Display* GetDisplay() const {
        return m_display;
    }

    s32 GetConsumerBinderId() const {
        return m_consumer_binder_id;
    }

    s32 GetProducerBinderId() const {
        return m_producer_binder_id;
    }

    bool IsInitialized() const {
        return m_is_initialized;
    }

    bool IsOpen() const {
        return m_is_open;
    }

private:
    u64 m_id{};
    u64 m_owner_aruid{};
    Display* m_display{};
    s32 m_consumer_binder_id{};
    s32 m_producer_binder_id{};
    bool m_is_initialized{};
    bool m_is_open{};
};

} // namespace Service::VI