Loading cmds/flatland/GLHelper.cpp +5 −8 Original line number Diff line number Diff line Loading @@ -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()); Loading Loading @@ -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; Loading cmds/flatland/GLHelper.h +3 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: ~GLHelper(); bool setUp(const ShaderDesc* shaderDescs, size_t numShaders); bool setUp(const sp<IBinder>& displayToken, const ShaderDesc* shaderDescs, size_t numShaders); void tearDown(); Loading Loading @@ -87,6 +87,8 @@ private: size_t mNumShaders; GLuint mDitherTexture; sp<IBinder> mDisplayToken; }; } // namespace android cmds/flatland/Main.cpp +52 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <gui/SurfaceControl.h> #include <gui/GLConsumer.h> #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> #include <ui/Fence.h> #include <utils/Trace.h> Loading @@ -37,6 +38,7 @@ using namespace ::android; static uint32_t g_SleepBetweenSamplesMs = 0; static bool g_PresentToWindow = false; static size_t g_BenchmarkNameLen = 0; static sp<IBinder> g_DisplayToken = nullptr; struct BenchmarkDesc { // The name of the test. Loading Loading @@ -393,7 +395,7 @@ public: uint32_t h = mDesc.runHeights[mInstance]; mGLHelper = new GLHelper(); result = mGLHelper->setUp(shaders, NELEMS(shaders)); result = mGLHelper->setUp(g_DisplayToken, shaders, NELEMS(shaders)); if (!result) { return false; } Loading Loading @@ -720,11 +722,15 @@ static size_t maxBenchmarkNameLen() { // Print the command usage help to stderr. static void showHelp(const char* cmd) { fprintf(stderr, "usage: %s [options]\n", cmd); fprintf(stderr, "options include:\n" fprintf( stderr, "options include:\n" " -s N sleep for N ms between samples\n" " -d display the test frame to a window\n" " --help print this helpful message and exit\n" ); " -i display-id specify a display ID to use for multi-display device\n" " see \"dumpsys SurfaceFlinger --display-id\" for valid " "display IDs\n" " --help print this helpful message and exit\n"); } int main(int argc, char** argv) { Loading @@ -733,6 +739,14 @@ int main(int argc, char** argv) { exit(0); } const auto ids = SurfaceComposerClient::getPhysicalDisplayIds(); if (ids.empty()) { fprintf(stderr, "Failed to get ID for any displays.\n"); exit(3); } std::optional<PhysicalDisplayId> displayId; for (;;) { int ret; int option_index = 0; Loading @@ -741,7 +755,7 @@ int main(int argc, char** argv) { { 0, 0, 0, 0 } }; ret = getopt_long(argc, argv, "ds:", ret = getopt_long(argc, argv, "ds:i:", long_options, &option_index); if (ret < 0) { Loading @@ -757,6 +771,14 @@ int main(int argc, char** argv) { g_SleepBetweenSamplesMs = atoi(optarg); break; case 'i': displayId = DisplayId::fromValue<PhysicalDisplayId>(atoll(optarg)); if (!displayId) { fprintf(stderr, "Invalid display ID: %s.\n", optarg); exit(4); } break; case 0: if (strcmp(long_options[option_index].name, "help")) { showHelp(argv[0]); Loading @@ -770,6 +792,22 @@ int main(int argc, char** argv) { } } if (!displayId) { // no display id is specified if (ids.size() == 1) { displayId = ids.front(); } else { fprintf(stderr, "Please specify a display ID for multi-display device.\n"); showHelp(argv[0]); exit(5); } } g_DisplayToken = SurfaceComposerClient::getPhysicalDisplayToken(*displayId); if (g_DisplayToken == nullptr) { fprintf(stderr, "SurfaceComposer::getPhysicalDisplayToken failed.\n"); exit(6); } g_BenchmarkNameLen = maxBenchmarkNameLen(); printf(" cmdline:"); Loading @@ -782,4 +820,6 @@ int main(int argc, char** argv) { fprintf(stderr, "exiting due to error.\n"); return 1; } return 0; } libs/gui/Surface.cpp +17 −20 Original line number Diff line number Diff line Loading @@ -56,6 +56,12 @@ using ui::Dataspace; namespace { enum { // moved from nativewindow/include/system/window.h, to be removed NATIVE_WINDOW_GET_WIDE_COLOR_SUPPORT = 28, NATIVE_WINDOW_GET_HDR_SUPPORT = 29, }; bool isInterceptorRegistrationOp(int op) { return op == NATIVE_WINDOW_SET_CANCEL_INTERCEPTOR || op == NATIVE_WINDOW_SET_DEQUEUE_INTERCEPTOR || Loading Loading @@ -348,34 +354,25 @@ status_t Surface::getFrameTimestamps(uint64_t frameNumber, return NO_ERROR; } // Deprecated(b/242763577): to be removed, this method should not be used // The reason this method still exists here is to support compiled vndk // Surface support should not be tied to the display // Return true since most displays should have this support status_t Surface::getWideColorSupport(bool* supported) { ATRACE_CALL(); const sp<IBinder> display = ComposerServiceAIDL::getInstance().getInternalDisplayToken(); if (display == nullptr) { return NAME_NOT_FOUND; } *supported = false; binder::Status status = composerServiceAIDL()->isWideColorDisplay(display, supported); return statusTFromBinderStatus(status); *supported = true; return NO_ERROR; } // Deprecated(b/242763577): to be removed, this method should not be used // The reason this method still exists here is to support compiled vndk // Surface support should not be tied to the display // Return true since most displays should have this support status_t Surface::getHdrSupport(bool* supported) { ATRACE_CALL(); const sp<IBinder> display = ComposerServiceAIDL::getInstance().getInternalDisplayToken(); if (display == nullptr) { return NAME_NOT_FOUND; } gui::DynamicDisplayInfo info; if (binder::Status status = composerServiceAIDL()->getDynamicDisplayInfo(display, &info); !status.isOk()) { return statusTFromBinderStatus(status); } *supported = !info.hdrCapabilities.supportedHdrTypes.empty(); *supported = true; return NO_ERROR; } Loading libs/gui/SurfaceComposerClient.cpp +0 −10 Original line number Diff line number Diff line Loading @@ -1130,11 +1130,6 @@ std::vector<PhysicalDisplayId> SurfaceComposerClient::getPhysicalDisplayIds() { return physicalDisplayIds; } std::optional<PhysicalDisplayId> SurfaceComposerClient::getInternalDisplayId() { ComposerServiceAIDL& instance = ComposerServiceAIDL::getInstance(); return instance.getInternalDisplayId(); } sp<IBinder> SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId displayId) { sp<IBinder> display = nullptr; binder::Status status = Loading @@ -1143,11 +1138,6 @@ sp<IBinder> SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId dis return status.isOk() ? display : nullptr; } sp<IBinder> SurfaceComposerClient::getInternalDisplayToken() { ComposerServiceAIDL& instance = ComposerServiceAIDL::getInstance(); return instance.getInternalDisplayToken(); } void SurfaceComposerClient::Transaction::setAnimationTransaction() { mAnimation = true; } Loading Loading
cmds/flatland/GLHelper.cpp +5 −8 Original line number Diff line number Diff line Loading @@ -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()); Loading Loading @@ -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; Loading
cmds/flatland/GLHelper.h +3 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: ~GLHelper(); bool setUp(const ShaderDesc* shaderDescs, size_t numShaders); bool setUp(const sp<IBinder>& displayToken, const ShaderDesc* shaderDescs, size_t numShaders); void tearDown(); Loading Loading @@ -87,6 +87,8 @@ private: size_t mNumShaders; GLuint mDitherTexture; sp<IBinder> mDisplayToken; }; } // namespace android
cmds/flatland/Main.cpp +52 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <gui/SurfaceControl.h> #include <gui/GLConsumer.h> #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> #include <ui/Fence.h> #include <utils/Trace.h> Loading @@ -37,6 +38,7 @@ using namespace ::android; static uint32_t g_SleepBetweenSamplesMs = 0; static bool g_PresentToWindow = false; static size_t g_BenchmarkNameLen = 0; static sp<IBinder> g_DisplayToken = nullptr; struct BenchmarkDesc { // The name of the test. Loading Loading @@ -393,7 +395,7 @@ public: uint32_t h = mDesc.runHeights[mInstance]; mGLHelper = new GLHelper(); result = mGLHelper->setUp(shaders, NELEMS(shaders)); result = mGLHelper->setUp(g_DisplayToken, shaders, NELEMS(shaders)); if (!result) { return false; } Loading Loading @@ -720,11 +722,15 @@ static size_t maxBenchmarkNameLen() { // Print the command usage help to stderr. static void showHelp(const char* cmd) { fprintf(stderr, "usage: %s [options]\n", cmd); fprintf(stderr, "options include:\n" fprintf( stderr, "options include:\n" " -s N sleep for N ms between samples\n" " -d display the test frame to a window\n" " --help print this helpful message and exit\n" ); " -i display-id specify a display ID to use for multi-display device\n" " see \"dumpsys SurfaceFlinger --display-id\" for valid " "display IDs\n" " --help print this helpful message and exit\n"); } int main(int argc, char** argv) { Loading @@ -733,6 +739,14 @@ int main(int argc, char** argv) { exit(0); } const auto ids = SurfaceComposerClient::getPhysicalDisplayIds(); if (ids.empty()) { fprintf(stderr, "Failed to get ID for any displays.\n"); exit(3); } std::optional<PhysicalDisplayId> displayId; for (;;) { int ret; int option_index = 0; Loading @@ -741,7 +755,7 @@ int main(int argc, char** argv) { { 0, 0, 0, 0 } }; ret = getopt_long(argc, argv, "ds:", ret = getopt_long(argc, argv, "ds:i:", long_options, &option_index); if (ret < 0) { Loading @@ -757,6 +771,14 @@ int main(int argc, char** argv) { g_SleepBetweenSamplesMs = atoi(optarg); break; case 'i': displayId = DisplayId::fromValue<PhysicalDisplayId>(atoll(optarg)); if (!displayId) { fprintf(stderr, "Invalid display ID: %s.\n", optarg); exit(4); } break; case 0: if (strcmp(long_options[option_index].name, "help")) { showHelp(argv[0]); Loading @@ -770,6 +792,22 @@ int main(int argc, char** argv) { } } if (!displayId) { // no display id is specified if (ids.size() == 1) { displayId = ids.front(); } else { fprintf(stderr, "Please specify a display ID for multi-display device.\n"); showHelp(argv[0]); exit(5); } } g_DisplayToken = SurfaceComposerClient::getPhysicalDisplayToken(*displayId); if (g_DisplayToken == nullptr) { fprintf(stderr, "SurfaceComposer::getPhysicalDisplayToken failed.\n"); exit(6); } g_BenchmarkNameLen = maxBenchmarkNameLen(); printf(" cmdline:"); Loading @@ -782,4 +820,6 @@ int main(int argc, char** argv) { fprintf(stderr, "exiting due to error.\n"); return 1; } return 0; }
libs/gui/Surface.cpp +17 −20 Original line number Diff line number Diff line Loading @@ -56,6 +56,12 @@ using ui::Dataspace; namespace { enum { // moved from nativewindow/include/system/window.h, to be removed NATIVE_WINDOW_GET_WIDE_COLOR_SUPPORT = 28, NATIVE_WINDOW_GET_HDR_SUPPORT = 29, }; bool isInterceptorRegistrationOp(int op) { return op == NATIVE_WINDOW_SET_CANCEL_INTERCEPTOR || op == NATIVE_WINDOW_SET_DEQUEUE_INTERCEPTOR || Loading Loading @@ -348,34 +354,25 @@ status_t Surface::getFrameTimestamps(uint64_t frameNumber, return NO_ERROR; } // Deprecated(b/242763577): to be removed, this method should not be used // The reason this method still exists here is to support compiled vndk // Surface support should not be tied to the display // Return true since most displays should have this support status_t Surface::getWideColorSupport(bool* supported) { ATRACE_CALL(); const sp<IBinder> display = ComposerServiceAIDL::getInstance().getInternalDisplayToken(); if (display == nullptr) { return NAME_NOT_FOUND; } *supported = false; binder::Status status = composerServiceAIDL()->isWideColorDisplay(display, supported); return statusTFromBinderStatus(status); *supported = true; return NO_ERROR; } // Deprecated(b/242763577): to be removed, this method should not be used // The reason this method still exists here is to support compiled vndk // Surface support should not be tied to the display // Return true since most displays should have this support status_t Surface::getHdrSupport(bool* supported) { ATRACE_CALL(); const sp<IBinder> display = ComposerServiceAIDL::getInstance().getInternalDisplayToken(); if (display == nullptr) { return NAME_NOT_FOUND; } gui::DynamicDisplayInfo info; if (binder::Status status = composerServiceAIDL()->getDynamicDisplayInfo(display, &info); !status.isOk()) { return statusTFromBinderStatus(status); } *supported = !info.hdrCapabilities.supportedHdrTypes.empty(); *supported = true; return NO_ERROR; } Loading
libs/gui/SurfaceComposerClient.cpp +0 −10 Original line number Diff line number Diff line Loading @@ -1130,11 +1130,6 @@ std::vector<PhysicalDisplayId> SurfaceComposerClient::getPhysicalDisplayIds() { return physicalDisplayIds; } std::optional<PhysicalDisplayId> SurfaceComposerClient::getInternalDisplayId() { ComposerServiceAIDL& instance = ComposerServiceAIDL::getInstance(); return instance.getInternalDisplayId(); } sp<IBinder> SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId displayId) { sp<IBinder> display = nullptr; binder::Status status = Loading @@ -1143,11 +1138,6 @@ sp<IBinder> SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId dis return status.isOk() ? display : nullptr; } sp<IBinder> SurfaceComposerClient::getInternalDisplayToken() { ComposerServiceAIDL& instance = ComposerServiceAIDL::getInstance(); return instance.getInternalDisplayToken(); } void SurfaceComposerClient::Transaction::setAnimationTransaction() { mAnimation = true; } Loading