X-Git-Url: https://git.ti.com/gitweb?p=android%2Fexternal-libkmsxx.git;a=blobdiff_plain;f=kms%2B%2B%2Fsrc%2Fmodedb.cpp;h=5d5d373ba95ca64bd7aa01c947094280b13e3679;hp=858c3d07f26ed428454d1d4499fdf65781d52340;hb=8e3d7e30e34ffb181a600e12e74727737e0c1f76;hpb=a7797a1361e72860072d84139bed316975572517 diff --git a/kms++/src/modedb.cpp b/kms++/src/modedb.cpp index 858c3d0..5d5d373 100644 --- a/kms++/src/modedb.cpp +++ b/kms++/src/modedb.cpp @@ -20,7 +20,24 @@ static const Videomode& find_from_table(const Videomode* modes, uint32_t width, if (ilace != m.interlace()) continue; - if (vrefresh && std::abs(m.calculated_vrefresh() - vrefresh) >= 0.001) + if (vrefresh && vrefresh != m.calculated_vrefresh()) + continue; + + return m; + } + + // If not found, do another round using rounded vrefresh + + for (unsigned i = 0; modes[i].clock; ++i) { + const Videomode& m = modes[i]; + + if (m.hdisplay != width || m.vdisplay != height) + continue; + + if (ilace != m.interlace()) + continue; + + if (vrefresh && vrefresh != roundf(m.calculated_vrefresh())) continue; return m;