Plumbing through GPU context priority
TODO: Actually return priority from Render engine, instead of random
number.
Test: Compile and observe logcat.
Bug: 168740533
Change-Id: Id8d93e315162708a2a8afa1e87ebdf97ab53a20f
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e9416d6..786d331 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4910,10 +4910,11 @@
case CAPTURE_LAYERS:
case CAPTURE_DISPLAY:
case SET_DISPLAY_BRIGHTNESS:
- case SET_FRAME_TIMELINE_VSYNC: {
+ case SET_FRAME_TIMELINE_VSYNC:
+ // This is not sensitive information, so should not require permission control.
+ case GET_GPU_CONTEXT_PRIORITY: {
return OK;
}
-
case ADD_REGION_SAMPLING_LISTENER:
case REMOVE_REGION_SAMPLING_LISTENER: {
// codes that require permission check
@@ -6335,6 +6336,13 @@
return NO_ERROR;
}
+int SurfaceFlinger::getGPUContextPriority() {
+ // TODO(b/168740533): This is a proof of concept. Once REAL time priority is available
+ // in EGL, we can return it in RenderEngine and propagate it to SurfaceFlinger. Until
+ // then return IntentFilter.SYSTEM_HIGH_PRIORITY.
+ return 1000;
+}
+
} // namespace android
#if defined(__gl_h_)
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 0509247..2e4d1ce 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -608,6 +608,8 @@
status_t addTransactionTraceListener(
const sp<gui::ITransactionTraceListener>& listener) override;
+ int getGPUContextPriority() override;
+
// Implements IBinder::DeathRecipient.
void binderDied(const wp<IBinder>& who) override;
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index 030073c..7f05a75 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -388,6 +388,8 @@
return mFlinger->onTransact(code, data, reply, flags);
}
+ auto getGPUContextPriority() { return mFlinger->getGPUContextPriority(); }
+
/* ------------------------------------------------------------------------
* Read-only access to private data to assert post-conditions.
*/