From: Chia-I Wu Date: Sun, 21 Feb 2010 02:11:54 +0000 (+0800) Subject: st/egl: Properly convert vrefresh to refresh rate. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dbaa84515318c3cf1d4be67fc10ca3bd6bc00e0f;p=mesa.git st/egl: Properly convert vrefresh to refresh rate. Some kernels have vrefresh = (refresh rate * 1000) while others don't. Use some heuristics here. --- diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c index 91cefc538d1..ee6ab2e60b8 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ b/src/gallium/state_trackers/egl/kms/native_kms.c @@ -499,7 +499,10 @@ kms_display_get_modes(struct native_display *ndpy, kmode->base.desc = kmode->mode.name; kmode->base.width = kmode->mode.hdisplay; kmode->base.height = kmode->mode.vdisplay; - kmode->base.refresh_rate = kmode->mode.vrefresh / 1000; + kmode->base.refresh_rate = kmode->mode.vrefresh; + /* not all kernels have vrefresh = refresh_rate * 1000 */ + if (kmode->base.refresh_rate > 1000) + kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000; } nmodes_return = malloc(count * sizeof(*nmodes_return));