Merge "vulkan: fix double dlopen for layer libraries" into nyc-dev
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index bdfd21c..336c264 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -46,14 +46,15 @@
"ldr r12, [r12, %[tls]] \n" \
"cmp r12, #0 \n" \
"addne r12, %[api] \n" \
- "ldrne r12, [r12] \n" \
+ "ldrne r12, [r12, %[ext]] \n" \
"cmpne r12, #0 \n" \
"bxne r12 \n" \
"bx lr \n" \
: \
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
- [api] "r"(__builtin_offsetof(gl_hooks_t, \
- ext.extensions[_api])) \
+ [ext] "J"(__builtin_offsetof(gl_hooks_t, \
+ ext.extensions[0])), \
+ [api] "J"(_api*sizeof(void*)) \
: "r12" \
);
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index ed320cb..dffc542 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -448,17 +448,10 @@
if (invTransformOrient & NATIVE_WINDOW_TRANSFORM_ROT_90) {
invTransformOrient ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
NATIVE_WINDOW_TRANSFORM_FLIP_H;
- // If the transform has been rotated the axis of flip has been swapped
- // so we need to swap which flip operations we are performing
- bool is_h_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0;
- bool is_v_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0;
- if (is_h_flipped != is_v_flipped) {
- invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
- NATIVE_WINDOW_TRANSFORM_FLIP_H;
- }
}
// and apply to the current transform
- invTransform = (Transform(invTransform) * Transform(invTransformOrient)).getOrientation();
+ invTransform = (Transform(invTransformOrient) * Transform(invTransform))
+ .getOrientation();
}
int winWidth = s.active.w;
@@ -645,23 +638,13 @@
*/
uint32_t invTransform =
DisplayDevice::getPrimaryDisplayOrientationTransform();
-
- uint32_t t_orientation = transform.getOrientation();
// calculate the inverse transform
if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) {
invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
NATIVE_WINDOW_TRANSFORM_FLIP_H;
- // If the transform has been rotated the axis of flip has been swapped
- // so we need to swap which flip operations we are performing
- bool is_h_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0;
- bool is_v_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0;
- if (is_h_flipped != is_v_flipped) {
- t_orientation ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
- NATIVE_WINDOW_TRANSFORM_FLIP_H;
- }
}
// and apply to the current transform
- transform = Transform(t_orientation) * Transform(invTransform);
+ transform = Transform(invTransform) * transform;
}
// this gives us only the "orientation" component of the transform
@@ -721,53 +704,50 @@
surfaceDamageRegion.dump(LOG_TAG);
}
- auto compositionType = HWC2::Composition::Invalid;
+ // Sideband layers
if (mSidebandStream.get()) {
- compositionType = HWC2::Composition::Sideband;
- auto error = hwcLayer->setSidebandStream(mSidebandStream->handle());
+ setCompositionType(hwcId, HWC2::Composition::Sideband);
+ ALOGV("[%s] Requesting Sideband composition", mName.string());
+ error = hwcLayer->setSidebandStream(mSidebandStream->handle());
if (error != HWC2::Error::None) {
ALOGE("[%s] Failed to set sideband stream %p: %s (%d)",
mName.string(), mSidebandStream->handle(),
to_string(error).c_str(), static_cast<int32_t>(error));
- return;
}
- } else {
- if (mActiveBuffer == nullptr || mActiveBuffer->handle == nullptr) {
- compositionType = HWC2::Composition::Client;
- auto error = hwcLayer->setBuffer(nullptr, Fence::NO_FENCE);
- if (error != HWC2::Error::None) {
- ALOGE("[%s] Failed to set null buffer: %s (%d)", mName.string(),
- to_string(error).c_str(), static_cast<int32_t>(error));
- return;
- }
- } else {
- if (mPotentialCursor) {
- compositionType = HWC2::Composition::Cursor;
- }
- auto acquireFence = mSurfaceFlingerConsumer->getCurrentFence();
- auto error = hwcLayer->setBuffer(mActiveBuffer->handle,
- acquireFence);
- if (error != HWC2::Error::None) {
- ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(),
- mActiveBuffer->handle, to_string(error).c_str(),
- static_cast<int32_t>(error));
- return;
- }
- // If it's not a cursor, default to device composition
- }
+ return;
}
- if (mHwcLayers[hwcId].forceClientComposition) {
- ALOGV("[%s] Forcing Client composition", mName.string());
+ // Client or SolidColor layers
+ if (mActiveBuffer == nullptr || mActiveBuffer->handle == nullptr ||
+ mHwcLayers[hwcId].forceClientComposition) {
+ // TODO: This also includes solid color layers, but no API exists to
+ // setup a solid color layer yet
+ ALOGV("[%s] Requesting Client composition", mName.string());
setCompositionType(hwcId, HWC2::Composition::Client);
- } else if (compositionType != HWC2::Composition::Invalid) {
- ALOGV("[%s] Requesting %s composition", mName.string(),
- to_string(compositionType).c_str());
- setCompositionType(hwcId, compositionType);
+ error = hwcLayer->setBuffer(nullptr, Fence::NO_FENCE);
+ if (error != HWC2::Error::None) {
+ ALOGE("[%s] Failed to set null buffer: %s (%d)", mName.string(),
+ to_string(error).c_str(), static_cast<int32_t>(error));
+ }
+ return;
+ }
+
+ // Device or Cursor layers
+ if (mPotentialCursor) {
+ ALOGV("[%s] Requesting Cursor composition", mName.string());
+ setCompositionType(hwcId, HWC2::Composition::Cursor);
} else {
ALOGV("[%s] Requesting Device composition", mName.string());
setCompositionType(hwcId, HWC2::Composition::Device);
}
+
+ auto acquireFence = mSurfaceFlingerConsumer->getCurrentFence();
+ error = hwcLayer->setBuffer(mActiveBuffer->handle, acquireFence);
+ if (error != HWC2::Error::None) {
+ ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(),
+ mActiveBuffer->handle, to_string(error).c_str(),
+ static_cast<int32_t>(error));
+ }
}
#else
void Layer::setPerFrameData(const sp<const DisplayDevice>& hw,