summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarissa Wall <marissaw@google.com>2017-03-02 22:09:03 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-02 22:09:03 +0000
commit4ae43bbea866ffbf72a022f63883e06dd6af6df0 (patch)
treeb690108babc1b0a77c3f43d38b7ee3c45346b073
parentaf55de08768da96f0f356366e400382b6869f929 (diff)
parentf0c893f7a45643e36929669202bc24eb1f69eaf9 (diff)
downloadflounder-4ae43bbea866ffbf72a022f63883e06dd6af6df0.tar.gz
hwc2: display type support
am: f0c893f7a4 Change-Id: Ic1642f3d4609d76c556e67aa7522120466355099
-rw-r--r--hwc2/hwc2.cpp7
-rw-r--r--hwc2/hwc2.h10
-rw-r--r--hwc2/hwc2_dev.cpp15
-rw-r--r--hwc2/hwc2_display.cpp4
4 files changed, 30 insertions, 6 deletions
diff --git a/hwc2/hwc2.cpp b/hwc2/hwc2.cpp
index bd00e2e..036f488 100644
--- a/hwc2/hwc2.cpp
+++ b/hwc2/hwc2.cpp
@@ -148,10 +148,11 @@ hwc2_error_t get_display_requests(hwc2_device_t* /*device*/,
return HWC2_ERROR_NONE;
}
-hwc2_error_t get_display_type(hwc2_device_t* /*device*/,
- hwc2_display_t /*display*/, hwc2_display_type_t* /*out_type*/)
+hwc2_error_t get_display_type(hwc2_device_t *device, hwc2_display_t display,
+ hwc2_display_type_t *out_type)
{
- return HWC2_ERROR_NONE;
+ hwc2_dev *dev = reinterpret_cast<hwc2_context *>(device)->hwc2_dev;
+ return dev->get_display_type(display, out_type);
}
hwc2_error_t get_doze_support(hwc2_device_t* /*device*/,
diff --git a/hwc2/hwc2.h b/hwc2/hwc2.h
index 9bf84b6..b1fcaf8 100644
--- a/hwc2/hwc2.h
+++ b/hwc2/hwc2.h
@@ -76,10 +76,12 @@ private:
class hwc2_display {
public:
hwc2_display(hwc2_display_t id, int adf_intf_fd,
- const struct adf_device &adf_dev, hwc2_connection_t connection);
+ const struct adf_device &adf_dev, hwc2_connection_t connection,
+ hwc2_display_type_t type);
~hwc2_display();
hwc2_display_t get_id() const { return id; }
+ hwc2_display_type_t get_type() const { return type; }
hwc2_connection_t get_connection() const { return connection; }
hwc2_error_t set_connection(hwc2_connection_t connection);
@@ -97,6 +99,9 @@ private:
/* The display is connected to an output */
hwc2_connection_t connection;
+ /* Physical or virtual */
+ hwc2_display_type_t type;
+
/* All the valid configurations for the display */
std::unordered_map<hwc2_config_t, hwc2_config> configs;
@@ -119,6 +124,9 @@ public:
hwc2_dev();
~hwc2_dev();
+ hwc2_error_t get_display_type(hwc2_display_t dpy_id,
+ hwc2_display_type_t *out_type) const;
+
void hotplug(hwc2_display_t dpy_id, hwc2_connection_t connection);
hwc2_error_t register_callback(hwc2_callback_descriptor_t descriptor,
diff --git a/hwc2/hwc2_dev.cpp b/hwc2/hwc2_dev.cpp
index 3123679..e89fd37 100644
--- a/hwc2/hwc2_dev.cpp
+++ b/hwc2/hwc2_dev.cpp
@@ -59,6 +59,19 @@ hwc2_dev::~hwc2_dev()
hwc2_display::reset_ids();
}
+hwc2_error_t hwc2_dev::get_display_type(hwc2_display_t dpy_id,
+ hwc2_display_type_t *out_type) const
+{
+ auto it = displays.find(dpy_id);
+ if (it == displays.end()) {
+ ALOGE("dpy %" PRIu64 ": invalid display handle", dpy_id);
+ return HWC2_ERROR_BAD_DISPLAY;
+ }
+
+ *out_type = it->second.get_type();
+ return HWC2_ERROR_NONE;
+}
+
void hwc2_dev::hotplug(hwc2_display_t dpy_id, hwc2_connection_t connection)
{
auto it = displays.find(dpy_id);
@@ -173,7 +186,7 @@ int hwc2_dev::open_adf_display(adf_id_t adf_id) {
displays.emplace(std::piecewise_construct, std::forward_as_tuple(dpy_id),
std::forward_as_tuple(dpy_id, intf_fd, adf_dev,
(intf.hotplug_detect)? HWC2_CONNECTION_CONNECTED:
- HWC2_CONNECTION_DISCONNECTED));
+ HWC2_CONNECTION_DISCONNECTED, HWC2_DISPLAY_TYPE_PHYSICAL));
adf_free_interface_data(&intf);
diff --git a/hwc2/hwc2_display.cpp b/hwc2/hwc2_display.cpp
index b68d251..2040614 100644
--- a/hwc2/hwc2_display.cpp
+++ b/hwc2/hwc2_display.cpp
@@ -25,9 +25,11 @@
uint64_t hwc2_display::display_cnt = 0;
hwc2_display::hwc2_display(hwc2_display_t id, int adf_intf_fd,
- const struct adf_device &adf_dev, hwc2_connection_t connection)
+ const struct adf_device &adf_dev, hwc2_connection_t connection,
+ hwc2_display_type_t type)
: id(id),
connection(connection),
+ type(type),
configs(),
active_config(0),
adf_intf_fd(adf_intf_fd),