summaryrefslogtreecommitdiff
path: root/cmds/flatland/GLHelper.cpp
diff options
context:
space:
mode:
author Huihong Luo <huisinro@google.com> 2022-08-15 20:38:10 -0700
committer Huihong Luo <huisinro@google.com> 2022-09-26 21:07:46 +0000
commit31b5ac21e84a0fde6483dc8487af664582dcc5ee (patch)
tree79150a8c2b31fbfbc7fa48ffb313833073fb6a1c /cmds/flatland/GLHelper.cpp
parent5a0d7d494aaf7a6bbf280e41564f2e79b2860cb6 (diff)
Remove internal display related methods
SurfaceFlinger and SurfaceComposerClient simply return the first connected display as internal display, which is not really correct. In particular,in the case of dual display for foldable devices, both displays are marked as Internal determined by calling into HWC2 IComposerClient::getDisplayConnectionType(). Therefore, the concept of internal/external/primary displays is removed from SurfaceFlinger, and the display manager is the better place to handle the logics. flatland is modified to take an extra argument to specify display id, and error occurs if no display is specified in case of multi-display. Bug: 241285477 Bug: 242763577 Bug: 74619554 Test: atest libgui_test libsurfaceflinger_unittest SurfaceFlinger_test Change-Id: Ib6c7e502ef3269c2c60a4e5388e5ac75275f87ed
Diffstat (limited to 'cmds/flatland/GLHelper.cpp')
-rw-r--r--cmds/flatland/GLHelper.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/cmds/flatland/GLHelper.cpp b/cmds/flatland/GLHelper.cpp
index 01f7d30a42..c163095c50 100644
--- a/cmds/flatland/GLHelper.cpp
+++ b/cmds/flatland/GLHelper.cpp
@@ -35,9 +35,12 @@ GLHelper::GLHelper() :
GLHelper::~GLHelper() {
}
-bool GLHelper::setUp(const ShaderDesc* shaderDescs, size_t numShaders) {
+bool GLHelper::setUp(const sp<IBinder>& displayToken, const ShaderDesc* shaderDescs,
+ size_t numShaders) {
bool result;
+ mDisplayToken = displayToken;
+
mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (mDisplay == EGL_NO_DISPLAY) {
fprintf(stderr, "eglGetDisplay error: %#x\n", eglGetError());
@@ -221,14 +224,8 @@ bool GLHelper::createNamedSurfaceTexture(GLuint name, uint32_t w, uint32_t h,
}
bool GLHelper::computeWindowScale(uint32_t w, uint32_t h, float* scale) {
- const sp<IBinder> dpy = mSurfaceComposerClient->getInternalDisplayToken();
- if (dpy == nullptr) {
- fprintf(stderr, "SurfaceComposer::getInternalDisplayToken failed.\n");
- return false;
- }
-
ui::DisplayMode mode;
- status_t err = mSurfaceComposerClient->getActiveDisplayMode(dpy, &mode);
+ status_t err = mSurfaceComposerClient->getActiveDisplayMode(mDisplayToken, &mode);
if (err != NO_ERROR) {
fprintf(stderr, "SurfaceComposer::getActiveDisplayMode failed: %#x\n", err);
return false;