From c76667cf717fdf0200f08ec0e2e0b1406e998c82 Mon Sep 17 00:00:00 2001 From: Derek Dai Date: Tue, 11 Oct 2016 10:32:22 +0800 Subject: [PATCH] match resolution from high to low --- src/ctl/wfd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ctl/wfd.c b/src/ctl/wfd.c index 370221f..15b145e 100644 --- a/src/ctl/wfd.c +++ b/src/ctl/wfd.c @@ -174,7 +174,7 @@ int vfd_get_cea_resolution(uint32_t mask, int *hres, int *vres) if (!mask) return -EINVAL; - for (i = 0; resolutions_cea[i].hres != 0; i++) { + for (i = N_ELEMENTS(resolutions_cea) - 1; i >= 0; --i) { if ((1 << resolutions_cea[i].index) & mask) { *vres = resolutions_cea[i].vres; *hres = resolutions_cea[i].hres; @@ -191,7 +191,7 @@ int vfd_get_vesa_resolution(uint32_t mask, int *hres, int *vres) if (!mask) return -EINVAL; - for (i = 0; resolutions_vesa[i].hres != 0; i++) { + for (N_ELEMENTS(resolutions_vesa) - 1; i >= 0; --i) { if ((1 << resolutions_vesa[i].index) & mask) { *vres = resolutions_vesa[i].vres; *hres = resolutions_vesa[i].hres; @@ -208,7 +208,7 @@ int vfd_get_hh_resolution(uint32_t mask, int *hres, int *vres) if (!mask) return -EINVAL; - for (i = 0; resolutions_hh[i].hres != 0; i++) { + for (N_ELEMENTS(resolutions_hh); i >= 0; --i) { if ((1 << resolutions_hh[i].index) & mask) { *vres = resolutions_hh[i].vres; *hres = resolutions_hh[i].hres;