Merge "Merge "Fix set_buffers_damage in VulkanSurface" into qt-dev am: 8d8d704cf7" into qt-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2019-04-15 21:20:02 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 21 deletions

View File

@@ -300,17 +300,9 @@ int ReliableSurface::hook_perform(ANativeWindow* window, int operation, ...) {
int result = callProtected(getWrapped(window), perform, operation, args); int result = callProtected(getWrapped(window), perform, operation, args);
va_end(args); va_end(args);
switch (operation) { va_start(args, operation);
case NATIVE_WINDOW_SET_BUFFERS_FORMAT: getSelf(window)->perform(operation, args);
case NATIVE_WINDOW_SET_USAGE: va_end(args);
case NATIVE_WINDOW_SET_USAGE64:
va_start(args, operation);
getSelf(window)->perform(operation, args);
va_end(args);
break;
default:
break;
}
return result; return result;
} }

View File

@@ -525,19 +525,19 @@ VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
bool VulkanSurface::presentCurrentBuffer(const SkRect& dirtyRect, int semaphoreFd) { bool VulkanSurface::presentCurrentBuffer(const SkRect& dirtyRect, int semaphoreFd) {
if (!dirtyRect.isEmpty()) { if (!dirtyRect.isEmpty()) {
SkRect transformedRect;
mWindowInfo.preTransform.mapRect(&transformedRect, dirtyRect);
SkIRect transformedIRect; // native_window_set_surface_damage takes a rectangle in prerotated space
transformedRect.roundOut(&transformedIRect); // with a bottom-left origin. That is, top > bottom.
transformedIRect.intersect(0, 0, mWindowInfo.size.fWidth, mWindowInfo.size.fHeight); // The dirtyRect is also in prerotated space, so we just need to switch it to
// a bottom-left origin space.
// map to bottom-left coordinate system SkIRect irect;
dirtyRect.roundOut(&irect);
android_native_rect_t aRect; android_native_rect_t aRect;
aRect.left = transformedIRect.x(); aRect.left = irect.left();
aRect.top = mWindowInfo.size.fHeight - (transformedIRect.y() + transformedIRect.height()); aRect.top = logicalHeight() - irect.top();
aRect.right = aRect.left + transformedIRect.width(); aRect.right = irect.right();
aRect.bottom = aRect.top - transformedIRect.height(); aRect.bottom = logicalHeight() - irect.bottom();
int err = native_window_set_surface_damage(mNativeWindow.get(), &aRect, 1); int err = native_window_set_surface_damage(mNativeWindow.get(), &aRect, 1);
ALOGE_IF(err != 0, "native_window_set_surface_damage failed: %s (%d)", strerror(-err), err); ALOGE_IF(err != 0, "native_window_set_surface_damage failed: %s (%d)", strerror(-err), err);