[FFmpeg-devel] [PATCH 07/16] hwcontext_nvtegra: add dynamic frequency scaling routines

averne averne381 at gmail.com
Sat Jun 29 22:35:42 EEST 2024


Le 05/06/2024 à 22:50, Mark Thompson a écrit :
> On 30/05/2024 20:43, averne wrote:
>> To save on energy, the clock speed of multimedia engines should be adapted to their workload.
>>
>> Signed-off-by: averne <averne381 at gmail.com>
>> ---
>>  libavutil/hwcontext_nvtegra.c | 165 ++++++++++++++++++++++++++++++++++
>>  libavutil/hwcontext_nvtegra.h |   7 ++
>>  2 files changed, 172 insertions(+)
>>
>> ...
>> diff --git a/libavutil/hwcontext_nvtegra.h b/libavutil/hwcontext_nvtegra.h
>> index 8a2383d304..7c845951d9 100644
>> --- a/libavutil/hwcontext_nvtegra.h
>> +++ b/libavutil/hwcontext_nvtegra.h
>> @@ -82,4 +82,11 @@ static inline AVNVTegraMap *av_nvtegra_frame_get_fbuf_map(const AVFrame *frame)
>>   */
>>  int av_nvtegra_pixfmt_to_vic(enum AVPixelFormat fmt);
>>  
>> +/*
>> + * Dynamic frequency scaling routines
>> + */
>> +int av_nvtegra_dfs_init(AVHWDeviceContext *ctx, AVNVTegraChannel *channel, int width, int height, double framerate_hz);
>> +int av_nvtegra_dfs_update(AVHWDeviceContext *ctx, AVNVTegraChannel *channel, int bitstream_len, int decode_cycles);
>> +int av_nvtegra_dfs_uninit(AVHWDeviceContext *ctx, AVNVTegraChannel *channel);
>> +
>>  #endif /* AVUTIL_HWCONTEXT_NVTEGRA_H */
>
> This really isn't a sensible thing to have in the public API of ffmpeg.  Why on earth isn't this sort of detail dealt with by the kernel?  (Which can actually see all of the different processes using it, as well.)
>
> Thanks,
>
> - Mark

I completely agree but this is how nvidia does it, as dumb as it may 
seem (at least on Tegra, I don't know about discrete GPUs).
As far as I can tell the kernel has no mechanism in place to monitor 
the occupancy of the decode engine.


More information about the ffmpeg-devel mailing list