summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-03 07:26:47 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-03 07:26:47 +0000
commit92e5233608d38cc2af457e963971376fe9331f3f (patch)
tree31840145a452b7d2c9b86e71da5566100941c144
parent6723908c95dfe531c3a591712ed5e896c85267ac (diff)
parentd8fb01fe774598a5daf0511b1724f9b460f7ba60 (diff)
downloadnative-92e5233608d38cc2af457e963971376fe9331f3f.tar.gz
release-request-62c3045b-4fac-455c-b27e-5c82d9790366-for-git_oc-dr1-release-4241171 snap-temp-L59500000088705621
Change-Id: I4fbcddbb521ac5b6f1c421a0e98f536fa9808eeb
-rw-r--r--include/input/InputTransport.h10
-rw-r--r--libs/input/InputTransport.cpp20
-rw-r--r--libs/input/tests/InputPublisherAndConsumer_test.cpp13
-rw-r--r--libs/input/tests/StructLayout_test.cpp42
-rw-r--r--opengl/include/EGL/eglext.h5
-rw-r--r--opengl/libs/Android.bp9
-rw-r--r--opengl/libs/EGL/eglApi.cpp50
-rw-r--r--opengl/libs/EGL/egl_display.cpp18
-rw-r--r--services/inputflinger/InputDispatcher.cpp12
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp5
-rw-r--r--services/surfaceflinger/DisplayDevice.h1
-rw-r--r--services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp14
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp3
-rw-r--r--services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp3
-rw-r--r--vulkan/api/vulkan.api1
-rw-r--r--vulkan/include/vulkan/vulkan.h3
-rw-r--r--vulkan/libvulkan/swapchain.cpp2
17 files changed, 151 insertions, 60 deletions
diff --git a/include/input/InputTransport.h b/include/input/InputTransport.h
index f31bceabd7..efa1ffbfee 100644
--- a/include/input/InputTransport.h
+++ b/include/input/InputTransport.h
@@ -65,6 +65,7 @@ struct InputMessage {
nsecs_t eventTime __attribute__((aligned(8)));
int32_t deviceId;
int32_t source;
+ int32_t displayId;
int32_t action;
int32_t flags;
int32_t keyCode;
@@ -83,6 +84,7 @@ struct InputMessage {
nsecs_t eventTime __attribute__((aligned(8)));
int32_t deviceId;
int32_t source;
+ int32_t displayId;
int32_t action;
int32_t actionButton;
int32_t flags;
@@ -232,6 +234,7 @@ public:
uint32_t seq,
int32_t deviceId,
int32_t source,
+ int32_t displayId,
int32_t action,
int32_t actionButton,
int32_t flags,
@@ -303,7 +306,7 @@ public:
* Other errors probably indicate that the channel is broken.
*/
status_t consume(InputEventFactoryInterface* factory, bool consumeBatches,
- nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent);
+ nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId);
/* Sends a finished signal to the publisher to inform it that the message
* with the specified sequence number has finished being process and whether
@@ -424,9 +427,10 @@ private:
Vector<SeqChain> mSeqChains;
status_t consumeBatch(InputEventFactoryInterface* factory,
- nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent);
+ nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId);
status_t consumeSamples(InputEventFactoryInterface* factory,
- Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent);
+ Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent,
+ int32_t* displayId);
void updateTouchState(InputMessage* msg);
void rewriteMessage(const TouchState& state, InputMessage* msg);
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index 293bc25ab5..d5c592752e 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -285,6 +285,7 @@ status_t InputPublisher::publishMotionEvent(
uint32_t seq,
int32_t deviceId,
int32_t source,
+ int32_t displayId,
int32_t action,
int32_t actionButton,
int32_t flags,
@@ -327,6 +328,7 @@ status_t InputPublisher::publishMotionEvent(
msg.body.motion.seq = seq;
msg.body.motion.deviceId = deviceId;
msg.body.motion.source = source;
+ msg.body.motion.displayId = displayId;
msg.body.motion.action = action;
msg.body.motion.actionButton = actionButton;
msg.body.motion.flags = flags;
@@ -396,7 +398,8 @@ bool InputConsumer::isTouchResamplingEnabled() {
}
status_t InputConsumer::consume(InputEventFactoryInterface* factory,
- bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) {
+ bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent,
+ int32_t* displayId) {
#if DEBUG_TRANSPORT_ACTIONS
ALOGD("channel '%s' consumer ~ consume: consumeBatches=%s, frameTime=%lld",
mChannel->getName().string(), consumeBatches ? "true" : "false", frameTime);
@@ -404,6 +407,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory,
*outSeq = 0;
*outEvent = NULL;
+ *displayId = -1; // Invalid display.
// Fetch the next input message.
// Loop until an event can be returned or no additional events are received.
@@ -418,7 +422,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory,
if (result) {
// Consume the next batched event unless batches are being held for later.
if (consumeBatches || result != WOULD_BLOCK) {
- result = consumeBatch(factory, frameTime, outSeq, outEvent);
+ result = consumeBatch(factory, frameTime, outSeq, outEvent, displayId);
if (*outEvent) {
#if DEBUG_TRANSPORT_ACTIONS
ALOGD("channel '%s' consumer ~ consumed batch event, seq=%u",
@@ -462,7 +466,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory,
// the previous batch right now and defer the new message until later.
mMsgDeferred = true;
status_t result = consumeSamples(factory,
- batch, batch.samples.size(), outSeq, outEvent);
+ batch, batch.samples.size(), outSeq, outEvent, displayId);
mBatches.removeAt(batchIndex);
if (result) {
return result;
@@ -496,6 +500,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory,
initializeMotionEvent(motionEvent, &mMsg);
*outSeq = mMsg.body.motion.seq;
*outEvent = motionEvent;
+ *displayId = mMsg.body.motion.displayId;
#if DEBUG_TRANSPORT_ACTIONS
ALOGD("channel '%s' consumer ~ consumed motion event, seq=%u",
mChannel->getName().string(), *outSeq);
@@ -513,14 +518,14 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory,
}
status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
- nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) {
+ nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) {
status_t result;
for (size_t i = mBatches.size(); i > 0; ) {
i--;
Batch& batch = mBatches.editItemAt(i);
if (frameTime < 0) {
result = consumeSamples(factory, batch, batch.samples.size(),
- outSeq, outEvent);
+ outSeq, outEvent, displayId);
mBatches.removeAt(i);
return result;
}
@@ -534,7 +539,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
continue;
}
- result = consumeSamples(factory, batch, split + 1, outSeq, outEvent);
+ result = consumeSamples(factory, batch, split + 1, outSeq, outEvent, displayId);
const InputMessage* next;
if (batch.samples.isEmpty()) {
mBatches.removeAt(i);
@@ -552,7 +557,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
}
status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory,
- Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent) {
+ Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) {
MotionEvent* motionEvent = factory->createMotionEvent();
if (! motionEvent) return NO_MEMORY;
@@ -567,6 +572,7 @@ status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory,
mSeqChains.push(seqChain);
addSample(motionEvent, &msg);
} else {
+ *displayId = msg.body.motion.displayId;
initializeMotionEvent(motionEvent, &msg);
}
chain = msg.body.motion.seq;
diff --git a/libs/input/tests/InputPublisherAndConsumer_test.cpp b/libs/input/tests/InputPublisherAndConsumer_test.cpp
index 8e69c9cb30..a1367387bc 100644
--- a/libs/input/tests/InputPublisherAndConsumer_test.cpp
+++ b/libs/input/tests/InputPublisherAndConsumer_test.cpp
@@ -89,7 +89,8 @@ void InputPublisherAndConsumerTest::PublishAndConsumeKeyEvent() {
uint32_t consumeSeq;
InputEvent* event;
- status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event);
+ status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event,
+ 0);
ASSERT_EQ(OK, status)
<< "consumer consume should return OK";
@@ -132,6 +133,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() {
const uint32_t seq = 15;
const int32_t deviceId = 1;
const int32_t source = AINPUT_SOURCE_TOUCHSCREEN;
+ const int32_t displayId = 0;
const int32_t action = AMOTION_EVENT_ACTION_MOVE;
const int32_t actionButton = 0;
const int32_t flags = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED;
@@ -164,7 +166,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() {
pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 3.5 * i);
}
- status = mPublisher->publishMotionEvent(seq, deviceId, source, action, actionButton,
+ status = mPublisher->publishMotionEvent(seq, deviceId, source, displayId, action, actionButton,
flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision,
downTime, eventTime, pointerCount,
pointerProperties, pointerCoords);
@@ -173,7 +175,8 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() {
uint32_t consumeSeq;
InputEvent* event;
- status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event);
+ status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event,
+ 0);
ASSERT_EQ(OK, status)
<< "consumer consume should return OK";
@@ -256,7 +259,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessTha
PointerProperties pointerProperties[pointerCount];
PointerCoords pointerCoords[pointerCount];
- status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status)
<< "publisher publishMotionEvent should return BAD_VALUE";
@@ -272,7 +275,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountGreater
pointerCoords[i].clear();
}
- status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status)
<< "publisher publishMotionEvent should return BAD_VALUE";
diff --git a/libs/input/tests/StructLayout_test.cpp b/libs/input/tests/StructLayout_test.cpp
index 81b99531c1..d19f3b8066 100644
--- a/libs/input/tests/StructLayout_test.cpp
+++ b/libs/input/tests/StructLayout_test.cpp
@@ -38,31 +38,33 @@ void TestInputMessageAlignment() {
CHECK_OFFSET(InputMessage::Body::Key, eventTime, 8);
CHECK_OFFSET(InputMessage::Body::Key, deviceId, 16);
CHECK_OFFSET(InputMessage::Body::Key, source, 20);
- CHECK_OFFSET(InputMessage::Body::Key, action, 24);
- CHECK_OFFSET(InputMessage::Body::Key, flags, 28);
- CHECK_OFFSET(InputMessage::Body::Key, keyCode, 32);
- CHECK_OFFSET(InputMessage::Body::Key, scanCode, 36);
- CHECK_OFFSET(InputMessage::Body::Key, metaState, 40);
- CHECK_OFFSET(InputMessage::Body::Key, repeatCount, 44);
- CHECK_OFFSET(InputMessage::Body::Key, downTime, 48);
+ CHECK_OFFSET(InputMessage::Body::Key, displayId, 24);
+ CHECK_OFFSET(InputMessage::Body::Key, action, 28);
+ CHECK_OFFSET(InputMessage::Body::Key, flags, 32);
+ CHECK_OFFSET(InputMessage::Body::Key, keyCode, 36);
+ CHECK_OFFSET(InputMessage::Body::Key, scanCode, 40);
+ CHECK_OFFSET(InputMessage::Body::Key, metaState, 44);
+ CHECK_OFFSET(InputMessage::Body::Key, repeatCount, 48);
+ CHECK_OFFSET(InputMessage::Body::Key, downTime, 56);
CHECK_OFFSET(InputMessage::Body::Motion, seq, 0);
CHECK_OFFSET(InputMessage::Body::Motion, eventTime, 8);
CHECK_OFFSET(InputMessage::Body::Motion, deviceId, 16);
CHECK_OFFSET(InputMessage::Body::Motion, source, 20);
- CHECK_OFFSET(InputMessage::Body::Motion, action, 24);
- CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 28);
- CHECK_OFFSET(InputMessage::Body::Motion, flags, 32);
- CHECK_OFFSET(InputMessage::Body::Motion, metaState, 36);
- CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 40);
- CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 44);
- CHECK_OFFSET(InputMessage::Body::Motion, downTime, 48);
- CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 56);
- CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 60);
- CHECK_OFFSET(InputMessage::Body::Motion, xPrecision, 64);
- CHECK_OFFSET(InputMessage::Body::Motion, yPrecision, 68);
- CHECK_OFFSET(InputMessage::Body::Motion, pointerCount, 72);
- CHECK_OFFSET(InputMessage::Body::Motion, pointers, 80);
+ CHECK_OFFSET(InputMessage::Body::Motion, displayId, 24);
+ CHECK_OFFSET(InputMessage::Body::Motion, action, 28);
+ CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 32);
+ CHECK_OFFSET(InputMessage::Body::Motion, flags, 36);
+ CHECK_OFFSET(InputMessage::Body::Motion, metaState, 40);
+ CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 44);
+ CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 48);
+ CHECK_OFFSET(InputMessage::Body::Motion, downTime, 56);
+ CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 64);
+ CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 68);
+ CHECK_OFFSET(InputMessage::Body::Motion, xPrecision, 72);
+ CHECK_OFFSET(InputMessage::Body::Motion, yPrecision, 76);
+ CHECK_OFFSET(InputMessage::Body::Motion, pointerCount, 80);
+ CHECK_OFFSET(InputMessage::Body::Motion, pointers, 88);
}
} // namespace android
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
index 7de8c62e2f..bb28600da3 100644
--- a/opengl/include/EGL/eglext.h
+++ b/opengl/include/EGL/eglext.h
@@ -682,6 +682,11 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROID) (EGLDi
#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362
#endif /* EGL_EXT_gl_colorspace_display_p3_linear */
+#ifndef EGL_EXT_gl_colorspace_scrgb
+#define EGL_EXT_gl_colorspace_scrgb 1
+#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351
+#endif /* EGL_EXT_gl_colorspace_scrgb */
+
#ifndef EGL_EXT_gl_colorspace_scrgb_linear
#define EGL_EXT_gl_colorspace_scrgb_linear 1
#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350
diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp
index a3446368de..b4cc2113e9 100644
--- a/opengl/libs/Android.bp
+++ b/opengl/libs/Android.bp
@@ -127,7 +127,14 @@ cc_library_shared {
"EGL/Loader.cpp",
"EGL/BlobCache.cpp",
],
- shared_libs: ["libvndksupport"],
+ shared_libs: [
+ "libvndksupport",
+ "android.hardware.configstore@1.0",
+ "android.hardware.configstore-utils",
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ ],
static_libs: ["libEGL_getProcAddress"],
ldflags: ["-Wl,--exclude-libs=ALL"],
export_include_dirs: ["EGL/include"],
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index c5feb89848..0214b0eb56 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -87,9 +87,6 @@ char const * const gBuiltinExtensionString =
"EGL_ANDROID_get_native_client_buffer "
"EGL_ANDROID_front_buffer_auto_refresh "
"EGL_ANDROID_get_frame_timestamps "
- "EGL_EXT_gl_colorspace_scrgb_linear "
- "EGL_EXT_gl_colorspace_display_p3_linear "
- "EGL_EXT_gl_colorspace_display_p3 "
;
char const * const gExtensionString =
@@ -467,6 +464,8 @@ static android_dataspace modifyBufferDataspace(android_dataspace dataSpace,
return HAL_DATASPACE_DISPLAY_P3;
} else if (colorspace == EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT) {
return HAL_DATASPACE_DISPLAY_P3_LINEAR;
+ } else if (colorspace == EGL_GL_COLORSPACE_SCRGB_EXT) {
+ return HAL_DATASPACE_V0_SCRGB;
} else if (colorspace == EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT) {
return HAL_DATASPACE_V0_SCRGB_LINEAR;
}
@@ -526,25 +525,34 @@ static EGLBoolean stripColorSpaceAttribute(egl_display_ptr dp, const EGLint* att
return stripped;
}
-static EGLBoolean getColorSpaceAttribute(egl_display_ptr dp, const EGLint* attrib_list,
- EGLint& colorSpace, android_dataspace& dataSpace) {
+static EGLBoolean getColorSpaceAttribute(egl_display_ptr dp, NativeWindowType window,
+ const EGLint* attrib_list, EGLint& colorSpace,
+ android_dataspace& dataSpace) {
colorSpace = EGL_GL_COLORSPACE_LINEAR_KHR;
dataSpace = HAL_DATASPACE_UNKNOWN;
+
if (attrib_list && dp->haveExtension("EGL_KHR_gl_colorspace")) {
for (const EGLint* attr = attrib_list; *attr != EGL_NONE; attr += 2) {
if (*attr == EGL_GL_COLORSPACE_KHR) {
colorSpace = attr[1];
bool found = false;
+ bool verify = true;
// Verify that color space is allowed
if (colorSpace == EGL_GL_COLORSPACE_SRGB_KHR ||
colorSpace == EGL_GL_COLORSPACE_LINEAR_KHR) {
+ // SRGB and LINEAR are always supported when EGL_KHR_gl_colorspace
+ // is available, so no need to verify.
found = true;
+ verify = false;
} else if (colorSpace == EGL_EXT_gl_colorspace_bt2020_linear &&
dp->haveExtension("EGL_EXT_gl_colorspace_bt2020_linear")) {
found = true;
} else if (colorSpace == EGL_EXT_gl_colorspace_bt2020_pq &&
dp->haveExtension("EGL_EXT_gl_colorspace_bt2020_pq")) {
found = true;
+ } else if (colorSpace == EGL_GL_COLORSPACE_SCRGB_EXT &&
+ dp->haveExtension("EGL_EXT_gl_colorspace_scrgb")) {
+ found = true;
} else if (colorSpace == EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT &&
dp->haveExtension("EGL_EXT_gl_colorspace_scrgb_linear")) {
found = true;
@@ -558,6 +566,31 @@ static EGLBoolean getColorSpaceAttribute(egl_display_ptr dp, const EGLint* attri
if (!found) {
return false;
}
+ if (verify && window) {
+ bool wide_color_support = true;
+ // Ordinarily we'd put a call to native_window_get_wide_color_support
+ // at the beginning of the function so that we'll have the
+ // result when needed elsewhere in the function.
+ // However, because eglCreateWindowSurface is called by SurfaceFlinger and
+ // SurfaceFlinger is required to answer the call below we would
+ // end up in a deadlock situation. By moving the call to only happen
+ // if the application has specifically asked for wide-color we avoid
+ // the deadlock with SurfaceFlinger since it will not ask for a
+ // wide-color surface.
+ int err = native_window_get_wide_color_support(window, &wide_color_support);
+
+ if (err) {
+ ALOGE("getColorSpaceAttribute: invalid window (win=%p) "
+ "failed (%#x) (already connected to another API?)",
+ window, err);
+ return false;
+ }
+ if (!wide_color_support) {
+ // Application has asked for a wide-color colorspace but
+ // wide-color support isn't available on the display the window is on.
+ return false;
+ }
+ }
// Only change the dataSpace from default if the application
// has explicitly set the color space with a EGL_GL_COLORSPACE_KHR attribute.
dataSpace = modifyBufferDataspace(dataSpace, colorSpace);
@@ -567,6 +600,11 @@ static EGLBoolean getColorSpaceAttribute(egl_display_ptr dp, const EGLint* attri
return true;
}
+static EGLBoolean getColorSpaceAttribute(egl_display_ptr dp, const EGLint* attrib_list,
+ EGLint& colorSpace, android_dataspace& dataSpace) {
+ return getColorSpaceAttribute(dp, NULL, attrib_list, colorSpace, dataSpace);
+}
+
void getNativePixelFormat(EGLDisplay dpy, egl_connection_t* cnx, EGLConfig config, EGLint& format) {
// Set the native window's buffers format to match what this config requests.
// Whether to use sRGB gamma is not part of the EGLconfig, but is part
@@ -661,7 +699,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
// now select correct colorspace and dataspace based on user's attribute list
EGLint colorSpace;
android_dataspace dataSpace;
- if (!getColorSpaceAttribute(dp, attrib_list, colorSpace, dataSpace)) {
+ if (!getColorSpaceAttribute(dp, window, attrib_list, colorSpace, dataSpace)) {
ALOGE("error invalid colorspace: %d", colorSpace);
return setError(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index b696920023..4e5833ab12 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -30,6 +30,12 @@
#include "Loader.h"
#include <cutils/properties.h>
+#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
+#include <configstore/Utils.h>
+
+using namespace android::hardware::configstore;
+using namespace android::hardware::configstore::V1_0;
+
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
@@ -192,6 +198,18 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) {
mClientApiString = sClientApiString;
mExtensionString = gBuiltinExtensionString;
+
+ bool wideColorBoardConfig =
+ getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasWideColorDisplay>(
+ false);
+
+ // Add wide-color extensions if device can support wide-color
+ if (wideColorBoardConfig) {
+ mExtensionString.append(
+ "EGL_EXT_gl_colorspace_scrgb EGL_EXT_gl_colorspace_scrgb_linear "
+ "EGL_EXT_gl_colorspace_display_p3_linear EGL_EXT_gl_colorspace_display_p3 ");
+ }
+
char const* start = gExtensionString;
do {
// length of the extension name
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp
index 2efb340eba..69067d225b 100644
--- a/services/inputflinger/InputDispatcher.cpp
+++ b/services/inputflinger/InputDispatcher.cpp
@@ -869,10 +869,7 @@ bool InputDispatcher::dispatchMotionLocked(
return true;
}
- // TODO: support sending secondary display events to input monitors
- if (isMainDisplay(entry->displayId)) {
- addMonitoringTargetsLocked(inputTargets);
- }
+ addMonitoringTargetsLocked(inputTargets);
// Dispatch the motion.
if (conflictingPointerActions) {
@@ -2026,7 +2023,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime,
// Publish the motion event.
status = connection->inputPublisher.publishMotionEvent(dispatchEntry->seq,
- motionEntry->deviceId, motionEntry->source,
+ motionEntry->deviceId, motionEntry->source, motionEntry->displayId,
dispatchEntry->resolvedAction, motionEntry->actionButton,
dispatchEntry->resolvedFlags, motionEntry->edgeFlags,
motionEntry->metaState, motionEntry->buttonState,
@@ -2600,8 +2597,9 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t displ
uint32_t policyFlags) {
#if DEBUG_INBOUND_EVENT_DETAILS
ALOGD("injectInputEvent - eventType=%d, injectorPid=%d, injectorUid=%d, "
- "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x",
- event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags);
+ "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x, displayId=%d",
+ event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags,
+ displayId);
#endif
nsecs_t endTime = now() + milliseconds_to_nanoseconds(timeoutMillis);
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index a0abf12f9a..fc60002334 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -442,6 +442,11 @@ void DisplayDevice::setActiveColorMode(android_color_mode_t mode) {
android_color_mode_t DisplayDevice::getActiveColorMode() const {
return mActiveColorMode;
}
+
+void DisplayDevice::setCompositionDataSpace(android_dataspace dataspace) {
+ ANativeWindow* const window = mNativeWindow.get();
+ native_window_set_buffers_data_space(window, dataspace);
+}
#endif
// ----------------------------------------------------------------------------
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index e2852a7c69..578f81b690 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -189,6 +189,7 @@ public:
#ifdef USE_HWC2
android_color_mode_t getActiveColorMode() const;
void setActiveColorMode(android_color_mode_t mode);
+ void setCompositionDataSpace(android_dataspace dataspace);
#endif
/* ------------------------------------------------------------------------
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
index 5b869e12c7..68d7a18d3a 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
@@ -106,12 +106,6 @@ status_t FramebufferSurface::advanceFrame() {
if (result != NO_ERROR) {
ALOGE("error latching next FramebufferSurface buffer: %s (%d)",
strerror(-result), result);
- return result;
- }
- result = mHwc.setClientTarget(mDisplayType, slot,
- acquireFence, buf, dataspace);
- if (result != NO_ERROR) {
- ALOGE("error posting framebuffer: %d", result);
}
return result;
#else
@@ -182,7 +176,13 @@ status_t FramebufferSurface::nextBuffer(sp<GraphicBuffer>& outBuffer, sp<Fence>&
#else
outBuffer = mCurrentBuffer;
#endif
- return NO_ERROR;
+ status_t result =
+ mHwc.setClientTarget(mDisplayType, outSlot, outFence, outBuffer, outDataspace);
+ if (result != NO_ERROR) {
+ ALOGE("error posting framebuffer: %d", result);
+ }
+
+ return result;
}
#ifndef USE_HWC2
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d435dbc3c3..702f32f197 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -385,6 +385,7 @@ void SurfaceFlinger::bootFinished()
#ifdef USE_HWC2
sp<DisplayDevice> hw(getDisplayDevice(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]));
if (hw->getWideColorSupport()) {
+ hw->setCompositionDataSpace(HAL_DATASPACE_V0_SRGB);
setActiveColorModeInternal(hw, HAL_COLOR_MODE_SRGB);
}
#endif
@@ -1224,6 +1225,7 @@ void SurfaceFlinger::createDefaultDisplayDevice() {
hasWideColorModes && hasWideColorDisplay);
mDisplays.add(token, hw);
setActiveColorModeInternal(hw, HAL_COLOR_MODE_NATIVE);
+ hw->setCompositionDataSpace(HAL_DATASPACE_UNKNOWN);
}
void SurfaceFlinger::onHotplugReceived(HWComposer* composer, int32_t disp, bool connected) {
@@ -1873,6 +1875,7 @@ void SurfaceFlinger::setUpHWComposer() {
// To achieve this we suppress color mode changes until after the boot animation
if (mBootFinished) {
setActiveColorModeInternal(displayDevice, newColorMode);
+ displayDevice->setCompositionDataSpace(newDataSpace);
}
}
}
diff --git a/services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp b/services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp
index 251ed0e874..bcfdad3ef9 100644
--- a/services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp
+++ b/services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp
@@ -94,9 +94,6 @@ int VirtualTouchpadEvdev::Touch(int touchpad_id, float x, float y,
if (touchpad_id < 0 || touchpad_id >= kTouchpads) {
return EINVAL;
}
- if ((x < 0.0f) || (x >= 1.0f) || (y < 0.0f) || (y >= 1.0f)) {
- return EINVAL;
- }
int32_t device_x = x * kWidth;
int32_t device_y = y * kHeight;
Touchpad& touchpad = touchpad_[touchpad_id];
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index 3efc13163e..11161c6bf6 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -1255,6 +1255,7 @@ enum VkColorSpaceKHR {
VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011,
VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012,
VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013,
+ VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014,
}
@extension("VK_EXT_debug_report") // 12
diff --git a/vulkan/include/vulkan/vulkan.h b/vulkan/include/vulkan/vulkan.h
index ee3091348c..f0209d6de1 100644
--- a/vulkan/include/vulkan/vulkan.h
+++ b/vulkan/include/vulkan/vulkan.h
@@ -3355,6 +3355,7 @@ typedef enum VkColorSpaceKHR {
VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011,
VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012,
VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013,
+ VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014,
VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1),
@@ -5829,7 +5830,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT(
#endif
#define VK_EXT_swapchain_colorspace 1
-#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 2
+#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 3
#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace"
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index 651438d6c8..069fb36fd0 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -640,6 +640,8 @@ VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev,
const VkSurfaceFormatKHR kWideColorFormats[] = {
{VK_FORMAT_R16G16B16A16_SFLOAT,
VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT},
+ {VK_FORMAT_R16G16B16A16_SFLOAT,
+ VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT},
{VK_FORMAT_A2R10G10B10_UNORM_PACK32,
VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT},
};