drm: improve preferred flag comparison in compare_modes
Two preferred modes shouldn't happen, but this ensures a copy-paste for another flag doesn't result in mis-sorted modes and it's more consistent with the rest of the logic.
This commit is contained in:
parent
90693b72cd
commit
ce4699fc6d
1 changed files with 4 additions and 4 deletions
|
@ -319,10 +319,10 @@ static bool compare_modes( drmModeModeInfo mode1, drmModeModeInfo mode2 )
|
||||||
if (goodRefresh1 != goodRefresh2)
|
if (goodRefresh1 != goodRefresh2)
|
||||||
return goodRefresh1;
|
return goodRefresh1;
|
||||||
|
|
||||||
if (mode1.type & DRM_MODE_TYPE_PREFERRED)
|
bool preferred1 = mode1.type & DRM_MODE_TYPE_PREFERRED;
|
||||||
return true;
|
bool preferred2 = mode2.type & DRM_MODE_TYPE_PREFERRED;
|
||||||
if (mode2.type & DRM_MODE_TYPE_PREFERRED)
|
if (preferred1 != preferred2)
|
||||||
return false;
|
return preferred1;
|
||||||
|
|
||||||
int area1 = mode1.hdisplay * mode1.vdisplay;
|
int area1 = mode1.hdisplay * mode1.vdisplay;
|
||||||
int area2 = mode2.hdisplay * mode2.vdisplay;
|
int area2 = mode2.hdisplay * mode2.vdisplay;
|
||||||
|
|
Loading…
Reference in a new issue