Merge "BufferQueueProducer: fix buffer adjustment during setDequeueTimeout" into qt-dev
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index 2a5a604..d02cb8e 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -84,6 +84,10 @@
return a + alpha * (b - a);
}
+inline static bool isPointerEvent(int32_t source) {
+ return (source & AINPUT_SOURCE_CLASS_POINTER) == AINPUT_SOURCE_CLASS_POINTER;
+}
+
// --- InputMessage ---
bool InputMessage::isValid(size_t actualSize) const {
@@ -637,6 +641,16 @@
mChannel->getName().c_str());
#endif
break;
+ } else if (isPointerEvent(mMsg.body.motion.source) &&
+ mMsg.body.motion.action == AMOTION_EVENT_ACTION_CANCEL) {
+ // No need to process events that we are going to cancel anyways
+ const size_t count = batch.samples.size();
+ for (size_t i = 0; i < count; i++) {
+ const InputMessage& msg = batch.samples.itemAt(i);
+ sendFinishedSignal(msg.body.motion.seq, false);
+ }
+ batch.samples.removeItemsAt(0, count);
+ mBatches.removeAt(batchIndex);
} else {
// We cannot append to the batch in progress, so we need to consume
// the previous batch right now and defer the new message until later.
@@ -759,8 +773,7 @@
}
void InputConsumer::updateTouchState(InputMessage& msg) {
- if (!mResampleTouch ||
- !(msg.body.motion.source & AINPUT_SOURCE_CLASS_POINTER)) {
+ if (!mResampleTouch || !isPointerEvent(msg.body.motion.source)) {
return;
}
@@ -872,7 +885,7 @@
void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event,
const InputMessage* next) {
if (!mResampleTouch
- || !(event->getSource() & AINPUT_SOURCE_CLASS_POINTER)
+ || !(isPointerEvent(event->getSource()))
|| event->getAction() != AMOTION_EVENT_ACTION_MOVE) {
return;
}
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index eb970d9..8841a3b 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -71,6 +71,11 @@
return false;
}
+bool needsAndroidPEglMitigation() {
+ static const int32_t vndk_version = property_get_int32("ro.vndk.version", -1);
+ return vndk_version <= 28;
+}
+
int egl_get_init_count(EGLDisplay dpy) {
egl_display_t* eglDisplay = egl_display_t::get(dpy);
return eglDisplay ? eglDisplay->getRefsCount() : 0;
@@ -384,6 +389,13 @@
if (len) {
// NOTE: we could avoid the copy if we had strnstr.
const std::string ext(start, len);
+ // Mitigation for Android P vendor partitions: Adreno 530 driver shipped on
+ // some Android P vendor partitions this extension under the draft KHR name,
+ // but during Khronos review it was decided to demote it to EXT.
+ if (needsAndroidPEglMitigation() && ext == "EGL_EXT_image_gl_colorspace" &&
+ findExtension(disp.queryString.extensions, "EGL_KHR_image_gl_colorspace")) {
+ mExtensionString.append("EGL_EXT_image_gl_colorspace ");
+ }
if (findExtension(disp.queryString.extensions, ext.c_str(), len)) {
mExtensionString.append(ext + " ");
}
diff --git a/opengl/libs/EGL/egl_display.h b/opengl/libs/EGL/egl_display.h
index 36856b7..e117314 100644
--- a/opengl/libs/EGL/egl_display.h
+++ b/opengl/libs/EGL/egl_display.h
@@ -43,6 +43,7 @@
struct egl_connection_t;
bool findExtension(const char* exts, const char* name, size_t nameLen = 0);
+bool needsAndroidPEglMitigation();
// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp
index 34262f3..e996be6 100644
--- a/opengl/libs/EGL/egl_platform_entries.cpp
+++ b/opengl/libs/EGL/egl_platform_entries.cpp
@@ -1710,6 +1710,26 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_NO_IMAGE_KHR;
+ std::vector<AttrType> strippedAttribs;
+ if (needsAndroidPEglMitigation()) {
+ // Mitigation for Android P vendor partitions: eglImageCreateKHR should accept
+ // EGL_GL_COLORSPACE_LINEAR_KHR, EGL_GL_COLORSPACE_SRGB_KHR and
+ // EGL_GL_COLORSPACE_DEFAULT_EXT if EGL_EXT_image_gl_colorspace is supported,
+ // but some drivers don't like the DEFAULT value and generate an error.
+ for (const AttrType *attr = attrib_list; attr && attr[0] != EGL_NONE; attr += 2) {
+ if (attr[0] == EGL_GL_COLORSPACE_KHR &&
+ dp->haveExtension("EGL_EXT_image_gl_colorspace")) {
+ if (attr[1] != EGL_GL_COLORSPACE_LINEAR_KHR &&
+ attr[1] != EGL_GL_COLORSPACE_SRGB_KHR) {
+ continue;
+ }
+ }
+ strippedAttribs.push_back(attr[0]);
+ strippedAttribs.push_back(attr[1]);
+ }
+ strippedAttribs.push_back(EGL_NONE);
+ }
+
ContextRef _c(dp.get(), ctx);
egl_context_t* const c = _c.get();
@@ -1717,7 +1737,7 @@
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && eglCreateImageFunc) {
result = eglCreateImageFunc(dp->disp.dpy, c ? c->context : EGL_NO_CONTEXT, target, buffer,
- attrib_list);
+ needsAndroidPEglMitigation() ? strippedAttribs.data() : attrib_list);
}
return result;
}