From 7ab42bf375668e367b593d94ed05059bea13a7cd Mon Sep 17 00:00:00 2001 From: Martin Donlon Date: Wed, 10 Aug 2022 04:08:40 -0700 Subject: [PATCH] Initialize has_gamma in video_init (#675) It was being initialize as a side effect of calling setGamma, but setGamma could early out if no gamma cfg was set already. --- video.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/video.cpp b/video.cpp index 9548695..8e4eb26 100644 --- a/video.cpp +++ b/video.cpp @@ -649,7 +649,7 @@ static void loadScalerCfg() static char active_gamma_cfg[1024] = { 0 }; static char gamma_cfg[1024] = { 0 }; -static char has_gamma = 0; +static char has_gamma = 0; // set in video_init static void setGamma() { @@ -660,15 +660,7 @@ static void setGamma() fileTextReader reader = {}; static char filename[1024]; - if (!spi_uio_cmd_cont(UIO_SET_GAMMA)) - { - DisableIO(); - return; - } - - has_gamma = 1; - spi8(0); - DisableIO(); + if (!has_gamma) return; snprintf(filename, sizeof(filename), GAMMA_DIR"/%s", gamma_cfg + 1); @@ -2003,6 +1995,8 @@ void video_init() hdmi_config_init(); video_mode_load(); + has_gamma = spi_uio_cmd(UIO_SET_GAMMA); + loadGammaCfg(); loadScalerCfg(); loadShadowMaskCfg();