Loading libs/renderengine/skia/ColorSpaces.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,15 @@ sk_sp<SkColorSpace> toSkColorSpace(ui::Dataspace dataspace) { case HAL_DATASPACE_TRANSFER_SMPTE_170M: return SkColorSpace::MakeRGB(SkNamedTransferFn::kRec2020, gamut); case HAL_DATASPACE_TRANSFER_HLG: return SkColorSpace::MakeRGB(SkNamedTransferFn::kHLG, gamut); // return HLG transfer but scale by 1/12 skcms_TransferFunction hlgFn; if (skcms_TransferFunction_makeScaledHLGish(&hlgFn, 1.f / 12.f, 2.f, 2.f, 1.f / 0.17883277f, 0.28466892f, 0.55991073f)) { return SkColorSpace::MakeRGB(hlgFn, gamut); } else { return SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, gamut); } case HAL_DATASPACE_TRANSFER_UNSPECIFIED: default: return SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, gamut); Loading services/gpuservice/gpuwork/bpfprogs/gpu_work.c +20 −13 Original line number Diff line number Diff line Loading @@ -71,11 +71,14 @@ DEFINE_BPF_MAP_GRW(gpu_work_global_data, ARRAY, uint32_t, GlobalData, 1, AID_GRA // // The |total_active_duration_ns| must be set to the approximate total amount of // time the GPU spent running work for |uid| within the period, without // "double-counting" parallel GPU work on the same GPU for the same |uid|. "GPU // work" should correspond to the "GPU slices" shown in the AGI (Android GPU // "double-counting" parallel GPU work on the same GPU for the same |uid|. Note // that even if the parallel GPU work was submitted from several different // processes (i.e. different PIDs) with the same UID, this overlapping work must // not be double-counted, as it still came from a single |uid|. "GPU work" // should correspond to the "GPU slices" shown in the AGI (Android GPU // Inspector) tool, and so should include work such as fragment and non-fragment // work/shaders running on the shader cores of the GPU. For example, given the // following: // following for a single |uid|: // - A period has: // - |start_time_ns|: 100,000,000 ns // - |end_time_ns|: 800,000,000 ns Loading @@ -99,16 +102,20 @@ DEFINE_BPF_MAP_GRW(gpu_work_global_data, ARRAY, uint32_t, GlobalData, 1, AID_GRA // - from 600,000,000 ns to 700,000,000 ns, giving a duration of 100,000,000 ns // (GPU work D) // // Thus, the |total_active_duration_ns| is the sum of the (non-overlapping) // durations. Drivers may not have efficient access to the exact start and end // times of all GPU work, as shown above, but drivers should try to // approximate/aggregate the value of |total_active_duration_ns| as accurately // as possible within the limitations of the hardware, without double-counting // parallel GPU work for the same |uid|. The |total_active_duration_ns| value // must be less than or equal to the period duration (|end_time_ns| - // |start_time_ns|); if the aggregation approach might violate this requirement // then the driver must clamp |total_active_duration_ns| to be at most the // period duration. // Thus, the |total_active_duration_ns| is the sum of these two // (non-overlapping) durations. Drivers may not have efficient access to the // exact start and end times of all GPU work, as shown above, but drivers should // try to approximate/aggregate the value of |total_active_duration_ns| as // accurately as possible within the limitations of the hardware, without // double-counting parallel GPU work for the same |uid|. The // |total_active_duration_ns| value must be less than or equal to the period // duration (|end_time_ns| - |start_time_ns|); if the aggregation approach might // violate this requirement then the driver must clamp // |total_active_duration_ns| to be at most the period duration. // // Protected mode: protected GPU work must not be reported. Periods must be // emitted, and the |total_active_duration_ns| value set, as if the protected // GPU work did not occur. // // Note that the above description allows for a certain amount of flexibility in // how the driver tracks periods and emits the events. We list a few examples of Loading services/surfaceflinger/CompositionEngine/src/Display.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,7 @@ void Display::beginFrame() { physicalDisplayId && getState().displayBrightness) { const status_t result = hwc.setDisplayBrightness(*physicalDisplayId, *getState().displayBrightness, getState().displayBrightnessNits, Hwc2::Composer::DisplayBrightnessOptions{ .applyImmediately = false}) .get(); Loading services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -640,8 +640,9 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithDisplayBrightnes // values, use a Sequence to control the matching so the values are returned in a known // order. constexpr float kDisplayBrightness = 0.5f; constexpr float kDisplayBrightnessNits = 200.f; EXPECT_CALL(mHwComposer, setDisplayBrightness(DEFAULT_DISPLAY_ID, kDisplayBrightness, setDisplayBrightness(DEFAULT_DISPLAY_ID, kDisplayBrightness, kDisplayBrightnessNits, Hwc2::Composer::DisplayBrightnessOptions{.applyImmediately = false})) .WillOnce(Return(ByMove(ftl::yield<status_t>(NO_ERROR)))); Loading @@ -650,6 +651,7 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithDisplayBrightnes mock::RenderSurface* renderSurface = new StrictMock<mock::RenderSurface>(); EXPECT_CALL(*renderSurface, beginFrame(_)).Times(1); mDisplay->setRenderSurfaceForTest(std::unique_ptr<RenderSurface>(renderSurface)); mDisplay->editState().displayBrightnessNits = kDisplayBrightnessNits; mDisplay->beginFrame(); auto& state = mDisplay->getState(); Loading services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h +2 −2 Original line number Diff line number Diff line Loading @@ -84,8 +84,8 @@ public: MOCK_METHOD4(setDisplayContentSamplingEnabled, status_t(HalDisplayId, bool, uint8_t, uint64_t)); MOCK_METHOD4(getDisplayedContentSample, status_t(HalDisplayId, uint64_t, uint64_t, DisplayedFrameStats*)); MOCK_METHOD3(setDisplayBrightness, std::future<status_t>(PhysicalDisplayId, float, MOCK_METHOD4(setDisplayBrightness, std::future<status_t>(PhysicalDisplayId, float, float, const Hwc2::Composer::DisplayBrightnessOptions&)); MOCK_METHOD2(getDisplayBrightnessSupport, status_t(PhysicalDisplayId, bool*)); Loading Loading
libs/renderengine/skia/ColorSpaces.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,15 @@ sk_sp<SkColorSpace> toSkColorSpace(ui::Dataspace dataspace) { case HAL_DATASPACE_TRANSFER_SMPTE_170M: return SkColorSpace::MakeRGB(SkNamedTransferFn::kRec2020, gamut); case HAL_DATASPACE_TRANSFER_HLG: return SkColorSpace::MakeRGB(SkNamedTransferFn::kHLG, gamut); // return HLG transfer but scale by 1/12 skcms_TransferFunction hlgFn; if (skcms_TransferFunction_makeScaledHLGish(&hlgFn, 1.f / 12.f, 2.f, 2.f, 1.f / 0.17883277f, 0.28466892f, 0.55991073f)) { return SkColorSpace::MakeRGB(hlgFn, gamut); } else { return SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, gamut); } case HAL_DATASPACE_TRANSFER_UNSPECIFIED: default: return SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, gamut); Loading
services/gpuservice/gpuwork/bpfprogs/gpu_work.c +20 −13 Original line number Diff line number Diff line Loading @@ -71,11 +71,14 @@ DEFINE_BPF_MAP_GRW(gpu_work_global_data, ARRAY, uint32_t, GlobalData, 1, AID_GRA // // The |total_active_duration_ns| must be set to the approximate total amount of // time the GPU spent running work for |uid| within the period, without // "double-counting" parallel GPU work on the same GPU for the same |uid|. "GPU // work" should correspond to the "GPU slices" shown in the AGI (Android GPU // "double-counting" parallel GPU work on the same GPU for the same |uid|. Note // that even if the parallel GPU work was submitted from several different // processes (i.e. different PIDs) with the same UID, this overlapping work must // not be double-counted, as it still came from a single |uid|. "GPU work" // should correspond to the "GPU slices" shown in the AGI (Android GPU // Inspector) tool, and so should include work such as fragment and non-fragment // work/shaders running on the shader cores of the GPU. For example, given the // following: // following for a single |uid|: // - A period has: // - |start_time_ns|: 100,000,000 ns // - |end_time_ns|: 800,000,000 ns Loading @@ -99,16 +102,20 @@ DEFINE_BPF_MAP_GRW(gpu_work_global_data, ARRAY, uint32_t, GlobalData, 1, AID_GRA // - from 600,000,000 ns to 700,000,000 ns, giving a duration of 100,000,000 ns // (GPU work D) // // Thus, the |total_active_duration_ns| is the sum of the (non-overlapping) // durations. Drivers may not have efficient access to the exact start and end // times of all GPU work, as shown above, but drivers should try to // approximate/aggregate the value of |total_active_duration_ns| as accurately // as possible within the limitations of the hardware, without double-counting // parallel GPU work for the same |uid|. The |total_active_duration_ns| value // must be less than or equal to the period duration (|end_time_ns| - // |start_time_ns|); if the aggregation approach might violate this requirement // then the driver must clamp |total_active_duration_ns| to be at most the // period duration. // Thus, the |total_active_duration_ns| is the sum of these two // (non-overlapping) durations. Drivers may not have efficient access to the // exact start and end times of all GPU work, as shown above, but drivers should // try to approximate/aggregate the value of |total_active_duration_ns| as // accurately as possible within the limitations of the hardware, without // double-counting parallel GPU work for the same |uid|. The // |total_active_duration_ns| value must be less than or equal to the period // duration (|end_time_ns| - |start_time_ns|); if the aggregation approach might // violate this requirement then the driver must clamp // |total_active_duration_ns| to be at most the period duration. // // Protected mode: protected GPU work must not be reported. Periods must be // emitted, and the |total_active_duration_ns| value set, as if the protected // GPU work did not occur. // // Note that the above description allows for a certain amount of flexibility in // how the driver tracks periods and emits the events. We list a few examples of Loading
services/surfaceflinger/CompositionEngine/src/Display.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,7 @@ void Display::beginFrame() { physicalDisplayId && getState().displayBrightness) { const status_t result = hwc.setDisplayBrightness(*physicalDisplayId, *getState().displayBrightness, getState().displayBrightnessNits, Hwc2::Composer::DisplayBrightnessOptions{ .applyImmediately = false}) .get(); Loading
services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -640,8 +640,9 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithDisplayBrightnes // values, use a Sequence to control the matching so the values are returned in a known // order. constexpr float kDisplayBrightness = 0.5f; constexpr float kDisplayBrightnessNits = 200.f; EXPECT_CALL(mHwComposer, setDisplayBrightness(DEFAULT_DISPLAY_ID, kDisplayBrightness, setDisplayBrightness(DEFAULT_DISPLAY_ID, kDisplayBrightness, kDisplayBrightnessNits, Hwc2::Composer::DisplayBrightnessOptions{.applyImmediately = false})) .WillOnce(Return(ByMove(ftl::yield<status_t>(NO_ERROR)))); Loading @@ -650,6 +651,7 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithDisplayBrightnes mock::RenderSurface* renderSurface = new StrictMock<mock::RenderSurface>(); EXPECT_CALL(*renderSurface, beginFrame(_)).Times(1); mDisplay->setRenderSurfaceForTest(std::unique_ptr<RenderSurface>(renderSurface)); mDisplay->editState().displayBrightnessNits = kDisplayBrightnessNits; mDisplay->beginFrame(); auto& state = mDisplay->getState(); Loading
services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h +2 −2 Original line number Diff line number Diff line Loading @@ -84,8 +84,8 @@ public: MOCK_METHOD4(setDisplayContentSamplingEnabled, status_t(HalDisplayId, bool, uint8_t, uint64_t)); MOCK_METHOD4(getDisplayedContentSample, status_t(HalDisplayId, uint64_t, uint64_t, DisplayedFrameStats*)); MOCK_METHOD3(setDisplayBrightness, std::future<status_t>(PhysicalDisplayId, float, MOCK_METHOD4(setDisplayBrightness, std::future<status_t>(PhysicalDisplayId, float, float, const Hwc2::Composer::DisplayBrightnessOptions&)); MOCK_METHOD2(getDisplayBrightnessSupport, status_t(PhysicalDisplayId, bool*)); Loading