Commit d1fbdd86 authored by magchen's avatar magchen Committed by Commit Bot

Add refresh rate for about://gpu in Linux

Some gpu bugs are related to the monitor refresh rate. Adding this display
information will help us on gpu debugging.

Bug:964095

Change-Id: Ieaea44502c14a0eba7b0f664d402474d3694616e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1629176Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664482}
parent b592eaee
......@@ -101,6 +101,21 @@ void ClipWorkArea(std::vector<display::Display>* displays,
primary.set_work_area(work_area);
}
int GetRefreshRateFromXRRModeInfo(XRRModeInfo* modes,
int num_of_mode,
RRMode current_mode_id) {
for (int i = 0; i < num_of_mode; i++) {
XRRModeInfo mode_info = modes[i];
if (mode_info.id != current_mode_id)
continue;
if (!mode_info.hTotal || !mode_info.vTotal)
return 0;
// Refresh Rate = Pixel Clock / (Horizontal Total * Vertical Total)
return mode_info.dotClock / (mode_info.hTotal * mode_info.vTotal);
}
return 0;
}
} // namespace
int GetXrandrVersion(XDisplay* xdisplay) {
......@@ -235,6 +250,11 @@ std::vector<display::Display> BuildDisplaysFromXRandRInfo(
display.set_color_space(icc_profile.GetPrimariesOnlyColorSpace());
}
// Set monitor refresh rate
int refresh_rate = GetRefreshRateFromXRRModeInfo(
resources->modes, resources->nmode, crtc->mode);
display.set_display_frequency(refresh_rate);
displays.push_back(display);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment