diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2018-07-10 18:53:54 +0200 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2018-07-12 18:08:07 +0200 |
commit | f01d8cf2bd9681b8f5f0e2eddec0a79614389771 (patch) | |
tree | 3433e4fc707ac18a48872bc8f36e6625971f0e2d | |
parent | ee7e15746148122abf6728fb0f59d6c8ae329e4e (diff) |
Refactor drmmode_output_set_tear_free helper
Preparation for the following fix, no functional change intended.
(Ported from amdgpu commit fa30f4601de7a44edfb4a95873bd648946fd4292)
Acked-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index df8ef320..ae605eda 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1743,6 +1743,22 @@ drmmode_output_create_resources(xf86OutputPtr output) } } +static void +drmmode_output_set_tear_free(RADEONEntPtr pRADEONEnt, + drmmode_output_private_ptr drmmode_output, + xf86CrtcPtr crtc, int tear_free) +{ + if (drmmode_output->tear_free == tear_free) + return; + + drmmode_output->tear_free = tear_free; + + if (crtc) { + drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation, + crtc->x, crtc->y); + } +} + static Bool drmmode_output_set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value) @@ -1783,16 +1799,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property, for (j = 0; j < p->mode_prop->count_enums; j++) { if (!strcmp(p->mode_prop->enums[j].name, name)) { if (i == (drmmode_output->num_props - 1)) { - if (drmmode_output->tear_free != j) { - xf86CrtcPtr crtc = output->crtc; - - drmmode_output->tear_free = j; - if (crtc) { - drmmode_set_mode_major(crtc, &crtc->mode, - crtc->rotation, - crtc->x, crtc->y); - } - } + drmmode_output_set_tear_free(pRADEONEnt, drmmode_output, + output->crtc, j); } else { drmModeConnectorSetProperty(pRADEONEnt->fd, drmmode_output->output_id, |