diff options
author | Marissa Wall <marissaw@google.com> | 2016-09-02 09:22:54 -0700 |
---|---|---|
committer | Marissa Wall <marissaw@google.com> | 2017-03-02 12:35:06 -0800 |
commit | b81c998d710144387cdaaf700b0bdb29a6d7d358 (patch) | |
tree | 622d044295d2583d54e59af843ea20cc21c560c4 | |
parent | 48bb1029d52b66640023d03f71b3f438a9882c8d (diff) | |
download | flounder-b81c998d710144387cdaaf700b0bdb29a6d7d358.tar.gz |
hwc2: set layer composition type
Test: Add "TARGET_USES_HWC2 := true" to BoardConfig.mk.
Recompile.
Run testcases: https://android-review.googlesource.com/#/q/project:
platform/frameworks/native+branch:master+topic:test-hwc2
Change-Id: I7369f56ec936a7157b8e408039d989954e1d7105
-rw-r--r-- | hwc2/hwc2.cpp | 8 | ||||
-rw-r--r-- | hwc2/hwc2.h | 16 | ||||
-rw-r--r-- | hwc2/hwc2_dev.cpp | 7 | ||||
-rw-r--r-- | hwc2/hwc2_display.cpp | 12 | ||||
-rw-r--r-- | hwc2/hwc2_layer.cpp | 31 |
5 files changed, 68 insertions, 6 deletions
diff --git a/hwc2/hwc2.cpp b/hwc2/hwc2.cpp index 3ddd1f5..f5baf8a 100644 --- a/hwc2/hwc2.cpp +++ b/hwc2/hwc2.cpp @@ -279,11 +279,11 @@ hwc2_error_t set_layer_color(hwc2_device_t* /*device*/, return HWC2_ERROR_NONE; } -hwc2_error_t set_layer_composition_type(hwc2_device_t* /*device*/, - hwc2_display_t /*display*/, hwc2_layer_t /*layer*/, - hwc2_composition_t /*type*/) +hwc2_error_t set_layer_composition_type(hwc2_device_t *device, + hwc2_display_t display, hwc2_layer_t layer, hwc2_composition_t type) { - return HWC2_ERROR_NONE; + hwc2_dev *dev = reinterpret_cast<hwc2_context *>(device)->hwc2_dev; + return dev->set_layer_composition_type(display, layer, type); } hwc2_error_t set_layer_dataspace(hwc2_device_t* /*device*/, diff --git a/hwc2/hwc2.h b/hwc2/hwc2.h index 56cdc69..74c17c4 100644 --- a/hwc2/hwc2.h +++ b/hwc2/hwc2.h @@ -80,7 +80,12 @@ class hwc2_layer { public: hwc2_layer(hwc2_layer_t id); - hwc2_layer_t get_id() const { return id; } + /* Get properties */ + hwc2_layer_t get_id() const { return id; } + hwc2_composition_t get_comp_type() const { return comp_type; } + + /* Set properties */ + hwc2_error_t set_comp_type(hwc2_composition_t comp_type); static hwc2_layer_t get_next_id(); @@ -88,6 +93,9 @@ private: /* Identifies the layer to the client */ hwc2_layer_t id; + /* Composition type of the layer */ + hwc2_composition_t comp_type; + /* Keep track to total number of layers so new layer ids can be * generated */ static uint64_t layer_cnt; @@ -129,6 +137,9 @@ public: hwc2_error_t create_layer(hwc2_layer_t *out_layer); hwc2_error_t destroy_layer(hwc2_layer_t lyr_id); + hwc2_error_t set_layer_composition_type(hwc2_layer_t lyr_id, + hwc2_composition_t comp_type); + static hwc2_display_t get_next_id(); static void reset_ids() { display_cnt = 0; } @@ -202,6 +213,9 @@ public: hwc2_error_t create_layer(hwc2_display_t dpy_id, hwc2_layer_t *out_layer); hwc2_error_t destroy_layer(hwc2_display_t dpy_id, hwc2_layer_t lyr_id); + hwc2_error_t set_layer_composition_type(hwc2_display_t dpy_id, + hwc2_layer_t lyr_id, hwc2_composition_t comp_type); + /* Callback functions */ void hotplug(hwc2_display_t dpy_id, hwc2_connection_t connection); void vsync(hwc2_display_t dpy_id, uint64_t timestamp); diff --git a/hwc2/hwc2_dev.cpp b/hwc2/hwc2_dev.cpp index dd168f3..3a0b7af 100644 --- a/hwc2/hwc2_dev.cpp +++ b/hwc2/hwc2_dev.cpp @@ -180,6 +180,13 @@ hwc2_error_t hwc2_dev::destroy_layer(hwc2_display_t dpy_id, hwc2_layer_t lyr_id) return it->second.destroy_layer(lyr_id); } +hwc2_error_t hwc2_dev::set_layer_composition_type(hwc2_display_t dpy_id, + hwc2_layer_t lyr_id, hwc2_composition_t comp_type) +{ + return displays.find(dpy_id)->second.set_layer_composition_type(lyr_id, + comp_type); +} + 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 08e21ea..46f9a71 100644 --- a/hwc2/hwc2_display.cpp +++ b/hwc2/hwc2_display.cpp @@ -264,6 +264,18 @@ hwc2_error_t hwc2_display::destroy_layer(hwc2_layer_t lyr_id) return HWC2_ERROR_NONE; } +hwc2_error_t hwc2_display::set_layer_composition_type(hwc2_layer_t lyr_id, + hwc2_composition_t comp_type) +{ + 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; + } + + return it->second.set_comp_type(comp_type); +} + hwc2_display_t hwc2_display::get_next_id() { return display_cnt++; diff --git a/hwc2/hwc2_layer.cpp b/hwc2/hwc2_layer.cpp index ea26b38..cf57a27 100644 --- a/hwc2/hwc2_layer.cpp +++ b/hwc2/hwc2_layer.cpp @@ -14,12 +14,41 @@ * limitations under the License. */ +#include <inttypes.h> +#include <cutils/log.h> + #include "hwc2.h" uint64_t hwc2_layer::layer_cnt = 0; hwc2_layer::hwc2_layer(hwc2_layer_t id) - : id(id) { } + : id(id), + comp_type(HWC2_COMPOSITION_INVALID) { } + +hwc2_error_t hwc2_layer::set_comp_type(hwc2_composition_t comp_type) +{ + hwc2_error_t ret = HWC2_ERROR_NONE; + + switch (comp_type) { + case HWC2_COMPOSITION_CLIENT: + case HWC2_COMPOSITION_DEVICE: + case HWC2_COMPOSITION_CURSOR: + case HWC2_COMPOSITION_SOLID_COLOR: + break; + + case HWC2_COMPOSITION_SIDEBAND: + ret = HWC2_ERROR_UNSUPPORTED; + break; + + case HWC2_COMPOSITION_INVALID: + default: + ALOGE("lyr %" PRIu64 ": invalid composition type %u", id, comp_type); + ret = HWC2_ERROR_BAD_PARAMETER; + } + + this->comp_type = comp_type; + return ret; +} hwc2_layer_t hwc2_layer::get_next_id() { |