surfaceflinger: use Vulkan coordinate system
In Vulkan coordinate system, (0, 0) always maps to memory address 0.
In GL coordinate system, (0, 0) maps to the bottom-left corner. The
two agree when doing offscreen rendering. But when rendering to a
window, GL maps (0, 0) to memory address (winHeight-1)*rowStride,
because that is where the bottom-left pixel is.
Let's pick the simpler one for RenderEngine in preparation for
multiple backends. As a result, we don't need yswap when rendering
to offscreen buffers (it is hidden behind the RenderEngine API). It
also makes no sense to flip Y coordinate for both vertex postions
and the viewing volume.
Test: chrome, youtube, camera, screen rotation, screenshots, recents
Change-Id: I6d6317bac3de6f208700a67e518011362c600ced
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 3529741..633510f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -5326,15 +5326,12 @@
}
void SurfaceFlinger::renderScreenImplLocked(const RenderArea& renderArea,
- TraverseLayersFunction traverseLayers, bool yswap,
+ TraverseLayersFunction traverseLayers,
bool useIdentityTransform) {
ATRACE_CALL();
auto& engine(getRenderEngine());
- // get screen geometry
- const auto raHeight = renderArea.getHeight();
-
const auto reqWidth = renderArea.getReqWidth();
const auto reqHeight = renderArea.getReqHeight();
const auto sourceCrop = renderArea.getSourceCrop();
@@ -5348,8 +5345,7 @@
engine.checkErrors();
// set-up our viewport
- engine.setViewportAndProjection(reqWidth, reqHeight, sourceCrop, raHeight, yswap,
- rotation);
+ engine.setViewportAndProjection(reqWidth, reqHeight, sourceCrop, rotation);
engine.disableTexturing();
const float alpha = RenderArea::getCaptureFillValue(renderArea.getCaptureFill());
@@ -5395,7 +5391,7 @@
// via an FBO, which means we didn't have to create
// an EGLSurface and therefore we're not
// dependent on the context's EGLConfig.
- renderScreenImplLocked(renderArea, traverseLayers, true, useIdentityTransform);
+ renderScreenImplLocked(renderArea, traverseLayers, useIdentityTransform);
if (DEBUG_SCREENSHOTS) {
getRenderEngine().finish();