[PATCH] drm/kms/crtc: Improving the func drm_mode_setcrtc

Daniel Stone daniel at fooishbar.org
Fri Aug 24 13:58:16 UTC 2018


Hi Satendra,

On Fri, 27 Jul 2018 at 11:13, Satendra Singh Thakur
<satendra.t at samsung.com> wrote:
> Following changes are done to this func:

I would certainly agree with Sean, Martin, and Jani's comments. This
patch was difficult to follow as it made so many changes at once.
Being a crucial function which has many subtle details, it is
important to keep the _changes_ as readable as possible: not just the
final result, but the intermediate patches.

Another thing you might consider is running the igt test suite after
your patches, particularly when touching core code. Running igt
would've flagged the below:

> +       /* Check if the flag is set*/
> +       if (!crtc_req->mode_valid) {
> +               DRM_DEBUG_KMS("mode_valid flag [%d] is not set\n",
> +               crtc_req->mode_valid);
> +               return -EINVAL;
> +       }

This is a change from the previous behaviour, and not correct.
mode_valid is allowed to be NULL if there are also no connectors and
there is no FB: this disables the CRTC.

> +       /* Check the validity of count_connectors supplied by user */
> +       if (!crtc_req->count_connectors ||
> +               crtc_req->count_connectors > config->num_connector) {
> +               DRM_DEBUG_KMS("Invalid connectors' count %d\n",
> +               crtc_req->count_connectors);
> +               return -EINVAL;
> +       }

Same comment applies here.

Cheers,
Daniel


More information about the dri-devel mailing list