Loading include/android/imagedecoder.h +2 −1 Original line number Diff line number Diff line Loading @@ -331,7 +331,8 @@ size_t AImageDecoder_getMinimumStride(AImageDecoder*) __INTRODUCED_IN(30); * {@link AImageDecoder_getMinimumStride}. * @param size Size of the pixel buffer in bytes. Must be at least * stride * (height - 1) + * {@link AImageDecoder_getMinimumStride}. * {@link AImageDecoder_getMinimumStride}. Must also be a multiple * of the bytes per pixel of the {@link AndroidBitmapFormat}. * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success, or an error code * from the same enum describing the failure. */ Loading libs/cputimeinstate/cputimeinstate.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ namespace bpf { static std::mutex gInitializedMutex; static bool gInitialized = false; static std::mutex gTrackingMutex; static bool gTracking = false; static uint32_t gNPolicies = 0; static uint32_t gNCpus = 0; static std::vector<std::vector<uint32_t>> gPolicyFreqs; Loading Loading @@ -161,7 +163,9 @@ static bool attachTracepointProgram(const std::string &eventType, const std::str // This function should *not* be called while tracking is already active; doing so is unnecessary // and can lead to accounting errors. bool startTrackingUidTimes() { std::lock_guard<std::mutex> guard(gTrackingMutex); if (!initGlobals()) return false; if (gTracking) return true; unique_fd cpuPolicyFd(bpf_obj_get_wronly(BPF_FS_PATH "map_time_in_state_cpu_policy_map")); if (cpuPolicyFd < 0) return false; Loading Loading @@ -209,8 +213,9 @@ bool startTrackingUidTimes() { if (writeToMapEntry(policyFreqIdxFd, &i, &zero, BPF_ANY)) return false; } return attachTracepointProgram("sched", "sched_switch") && gTracking = attachTracepointProgram("sched", "sched_switch") && attachTracepointProgram("power", "cpu_frequency"); return gTracking; } std::optional<std::vector<std::vector<uint32_t>>> getCpuFreqs() { Loading libs/dumputils/dump_utils.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ static const char* hal_interfaces_to_dump[] { "android.hardware.audio@2.0::IDevicesFactory", "android.hardware.audio@4.0::IDevicesFactory", "android.hardware.audio@5.0::IDevicesFactory", "android.hardware.audio@6.0::IDevicesFactory", "android.hardware.biometrics.face@1.0::IBiometricsFace", "android.hardware.bluetooth@1.0::IBluetoothHci", "android.hardware.camera.provider@2.4::ICameraProvider", Loading libs/gui/BLASTBufferQueue.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ void BLASTBufferQueue::processNextBufferLocked() { t->setCrop(mSurfaceControl, computeCrop(bufferItem)); t->setTransform(mSurfaceControl, bufferItem.mTransform); t->setTransformToDisplayInverse(mSurfaceControl, bufferItem.mTransformToDisplayInverse); t->setDesiredPresentTime(bufferItem.mTimestamp); if (applyTransaction) { t->apply(); Loading libs/gui/tests/BLASTBufferQueue_test.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,33 @@ TEST_F(BLASTBufferQueueTest, SetNextTransaction) { ASSERT_EQ(&next, adapter.getNextTransaction()); } TEST_F(BLASTBufferQueueTest, onFrameAvailable_ApplyDesiredPresentTime) { BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); sp<IGraphicBufferProducer> igbProducer; setUpProducer(adapter, igbProducer); int slot; sp<Fence> fence; sp<GraphicBuffer> buf; auto ret = igbProducer->dequeueBuffer(&slot, &fence, mDisplayWidth, mDisplayHeight, PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, nullptr, nullptr); ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); nsecs_t desiredPresentTime = systemTime() + nsecs_t(5 * 1e8); IGraphicBufferProducer::QueueBufferOutput qbOutput; IGraphicBufferProducer::QueueBufferInput input(desiredPresentTime, false, HAL_DATASPACE_UNKNOWN, Rect(mDisplayWidth, mDisplayHeight), NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, Fence::NO_FENCE); igbProducer->queueBuffer(slot, input, &qbOutput); ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); adapter.waitForCallbacks(); ASSERT_GE(systemTime(), desiredPresentTime); } TEST_F(BLASTBufferQueueTest, onFrameAvailable_Apply) { uint8_t r = 255; uint8_t g = 0; Loading Loading
include/android/imagedecoder.h +2 −1 Original line number Diff line number Diff line Loading @@ -331,7 +331,8 @@ size_t AImageDecoder_getMinimumStride(AImageDecoder*) __INTRODUCED_IN(30); * {@link AImageDecoder_getMinimumStride}. * @param size Size of the pixel buffer in bytes. Must be at least * stride * (height - 1) + * {@link AImageDecoder_getMinimumStride}. * {@link AImageDecoder_getMinimumStride}. Must also be a multiple * of the bytes per pixel of the {@link AndroidBitmapFormat}. * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success, or an error code * from the same enum describing the failure. */ Loading
libs/cputimeinstate/cputimeinstate.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ namespace bpf { static std::mutex gInitializedMutex; static bool gInitialized = false; static std::mutex gTrackingMutex; static bool gTracking = false; static uint32_t gNPolicies = 0; static uint32_t gNCpus = 0; static std::vector<std::vector<uint32_t>> gPolicyFreqs; Loading Loading @@ -161,7 +163,9 @@ static bool attachTracepointProgram(const std::string &eventType, const std::str // This function should *not* be called while tracking is already active; doing so is unnecessary // and can lead to accounting errors. bool startTrackingUidTimes() { std::lock_guard<std::mutex> guard(gTrackingMutex); if (!initGlobals()) return false; if (gTracking) return true; unique_fd cpuPolicyFd(bpf_obj_get_wronly(BPF_FS_PATH "map_time_in_state_cpu_policy_map")); if (cpuPolicyFd < 0) return false; Loading Loading @@ -209,8 +213,9 @@ bool startTrackingUidTimes() { if (writeToMapEntry(policyFreqIdxFd, &i, &zero, BPF_ANY)) return false; } return attachTracepointProgram("sched", "sched_switch") && gTracking = attachTracepointProgram("sched", "sched_switch") && attachTracepointProgram("power", "cpu_frequency"); return gTracking; } std::optional<std::vector<std::vector<uint32_t>>> getCpuFreqs() { Loading
libs/dumputils/dump_utils.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ static const char* hal_interfaces_to_dump[] { "android.hardware.audio@2.0::IDevicesFactory", "android.hardware.audio@4.0::IDevicesFactory", "android.hardware.audio@5.0::IDevicesFactory", "android.hardware.audio@6.0::IDevicesFactory", "android.hardware.biometrics.face@1.0::IBiometricsFace", "android.hardware.bluetooth@1.0::IBluetoothHci", "android.hardware.camera.provider@2.4::ICameraProvider", Loading
libs/gui/BLASTBufferQueue.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ void BLASTBufferQueue::processNextBufferLocked() { t->setCrop(mSurfaceControl, computeCrop(bufferItem)); t->setTransform(mSurfaceControl, bufferItem.mTransform); t->setTransformToDisplayInverse(mSurfaceControl, bufferItem.mTransformToDisplayInverse); t->setDesiredPresentTime(bufferItem.mTimestamp); if (applyTransaction) { t->apply(); Loading
libs/gui/tests/BLASTBufferQueue_test.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,33 @@ TEST_F(BLASTBufferQueueTest, SetNextTransaction) { ASSERT_EQ(&next, adapter.getNextTransaction()); } TEST_F(BLASTBufferQueueTest, onFrameAvailable_ApplyDesiredPresentTime) { BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); sp<IGraphicBufferProducer> igbProducer; setUpProducer(adapter, igbProducer); int slot; sp<Fence> fence; sp<GraphicBuffer> buf; auto ret = igbProducer->dequeueBuffer(&slot, &fence, mDisplayWidth, mDisplayHeight, PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, nullptr, nullptr); ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); nsecs_t desiredPresentTime = systemTime() + nsecs_t(5 * 1e8); IGraphicBufferProducer::QueueBufferOutput qbOutput; IGraphicBufferProducer::QueueBufferInput input(desiredPresentTime, false, HAL_DATASPACE_UNKNOWN, Rect(mDisplayWidth, mDisplayHeight), NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, Fence::NO_FENCE); igbProducer->queueBuffer(slot, input, &qbOutput); ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); adapter.waitForCallbacks(); ASSERT_GE(systemTime(), desiredPresentTime); } TEST_F(BLASTBufferQueueTest, onFrameAvailable_Apply) { uint8_t r = 255; uint8_t g = 0; Loading