Skip to content

Commit

Permalink
display: revert old vrefresh heuristic, should regain proper startup …
Browse files Browse the repository at this point in the history
…refresh and at-reset refresh

FossilOrigin-Name: a3c2249828c4498d04968fd8b7807fd9bc6ad514521b2dd493041f6bde9d9042
  • Loading branch information
void committed Mar 21, 2024
1 parent bcde972 commit 0bbd0ca
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions durden/display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ local function set_best_mode(disp, desw, desh)
desh = disp.h;
end

-- just score based on match against w/h
-- just score based on match against w/h and refresh
table.sort(list, function(a, b)
local dx = desw - a.width;
local dy = desh - a.height;
Expand All @@ -305,17 +305,15 @@ local function set_best_mode(disp, desw, desh)
dy = desh - b.height;
local eb = math.sqrt((dx * dx) + (dy * dy));

-- same resolution? take the matching refresh, not the highest as that would
-- excluding have a device- profile override
if (ea == eb) then
return math.abs(disp.refresh - a.refresh) > math.abs(disp.refresh - b.refresh);
if (math.floor(ea) == math.floor(eb)) then
return a.refresh > b.refresh;
end

return ea < eb;
end);

display_log(
fmt("mode_set:display=%d:width=%d:height=%d:refresh=%d",
fmt("mode_set_best:display=%d:width=%d:height=%d:refresh=%d",
disp.id, list[1].width, list[1].height, list[1].refresh)
);

Expand Down

0 comments on commit 0bbd0ca

Please sign in to comment.