From 972603845eda7e382451fcd31cd5083592f83ffd Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 15 Apr 2022 13:51:11 +0200 Subject: [PATCH] randr: No need to check RRGetOutputProperty() twice The function rrGetPixmapSharingSyncProp() will check for the PRIME sync property "PRIME Synchronization" on each output and return false if any of the output has this property set to false. To do so, it will call RRGetOutputProperty() twice for each output, once with pending true and once with pending false to cover both possibilities. However, reading the implementation of RRGetOutputProperty(), it appears that if the property is not pending, the code will return the current value even if invoked with pending true. So the second call to RRGetOutputProperty() with pending false seems superfluous. Signed-off-by: Olivier Fourdan Fixes: df8e86931e - randr: Add ability to turn PRIME sync off Reviewed-by: Alex Goins Tested-by: Alex Goins --- randr/rrcrtc.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 3a9b620ab..cf66f8ef9 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -461,20 +461,12 @@ rrGetPixmapSharingSyncProp(int numOutputs, RROutputPtr * outputs) for (o = 0; o < numOutputs; o++) { RRPropertyValuePtr val; - /* Try pending value first, then current value */ if ((val = RRGetOutputProperty(outputs[o], syncProp, TRUE)) && val->data) { if (!(*(char *) val->data)) return FALSE; continue; } - - if ((val = RRGetOutputProperty(outputs[o], syncProp, FALSE)) && - val->data) { - if (!(*(char *) val->data)) - return FALSE; - continue; - } } return TRUE;