[PATCH v2] Handle failures in setting a CRTC to a DRM mode properly

Daniel Martin consume.noise at gmail.com
Mon Oct 26 03:55:17 PDT 2015


On 26 October 2015 at 10:39, Michel Dänzer <michel at daenzer.net> wrote:
>> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
>> index 64e79d4..f0f121e 100644
>> --- a/src/drmmode_display.c
>> +++ b/src/drmmode_display.c
>> @@ -760,12 +760,15 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
>>                               radeon_bo_wait(drmmode_crtc->scanout[0].bo);
>>                       }
>>               }
>> -             ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
>> -                                  fb_id, x, y, output_ids, output_count, &kmode);
>> -             if (ret)
>> +             if (drmModeSetCrtc(drmmode->fd,
>> +                                drmmode_crtc->mode_crtc->crtc_id,
>> +                                fb_id, x, y, output_ids,
>> +                                output_count, &kmode) != 0) {
>>                       xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
>>                                  "failed to set mode: %s", strerror(-ret));
>
> errno must be passed instead of -ret to strerror. I pushed the patch
> with that fixed, thanks!

While you're at it, can you add the missing linebreak to the message?
Just hit it and it looks suspicious:
    (EE) modeset(0): failed to set mode: Invalid argument(--) RandR disabled
or
    (EE) modeset(0): failed to set mode: Invalid argument(II)
modeset(0): Setting screen physical size to 677 x 381

Thanks,
    Daniel


More information about the xorg-devel mailing list