diff options
author | 2019-11-21 11:14:45 -0800 | |
---|---|---|
committer | 2020-01-29 13:59:26 -0800 | |
commit | 3cb3d4e3906eb43a01464e8862772295dab50f78 (patch) | |
tree | bcdf7a4b117cfa538d339c2d806c7e66178f6e1f /cmds/flatland/GLHelper.cpp | |
parent | 68d6b2f5a5cd7c749203519fbfd3ae796875657a (diff) |
SF: Redesign API to query display information
The DisplayInfo list returned by ISurfaceComposer for display configs
contains display information/state redundant across configs.
Extract config information to DisplayConfig, and repurpose DisplayInfo
for immutable information about a physical display. In a future CL, SF
will populate DisplayInfo with additional data (e.g. connection type,
EDID fields) on initial connection. DisplayConfigs retain the ability
to reload on subsequent connections. Introduce ui::DisplayState for
transactional state applicable to both physical and virtual displays.
Bug: 144601064
Test: dumpsys display
Change-Id: I72003e8ef71483ef483d0de85d28b859a6c9f5fc
Diffstat (limited to 'cmds/flatland/GLHelper.cpp')
-rw-r--r-- | cmds/flatland/GLHelper.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/cmds/flatland/GLHelper.cpp b/cmds/flatland/GLHelper.cpp index d398559ee8..3a3df08534 100644 --- a/cmds/flatland/GLHelper.cpp +++ b/cmds/flatland/GLHelper.cpp @@ -14,15 +14,14 @@ * limitations under the License. */ +#include "GLHelper.h" + #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> - -#include <ui/DisplayInfo.h> #include <gui/SurfaceComposerClient.h> +#include <ui/DisplayConfig.h> -#include "GLHelper.h" - - namespace android { +namespace android { GLHelper::GLHelper() : mDisplay(EGL_NO_DISPLAY), @@ -228,15 +227,15 @@ bool GLHelper::computeWindowScale(uint32_t w, uint32_t h, float* scale) { return false; } - DisplayInfo info; - status_t err = mSurfaceComposerClient->getDisplayInfo(dpy, &info); + DisplayConfig config; + status_t err = mSurfaceComposerClient->getActiveDisplayConfig(dpy, &config); if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposer::getDisplayInfo failed: %#x\n", err); + fprintf(stderr, "SurfaceComposer::getActiveDisplayConfig failed: %#x\n", err); return false; } - float scaleX = float(info.w) / float(w); - float scaleY = float(info.h) / float(h); + float scaleX = static_cast<float>(config.resolution.getWidth()) / w; + float scaleY = static_cast<float>(config.resolution.getHeight()) / h; *scale = scaleX < scaleY ? scaleX : scaleY; return true; |