OSDN Git Service

Merge "drm_hwcomposer: Wrap libdrm ops (minus modeset/flip) in C++ classes" into...
[android-x86/external-drm_hwcomposer.git] / drmproperty.h
1 /*
2  * Copyright (C) 2015 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 #ifndef ANDROID_DRM_PROPERTY_H_
18 #define ANDROID_DRM_PROPERTY_H_
19
20 #include <stdint.h>
21 #include <string>
22 #include <xf86drmMode.h>
23 #include <vector>
24
25 namespace android {
26
27 enum DrmPropertyType {
28   DRM_PROPERTY_TYPE_INT,
29   DRM_PROPERTY_TYPE_ENUM,
30 };
31
32 class DrmProperty {
33  public:
34   DrmProperty(drmModePropertyPtr p, uint64_t value);
35   DrmProperty();
36   ~DrmProperty();
37
38   void Init(drmModePropertyPtr p, uint64_t value);
39
40   uint32_t id() const;
41   std::string name() const;
42
43   int value(uint64_t *value) const;
44
45  private:
46   class DrmPropertyEnum {
47    public:
48     DrmPropertyEnum(drm_mode_property_enum *e);
49     ~DrmPropertyEnum();
50
51     uint64_t value_;
52     std::string name_;
53   };
54
55   DrmProperty(const DrmProperty &);
56
57   uint32_t id_;
58
59   DrmPropertyType type_;
60   uint32_t flags_;
61   std::string name_;
62   uint64_t value_;
63
64   std::vector<uint64_t> values_;
65   std::vector<DrmPropertyEnum> enums_;
66   std::vector<uint32_t> blob_ids_;
67 };
68 }
69
70 #endif  // ANDROID_DRM_PROPERTY_H_