diff options
author | 2025-03-03 16:13:39 +0000 | |
---|---|---|
committer | 2025-03-07 00:29:47 +0000 | |
commit | 25345d82ce0d85e073365d0fc83eeb407356a6b8 (patch) | |
tree | e237df8757686210b4e5800a4ec068c603aabec3 /libs/gui/BLASTBufferQueue.cpp | |
parent | fabe2265f7146d3497e0f75ed75a200c2d719429 (diff) |
Fix render thread priority for allocateBuffers
Increase the prio for the thread allocateBuffer runs on
so we don't cause the main RT prio thread wait as long
during frame draws.
Bug: 399701430
Test: app launch test
Flag: com.android.graphics.libgui.flags.allocate_buffer_priority
Change-Id: Ic56697866f1f58c6c5575909da9e1ecd95a3cb06
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
-rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index fa971426a7..1aae13c1f4 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -937,15 +937,22 @@ public: : Surface(igbp, controlledByApp, scHandle), mBbq(bbq) {} void allocateBuffers() override { + ATRACE_CALL(); uint32_t reqWidth = mReqWidth ? mReqWidth : mUserWidth; uint32_t reqHeight = mReqHeight ? mReqHeight : mUserHeight; auto gbp = getIGraphicBufferProducer(); - std::thread ([reqWidth, reqHeight, gbp=getIGraphicBufferProducer(), - reqFormat=mReqFormat, reqUsage=mReqUsage] () { + std::thread allocateThread([reqWidth, reqHeight, gbp = getIGraphicBufferProducer(), + reqFormat = mReqFormat, reqUsage = mReqUsage]() { + if (com_android_graphics_libgui_flags_allocate_buffer_priority()) { + androidSetThreadName("allocateBuffers"); + pid_t tid = gettid(); + androidSetThreadPriority(tid, ANDROID_PRIORITY_DISPLAY); + } + gbp->allocateBuffers(reqWidth, reqHeight, reqFormat, reqUsage); - - }).detach(); + }); + allocateThread.detach(); } status_t setFrameRate(float frameRate, int8_t compatibility, |