summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarissa Wall <marissaw@google.com>2017-03-02 22:09:29 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-02 22:09:29 +0000
commitd254df6fe8907e3c8e211dab5f37ab1640dc3cd3 (patch)
tree75dee9b923d6fee0faacf653db3472af2dc3ddeb
parentd3c8ae12ca8bd09c24269ce98cf4bd75d7366b07 (diff)
parent8f8a6012122a895d539edc436db0a4f394fbc405 (diff)
downloadflounder-d254df6fe8907e3c8e211dab5f37ab1640dc3cd3.tar.gz
hwc2: set layer blend mode
am: 8f8a601212 Change-Id: I9d82e675abdee08cfd7c03ea12411068cb46fc4c
-rw-r--r--hwc2/Android.mk3
-rw-r--r--hwc2/hwc2.cpp8
-rw-r--r--hwc2/hwc2.h20
-rw-r--r--hwc2/hwc2_buffer.cpp34
-rw-r--r--hwc2/hwc2_dev.cpp7
-rw-r--r--hwc2/hwc2_display.cpp12
-rw-r--r--hwc2/hwc2_layer.cpp6
7 files changed, 85 insertions, 5 deletions
diff --git a/hwc2/Android.mk b/hwc2/Android.mk
index a111afa..58ae91e 100644
--- a/hwc2/Android.mk
+++ b/hwc2/Android.mk
@@ -44,7 +44,8 @@ LOCAL_SRC_FILES := \
hwc2_display.cpp \
hwc2_config.cpp \
hwc2_callback.cpp \
- hwc2_layer.cpp
+ hwc2_layer.cpp \
+ hwc2_buffer.cpp
LOCAL_MODLE_TAGS := optional
diff --git a/hwc2/hwc2.cpp b/hwc2/hwc2.cpp
index f5baf8a..ede7200 100644
--- a/hwc2/hwc2.cpp
+++ b/hwc2/hwc2.cpp
@@ -265,11 +265,11 @@ hwc2_error_t set_layer_surface_damage(hwc2_device_t* /*device*/,
return HWC2_ERROR_NONE;
}
-hwc2_error_t set_layer_blend_mode(hwc2_device_t* /*device*/,
- hwc2_display_t /*display*/, hwc2_layer_t /*layer*/,
- hwc2_blend_mode_t /*mode*/)
+hwc2_error_t set_layer_blend_mode(hwc2_device_t *device, hwc2_display_t display,
+ hwc2_layer_t layer, hwc2_blend_mode_t mode)
{
- return HWC2_ERROR_NONE;
+ hwc2_dev *dev = reinterpret_cast<hwc2_context *>(device)->hwc2_dev;
+ return dev->set_layer_blend_mode(display, layer, mode);
}
hwc2_error_t set_layer_color(hwc2_device_t* /*device*/,
diff --git a/hwc2/hwc2.h b/hwc2/hwc2.h
index 74c17c4..70bd51a 100644
--- a/hwc2/hwc2.h
+++ b/hwc2/hwc2.h
@@ -27,6 +27,18 @@
#include <adf/adf.h>
#include <adfhwc/adfhwc.h>
+class hwc2_buffer {
+public:
+ hwc2_buffer();
+
+ /* Set properties */
+ hwc2_error_t set_blend_mode(hwc2_blend_mode_t blend_mode);
+
+private:
+ /* The blend mode of the buffer */
+ hwc2_blend_mode_t blend_mode;
+};
+
class hwc2_config {
public:
hwc2_config();
@@ -86,6 +98,7 @@ public:
/* Set properties */
hwc2_error_t set_comp_type(hwc2_composition_t comp_type);
+ hwc2_error_t set_blend_mode(hwc2_blend_mode_t blend_mode);
static hwc2_layer_t get_next_id();
@@ -93,6 +106,9 @@ private:
/* Identifies the layer to the client */
hwc2_layer_t id;
+ /* The buffer containing the data to be displayed */
+ hwc2_buffer buffer;
+
/* Composition type of the layer */
hwc2_composition_t comp_type;
@@ -139,6 +155,8 @@ public:
hwc2_error_t set_layer_composition_type(hwc2_layer_t lyr_id,
hwc2_composition_t comp_type);
+ hwc2_error_t set_layer_blend_mode(hwc2_layer_t lyr_id,
+ hwc2_blend_mode_t blend_mode);
static hwc2_display_t get_next_id();
@@ -215,6 +233,8 @@ public:
hwc2_error_t set_layer_composition_type(hwc2_display_t dpy_id,
hwc2_layer_t lyr_id, hwc2_composition_t comp_type);
+ hwc2_error_t set_layer_blend_mode(hwc2_display_t dpy_id,
+ hwc2_layer_t lyr_id, hwc2_blend_mode_t blend_mode);
/* Callback functions */
void hotplug(hwc2_display_t dpy_id, hwc2_connection_t connection);
diff --git a/hwc2/hwc2_buffer.cpp b/hwc2/hwc2_buffer.cpp
new file mode 100644
index 0000000..3f244e6
--- /dev/null
+++ b/hwc2/hwc2_buffer.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cutils/log.h>
+
+#include "hwc2.h"
+
+hwc2_buffer::hwc2_buffer()
+ : blend_mode(HWC2_BLEND_MODE_NONE) { }
+
+hwc2_error_t hwc2_buffer::set_blend_mode(hwc2_blend_mode_t blend_mode)
+{
+ if (blend_mode == HWC2_BLEND_MODE_INVALID) {
+ ALOGE("invalid blend mode");
+ return HWC2_ERROR_BAD_PARAMETER;
+ }
+
+ this->blend_mode = blend_mode;
+
+ return HWC2_ERROR_NONE;
+}
diff --git a/hwc2/hwc2_dev.cpp b/hwc2/hwc2_dev.cpp
index 3a0b7af..e0219f9 100644
--- a/hwc2/hwc2_dev.cpp
+++ b/hwc2/hwc2_dev.cpp
@@ -187,6 +187,13 @@ hwc2_error_t hwc2_dev::set_layer_composition_type(hwc2_display_t dpy_id,
comp_type);
}
+hwc2_error_t hwc2_dev::set_layer_blend_mode(hwc2_display_t dpy_id,
+ hwc2_layer_t lyr_id, hwc2_blend_mode_t blend_mode)
+{
+ return displays.find(dpy_id)->second.set_layer_blend_mode(lyr_id,
+ blend_mode);
+}
+
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 46f9a71..1d540fb 100644
--- a/hwc2/hwc2_display.cpp
+++ b/hwc2/hwc2_display.cpp
@@ -276,6 +276,18 @@ hwc2_error_t hwc2_display::set_layer_composition_type(hwc2_layer_t lyr_id,
return it->second.set_comp_type(comp_type);
}
+hwc2_error_t hwc2_display::set_layer_blend_mode(hwc2_layer_t lyr_id,
+ hwc2_blend_mode_t blend_mode)
+{
+ 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_blend_mode(blend_mode);
+}
+
hwc2_display_t hwc2_display::get_next_id()
{
return display_cnt++;
diff --git a/hwc2/hwc2_layer.cpp b/hwc2/hwc2_layer.cpp
index cf57a27..8dd19ae 100644
--- a/hwc2/hwc2_layer.cpp
+++ b/hwc2/hwc2_layer.cpp
@@ -23,6 +23,7 @@ uint64_t hwc2_layer::layer_cnt = 0;
hwc2_layer::hwc2_layer(hwc2_layer_t id)
: id(id),
+ buffer(),
comp_type(HWC2_COMPOSITION_INVALID) { }
hwc2_error_t hwc2_layer::set_comp_type(hwc2_composition_t comp_type)
@@ -50,6 +51,11 @@ hwc2_error_t hwc2_layer::set_comp_type(hwc2_composition_t comp_type)
return ret;
}
+hwc2_error_t hwc2_layer::set_blend_mode(hwc2_blend_mode_t blend_mode)
+{
+ return buffer.set_blend_mode(blend_mode);
+}
+
hwc2_layer_t hwc2_layer::get_next_id()
{
return layer_cnt++;