From f33472a1fccfd670866d55a7d0a3f258f119ac77 Mon Sep 17 00:00:00 2001 From: celtare21 Date: Sat, 26 Nov 2022 07:22:52 -0500 Subject: [PATCH] mfc: Reduce QoS boosting from Samsung hacks By default, everything is set to 240fps for optimal playback performance However, the situation is not always true, as it applies to cases when the video bitrate isn't necessarily high, causing high power consumption Reduce and limit the boosting needed. For decoder, only apply for UHD video resolution Original commit: https://github.com/diepquynh/android_kernel_samsung_universal8895/commit/9f3a1c7d5a8f1d595b179e0ff071b574d6854543 Signed-off-by: celtare21 --- drivers/media/platform/exynos/mfc/mfc_qos.c | 3 ++- drivers/media/platform/exynos/mfc/mfc_qos.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/mfc_qos.c b/drivers/media/platform/exynos/mfc/mfc_qos.c index 9121ee8abc82..a796f24a70f6 100644 --- a/drivers/media/platform/exynos/mfc/mfc_qos.c +++ b/drivers/media/platform/exynos/mfc/mfc_qos.c @@ -360,5 +360,6 @@ void mfc_qos_update_last_framerate(struct mfc_ctx *ctx, u64 timestamp) ctx->last_framerate = __mfc_qos_get_fps_by_timestamp(ctx, &time); if (ctx->last_framerate > MFC_MAX_FPS) ctx->last_framerate = MFC_MAX_FPS; - ctx->last_framerate = (ctx->qos_ratio * ctx->last_framerate) / 100; + if (!(ctx->type == MFCINST_DECODER && !IS_UHD_RES(ctx))) + ctx->last_framerate = (ctx->qos_ratio * ctx->last_framerate) / 100; } diff --git a/drivers/media/platform/exynos/mfc/mfc_qos.h b/drivers/media/platform/exynos/mfc/mfc_qos.h index 811533367719..e18ef0cb67ce 100644 --- a/drivers/media/platform/exynos/mfc/mfc_qos.h +++ b/drivers/media/platform/exynos/mfc/mfc_qos.h @@ -36,7 +36,7 @@ static inline int __mfc_timespec64_compare(const struct timespec64 *lhs, const s static inline void mfc_qos_reset_framerate(struct mfc_ctx *ctx) { if (ctx->type == MFCINST_DECODER) - ctx->framerate = DEC_DEFAULT_FPS; + ctx->framerate = 60000; // 60fps else if (ctx->type == MFCINST_ENCODER) ctx->framerate = ENC_DEFAULT_FPS; }