Skip to content

Commit 92e57eb

Browse files
author
Android Build Coastguard Worker
committed
Snap for 12680993 from ae566f2 to 25Q1-release
Change-Id: Iabe32d54d2b3404cca9ffd6ec6c76e681fe7009d
2 parents 3470fda + ae566f2 commit 92e57eb

37 files changed

Lines changed: 975 additions & 41 deletions

include/android/OWNERS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ per-file surface_control_input_receiver.h = file:platform/frameworks/base:/servi
55
per-file input_transfer_token.h = file:platform/frameworks/base:/services/core/java/com/android/server/wm/OWNERS
66

77
# CoGS
8-
per-file *luts* = file:platform/frameworks/base:/graphics/java/android/graphics/OWNERS
8+
per-file *luts* = file:platform/frameworks/base:/graphics/java/android/graphics/OWNERS
9+
10+
# ADPF
11+
per-file performance_hint.h = file:platform/frameworks/base:/ADPF_OWNERS
12+
per-file thermal.h = file:platform/frameworks/base:/ADPF_OWNERS

include/android/performance_hint.h

Lines changed: 135 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,25 @@ typedef struct AWorkDuration AWorkDuration;
110110
*/
111111
typedef struct APerformanceHintManager APerformanceHintManager;
112112

113+
/**
114+
* An opaque type representing a handle to a performance hint session creation configuration.
115+
* It is consumed by {@link APerformanceHint_createSessionUsingConfig}.
116+
*
117+
* A session creation config encapsulates the required information for a session.
118+
* Additionally, the caller can set various settings for the session,
119+
* to be passed during creation, streamlining the session setup process.
120+
*
121+
* The caller may reuse this object and modify the settings in it
122+
* to create additional sessions.
123+
*
124+
*/
125+
typedef struct ASessionCreationConfig ASessionCreationConfig;
126+
113127
/**
114128
* An opaque type representing a handle to a performance hint session.
115129
* A session can only be acquired from a {@link APerformanceHintManager}
116-
* with {@link APerformanceHint_createSession}. It must be
130+
* with {@link APerformanceHint_createSession}
131+
* or {@link APerformanceHint_createSessionUsingConfig}. It must be
117132
* freed with {@link APerformanceHint_closeSession} after use.
118133
*
119134
* A Session represents a group of threads with an inter-related workload such that hints for
@@ -153,13 +168,27 @@ APerformanceHintManager* _Nullable APerformanceHint_getManager()
153168
* @param size The size of the list of threadIds.
154169
* @param initialTargetWorkDurationNanos The target duration in nanoseconds for the new session.
155170
* This must be positive if using the work duration API, or 0 otherwise.
156-
* @return APerformanceHintManager instance on success, nullptr on failure.
171+
* @return APerformanceHintSession pointer on success, nullptr on failure.
157172
*/
158173
APerformanceHintSession* _Nullable APerformanceHint_createSession(
159174
APerformanceHintManager* _Nonnull manager,
160175
const int32_t* _Nonnull threadIds, size_t size,
161176
int64_t initialTargetWorkDurationNanos) __INTRODUCED_IN(__ANDROID_API_T__);
162177

178+
/**
179+
* Creates a session for the given set of threads that are graphics pipeline threads
180+
* and set their initial target work duration.
181+
*
182+
* @param manager The performance hint manager instance.
183+
* @param config The configuration struct containing required information
184+
* to create a session.
185+
* @return APerformanceHintSession pointer on success, nullptr on failure.
186+
*/
187+
APerformanceHintSession* _Nullable APerformanceHint_createSessionUsingConfig(
188+
APerformanceHintManager* _Nonnull manager,
189+
ASessionCreationConfig* _Nonnull config)
190+
__INTRODUCED_IN(36);
191+
163192
/**
164193
* Get preferred update rate information for this device.
165194
*
@@ -169,6 +198,15 @@ APerformanceHintSession* _Nullable APerformanceHint_createSession(
169198
int64_t APerformanceHint_getPreferredUpdateRateNanos(
170199
APerformanceHintManager* _Nonnull manager) __INTRODUCED_IN(__ANDROID_API_T__);
171200

201+
/**
202+
* Get maximum number of graphics pipieline threads per-app for this device.
203+
*
204+
* @param manager The performance hint manager instance.
205+
* @return the maximum number of graphics pipeline threads supported by device.
206+
*/
207+
int APerformanceHint_getMaxGraphicsPipelineThreadsCount(
208+
APerformanceHintManager* _Nonnull manager) __INTRODUCED_IN(36);
209+
172210
/**
173211
* Updates this session's target duration for each cycle of work.
174212
*
@@ -320,12 +358,12 @@ int APerformanceHint_notifyWorkloadReset(
320358
* call {@link AWorkDuration_release()} to destroy {@link AWorkDuration} and release all resources
321359
* associated with it.
322360
*
323-
* @return AWorkDuration on success and nullptr otherwise.
361+
* @return AWorkDuration pointer.
324362
*/
325363
AWorkDuration* _Nonnull AWorkDuration_create() __INTRODUCED_IN(__ANDROID_API_V__);
326364

327365
/**
328-
* Destroys {@link AWorkDuration} and free all resources associated to it.
366+
* Destroys a {@link AWorkDuration} and frees all resources associated with it.
329367
*
330368
* @param aWorkDuration The {@link AWorkDuration} created by calling {@link AWorkDuration_create()}
331369
*/
@@ -388,6 +426,99 @@ void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* _Nonnull aWorkDurati
388426
APerformanceHintSession* _Nonnull APerformanceHint_borrowSessionFromJava(
389427
JNIEnv* _Nonnull env, jobject _Nonnull sessionObj) __INTRODUCED_IN(36);
390428

429+
/*
430+
* Creates a new ASessionCreationConfig.
431+
*
432+
* When the client finishes using {@link ASessionCreationConfig}, it should
433+
* call {@link ASessionCreationConfig_release()} to destroy
434+
* {@link ASessionCreationConfig} and release all resources
435+
* associated with it.
436+
*
437+
* @return ASessionCreationConfig pointer.
438+
*/
439+
ASessionCreationConfig* _Nonnull ASessionCreationConfig_create()
440+
__INTRODUCED_IN(36);
441+
442+
443+
/**
444+
* Destroys a {@link ASessionCreationConfig} and frees all
445+
* resources associated with it.
446+
*
447+
* @param config The {@link ASessionCreationConfig}
448+
* created by calling {@link ASessionCreationConfig_create()}.
449+
*/
450+
void ASessionCreationConfig_release(
451+
ASessionCreationConfig* _Nonnull config) __INTRODUCED_IN(36);
452+
453+
/**
454+
* Sets the tids to be associated with the session to be created.
455+
*
456+
* @param config The {@link ASessionCreationConfig}
457+
* created by calling {@link ASessionCreationConfig_create()}
458+
* @param tids The list of tids to be associated with this session. They must be part of
459+
* this process' thread group.
460+
* @param size The size of the list of tids.
461+
*
462+
* @return 0 on success.
463+
* EINVAL if invalid array pointer or the value of size
464+
*/
465+
int ASessionCreationConfig_setTids(
466+
ASessionCreationConfig* _Nonnull config,
467+
const pid_t* _Nonnull tids, size_t size) __INTRODUCED_IN(36);
468+
469+
/**
470+
* Sets the initial target work duration in nanoseconds for the session to be created.
471+
*
472+
* @param config The {@link ASessionCreationConfig}
473+
* created by calling {@link ASessionCreationConfig_create()}.
474+
* @param targetWorkDurationNanos The parameter to specify a target duration
475+
* in nanoseconds for the new session; this value must be positive to use
476+
* the work duration API.
477+
*
478+
* @return 0 on success.
479+
* ENOTSUP if unsupported
480+
* EINVAL if invalid value
481+
*/
482+
int ASessionCreationConfig_setTargetWorkDurationNanos(
483+
ASessionCreationConfig* _Nonnull config,
484+
int64_t targetWorkDurationNanos) __INTRODUCED_IN(36);
485+
486+
/**
487+
* Sets whether power efficiency mode will be enabled for the session.
488+
* This tells the session that these threads can be
489+
* safely scheduled to prefer power efficiency over performance.
490+
*
491+
* @param config The {@link ASessionCreationConfig}
492+
* created by calling {@link ASessionCreationConfig_create()}.
493+
* @param enabled Whether power efficiency mode will be enabled.
494+
*
495+
* @return 0 on success.
496+
* ENOTSUP if unsupported
497+
* EINVAL if invalid pointer to creation config
498+
*/
499+
int ASessionCreationConfig_setPreferPowerEfficiency(
500+
ASessionCreationConfig* _Nonnull config, bool enabled) __INTRODUCED_IN(36);
501+
502+
/**
503+
* Sessions setting this hint are expected to time the critical path of
504+
* graphics pipeline from end to end, with the total work duration
505+
* representing the time from the start of frame production until the
506+
* buffer is fully finished drawing.
507+
*
508+
* It should include any threads on the critical path of that pipeline,
509+
* up to a limit accessible from {@link getMaxGraphicsPipelineThreadsCount()}.
510+
*
511+
* @param config The {@link ASessionCreationConfig}
512+
* created by calling {@link ASessionCreationConfig_create()}.
513+
* @param enabled Whether this session manages a graphics pipeline's critical path.
514+
*
515+
* @return 0 on success.
516+
* ENOTSUP if unsupported
517+
* EINVAL if invalid pointer to creation config or maximum threads for graphics
518+
pipeline is reached.
519+
*/
520+
int ASessionCreationConfig_setGraphicsPipeline(
521+
ASessionCreationConfig* _Nonnull confi, bool enabled) __INTRODUCED_IN(36);
391522

392523
__END_DECLS
393524

include/powermanager/PowerHalController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class PowerHalController : public HalWrapper {
7272
virtual HalResult<aidl::android::hardware::power::ChannelConfig> getSessionChannel(
7373
int tgid, int uid) override;
7474
virtual HalResult<void> closeSessionChannel(int tgid, int uid) override;
75+
virtual HalResult<aidl::android::hardware::power::SupportInfo> getSupportInfo() override;
7576

7677
private:
7778
std::mutex mConnectedHalMutex;

include/powermanager/PowerHalWrapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class HalWrapper {
6363
virtual HalResult<aidl::android::hardware::power::ChannelConfig> getSessionChannel(int tgid,
6464
int uid) = 0;
6565
virtual HalResult<void> closeSessionChannel(int tgid, int uid) = 0;
66+
virtual HalResult<aidl::android::hardware::power::SupportInfo> getSupportInfo() = 0;
6667
};
6768

6869
// Empty Power HAL wrapper that ignores all api calls.
@@ -85,6 +86,7 @@ class EmptyHalWrapper : public HalWrapper {
8586
HalResult<aidl::android::hardware::power::ChannelConfig> getSessionChannel(int tgid,
8687
int uid) override;
8788
HalResult<void> closeSessionChannel(int tgid, int uid) override;
89+
HalResult<aidl::android::hardware::power::SupportInfo> getSupportInfo() override;
8890

8991
protected:
9092
virtual const char* getUnsupportedMessage();
@@ -170,6 +172,7 @@ class AidlHalWrapper : public EmptyHalWrapper {
170172
HalResult<aidl::android::hardware::power::ChannelConfig> getSessionChannel(int tgid,
171173
int uid) override;
172174
HalResult<void> closeSessionChannel(int tgid, int uid) override;
175+
HalResult<aidl::android::hardware::power::SupportInfo> getSupportInfo() override;
173176

174177
protected:
175178
const char* getUnsupportedMessage() override;

include/private/OWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ADPF
2+
per-file thermal_private.h = file:platform/frameworks/base:/ADPF_OWNERS
3+
per-file performance_hint_private.h = file:platform/frameworks/base:/ADPF_OWNERS

include/private/performance_hint_private.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ int APerformanceHint_getThreadIds(APerformanceHintSession* session,
108108
APerformanceHintSession* APerformanceHint_createSessionInternal(APerformanceHintManager* manager,
109109
const int32_t* threadIds, size_t size,
110110
int64_t initialTargetWorkDurationNanos, SessionTag tag);
111+
/**
112+
* Creates a session using ASessionCreationConfig
113+
*/
114+
APerformanceHintSession* APerformanceHint_createSessionUsingConfigInternal(
115+
APerformanceHintManager* manager, ASessionCreationConfig* sessionCreationConfig,
116+
SessionTag tag);
111117

112118
/**
113119
* Creates a session from the Java SDK implementation
@@ -137,6 +143,10 @@ void APerformanceHint_getRateLimiterPropertiesForTesting(
137143
*/
138144
void APerformanceHint_setUseNewLoadHintBehaviorForTesting(bool newBehavior);
139145

146+
/*
147+
* Forces the graphics pipeline flag to be enabled or disabled, for testing only.
148+
*/
149+
void APerformanceHint_setUseGraphicsPipelineForTesting(bool enabled);
140150

141151
__END_DECLS
142152

libs/binder/trusty/RpcServerTrusty.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ int RpcServerTrusty::handleMessage(const tipc_port* /*port*/, handle_t /*chan*/,
151151

152152
int RpcServerTrusty::handleMessageInternal(void* ctx) {
153153
auto* channelContext = reinterpret_cast<ChannelContext*>(ctx);
154-
LOG_ALWAYS_FATAL_IF(channelContext == nullptr,
155-
"bad state: message received on uninitialized channel");
154+
if (channelContext == nullptr) {
155+
LOG_RPC_DETAIL("bad state: message received on uninitialized channel");
156+
return ERR_BAD_STATE;
157+
}
156158

157159
auto& session = channelContext->session;
158160
auto& connection = channelContext->connection;

libs/gui/SurfaceComposerClient.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,6 +3056,14 @@ void SurfaceComposerClient::setDisplayPowerMode(const sp<IBinder>& token,
30563056
ComposerServiceAIDL::getComposerService()->setPowerMode(token, mode);
30573057
}
30583058

3059+
status_t SurfaceComposerClient::getMaxLayerPictureProfiles(const sp<IBinder>& token,
3060+
int32_t* outMaxProfiles) {
3061+
binder::Status status =
3062+
ComposerServiceAIDL::getComposerService()->getMaxLayerPictureProfiles(token,
3063+
outMaxProfiles);
3064+
return statusTFromBinderStatus(status);
3065+
}
3066+
30593067
status_t SurfaceComposerClient::getCompositionPreference(
30603068
ui::Dataspace* defaultDataspace, ui::PixelFormat* defaultPixelFormat,
30613069
ui::Dataspace* wideColorGamutDataspace, ui::PixelFormat* wideColorGamutPixelFormat) {
@@ -3280,6 +3288,13 @@ status_t SurfaceComposerClient::removeHdrLayerInfoListener(
32803288
return statusTFromBinderStatus(status);
32813289
}
32823290

3291+
status_t SurfaceComposerClient::setActivePictureListener(
3292+
const sp<gui::IActivePictureListener>& listener) {
3293+
binder::Status status =
3294+
ComposerServiceAIDL::getComposerService()->setActivePictureListener(listener);
3295+
return statusTFromBinderStatus(status);
3296+
}
3297+
32833298
status_t SurfaceComposerClient::notifyPowerBoost(int32_t boostId) {
32843299
binder::Status status = ComposerServiceAIDL::getComposerService()->notifyPowerBoost(boostId);
32853300
return statusTFromBinderStatus(status);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package android.gui;
18+
19+
/**
20+
* Visible content that is using picture processing.
21+
* @hide
22+
*/
23+
parcelable ActivePicture {
24+
/** The layer ID that is using picture processing. */
25+
int layerId;
26+
27+
/** UID that owns layer using picture processing. */
28+
int ownerUid;
29+
30+
/** ID of the picture profile that was used to configure the picture processing. */
31+
long pictureProfileId;
32+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package android.gui;
18+
19+
import android.gui.ActivePicture;
20+
21+
/**
22+
* Receive callbacks whenever the visible content using picture profiles changes.
23+
* @hide
24+
*/
25+
interface IActivePictureListener {
26+
/**
27+
* Callback reporting the visible content on the screen using picture profiles.
28+
*/
29+
oneway void onActivePicturesChanged(in ActivePicture[] activePictures);
30+
}

0 commit comments

Comments
 (0)