[FFmpeg-devel] [PATCH] metal: Add hint to select low power device instead of the default one
Jérémy Demeule
jeremy.demeule at gmail.com
Tue Sep 5 00:58:13 EEST 2023
SDL >= 2.28.3 introduce a renderer hint to allow selection of low-power
device on default macOS backend (i.e. metal).
<TLDR>
On some system like MacBook Pro Intel with AMD card, asking for the
default device will always return the AMD GPU.
This is not an issue for 99% of the case when the renderer context is
here to provide the maximum performance level like for game.
However, for video application using GPU for 1 quad and 1 texture,
using the discrete GPU for that lead to an important power consumption
(4 to 8W), heat increase, and fan noise.
With this patch, ffplay will use the integrated GPU (i.e. the Intel
one), instead of the discrete GPU (i.e. the AMD one).
Signed-off-by: Jérémy Demeule <jeremy.demeule at gmail.com>
---
fftools/ffplay.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 5212ad053e..e766d502a8 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3712,6 +3712,9 @@ int main(int argc, char **argv)
#endif
window = SDL_CreateWindow(program_name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, default_width, default_height, flags);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
+#if SDL_VERSION_ATLEAST(2,28,3)
+ SDL_SetHint(SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE, "true");
+#endif
if (window) {
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
if (!renderer) {
--
2.39.0
More information about the ffmpeg-devel
mailing list