diff options
author | Marissa Wall <marissaw@google.com> | 2017-03-02 22:09:57 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-03-02 22:09:57 +0000 |
commit | deb9a1b2ed94f4b8c0c05d95dacf63ff7ec366da (patch) | |
tree | 25d88f8a8ad976cef4826c4451f84d015e489520 | |
parent | 8fc1c9612cb1707cb5ab3c8e5802d1aba89d2ae0 (diff) | |
parent | 603115b31b647127cd39c2ddd04c753f3e57e545 (diff) | |
download | flounder-deb9a1b2ed94f4b8c0c05d95dacf63ff7ec366da.tar.gz |
hwc2: set cursor position
am: 603115b31b
Change-Id: Ia029e934071c8f35e12c8af4561db695296603ec
-rw-r--r-- | hwc2/hwc2.cpp | 8 | ||||
-rw-r--r-- | hwc2/hwc2.h | 3 | ||||
-rw-r--r-- | hwc2/hwc2_dev.cpp | 12 | ||||
-rw-r--r-- | hwc2/hwc2_display.cpp | 15 |
4 files changed, 34 insertions, 4 deletions
diff --git a/hwc2/hwc2.cpp b/hwc2/hwc2.cpp index ff1969e..387cd7c 100644 --- a/hwc2/hwc2.cpp +++ b/hwc2/hwc2.cpp @@ -244,11 +244,11 @@ hwc2_error_t validate_display(hwc2_device_t* /*device*/, return HWC2_ERROR_NONE; } -hwc2_error_t set_cursor_position(hwc2_device_t* /*device*/, - hwc2_display_t /*display*/, hwc2_layer_t /*layer*/, int32_t /*x*/, - int32_t /*y*/) +hwc2_error_t set_cursor_position(hwc2_device_t *device, hwc2_display_t display, + hwc2_layer_t layer, int32_t x, int32_t y) { - return HWC2_ERROR_NONE; + hwc2_dev *dev = reinterpret_cast<hwc2_context *>(device)->hwc2_dev; + return dev->set_cursor_position(display, layer, x, y); } hwc2_error_t set_layer_buffer(hwc2_device_t* /*device*/, diff --git a/hwc2/hwc2.h b/hwc2/hwc2.h index 4b6bf16..5f3d575 100644 --- a/hwc2/hwc2.h +++ b/hwc2/hwc2.h @@ -201,6 +201,7 @@ public: hwc2_error_t set_layer_transform(hwc2_layer_t lyr_id, hwc_transform_t transform); hwc2_error_t set_layer_color(hwc2_layer_t lyr_id, const hwc_color_t &color); + hwc2_error_t set_cursor_position(hwc2_layer_t lyr_id, int32_t x, int32_t y); static hwc2_display_t get_next_id(); @@ -293,6 +294,8 @@ public: hwc_transform_t transform); hwc2_error_t set_layer_color(hwc2_display_t dpy_id, hwc2_layer_t lyr_id, const hwc_color_t &color); + hwc2_error_t set_cursor_position(hwc2_display_t dpy_id, hwc2_layer_t lyr_id, + int32_t x, int32_t y); /* Callback functions */ void hotplug(hwc2_display_t dpy_id, hwc2_connection_t connection); diff --git a/hwc2/hwc2_dev.cpp b/hwc2/hwc2_dev.cpp index 959ffe7..e1ced5d 100644 --- a/hwc2/hwc2_dev.cpp +++ b/hwc2/hwc2_dev.cpp @@ -239,6 +239,18 @@ hwc2_error_t hwc2_dev::set_layer_color(hwc2_display_t dpy_id, return displays.find(dpy_id)->second.set_layer_color(lyr_id, color); } +hwc2_error_t hwc2_dev::set_cursor_position(hwc2_display_t dpy_id, + hwc2_layer_t lyr_id, int32_t x, int32_t y) +{ + auto it = displays.find(dpy_id); + if (it == displays.end()) { + ALOGE("dpy %" PRIu64 ": invalid display handle", dpy_id); + return HWC2_ERROR_BAD_DISPLAY; + } + + return displays.find(dpy_id)->second.set_cursor_position(lyr_id, x, y); +} + void hwc2_dev::hotplug(hwc2_display_t dpy_id, hwc2_connection_t connection) { auto it = displays.find(dpy_id); diff --git a/hwc2/hwc2_display.cpp b/hwc2/hwc2_display.cpp index 6d99b8f..5f42458 100644 --- a/hwc2/hwc2_display.cpp +++ b/hwc2/hwc2_display.cpp @@ -373,6 +373,21 @@ hwc2_error_t hwc2_display::set_layer_color(hwc2_layer_t lyr_id, return HWC2_ERROR_NONE; } +hwc2_error_t hwc2_display::set_cursor_position(hwc2_layer_t lyr_id, + int32_t /*x*/, int32_t /*y*/) +{ + auto it = layers.find(lyr_id); + if (it == layers.end()) { + ALOGE("dpy %" PRIu64 ": lyr %" PRIu64 ": bad layer handle", id, lyr_id); + return HWC2_ERROR_BAD_LAYER; + } + + /* Cursors are not supported on flounder. During validate, any layers marked + * HWC2_COMPOSITION_CURSOR will be changed to HWC2_COMPOSITION_CLIENT. + * No need to store the cursor position. */ + return HWC2_ERROR_NONE; +} + hwc2_display_t hwc2_display::get_next_id() { return display_cnt++; |