Commit 99e55f1b authored by Roman Gilg's avatar Roman Gilg

present: Adjust timings with value arguments

We can use value arguments instead of pointers when adjusting the timings
by returning the adjusted value. This improves the readability.
Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
Reviewed-by: Michel Dänzer's avatarMichel Dänzer <michel.daenzer@amd.com>
parent 4709d24f
......@@ -157,31 +157,32 @@ present_can_window_flip(WindowPtr window)
return screen_priv->can_window_flip(window);
}
void
present_adjust_timings(uint32_t options,
uint64_t *crtc_msc,
uint64_t *target_msc,
uint64_t
present_get_target_msc(uint32_t options,
uint64_t crtc_msc,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder)
{
/* Adjust target_msc to match modulus
*/
if (msc_is_equal_or_after(*crtc_msc, *target_msc)) {
if (msc_is_equal_or_after(crtc_msc, target_msc)) {
if (divisor != 0) {
*target_msc = *crtc_msc - (*crtc_msc % divisor) + remainder;
target_msc = crtc_msc - (crtc_msc % divisor) + remainder;
if (options & PresentOptionAsync) {
if (msc_is_after(*crtc_msc, *target_msc))
*target_msc += divisor;
if (msc_is_after(crtc_msc, target_msc))
target_msc += divisor;
} else {
if (msc_is_equal_or_after(*crtc_msc, *target_msc))
*target_msc += divisor;
if (msc_is_equal_or_after(crtc_msc, target_msc))
target_msc += divisor;
}
} else {
*target_msc = *crtc_msc;
target_msc = crtc_msc;
if (!(options & PresentOptionAsync))
(*target_msc)++;
(target_msc)++;
}
}
return target_msc;
}
int
......
......@@ -279,10 +279,10 @@ present_set_tree_pixmap(WindowPtr window,
PixmapPtr expected,
PixmapPtr pixmap);
void
present_adjust_timings(uint32_t options,
uint64_t *crtc_msc,
uint64_t *target_msc,
uint64_t
present_get_target_msc(uint32_t options,
uint64_t crtc_msc,
uint64_t target_msc,
uint64_t divisor,
uint64_t remainder);
......
......@@ -690,11 +690,11 @@ present_scmd_pixmap(WindowPtr window,
window_priv->msc = crtc_msc;
}
present_adjust_timings(options,
&crtc_msc,
&target_msc,
divisor,
remainder);
target_msc = present_get_target_msc(options,
crtc_msc,
target_msc,
divisor,
remainder);
/*
* Look for a matching presentation already on the list and
......
......@@ -582,11 +582,11 @@ present_wnmd_pixmap(WindowPtr window,
window_priv->msc = crtc_msc;
}
present_adjust_timings(options,
&crtc_msc,
&target_msc,
divisor,
remainder);
target_msc = present_get_target_msc(options,
crtc_msc,
target_msc,
divisor,
remainder);
/*
* Look for a matching presentation already on the list...
......
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