[RFC xserver v4 07/14] modesetting: Use atomic modesetting to configure output/CRTCs

Daniel Martin consume.noise at gmail.com
Fri Oct 20 08:40:57 UTC 2017


On 16 October 2017 at 07:02, Louis-Francis Ratté-Boulianne
<lfrb at collabora.com> wrote:
> To make sure we also use the same primary plane and to avoid
> mixing uses of two APIs, it is better to always use the atomic
> modesetting API when possible.
>
> Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
> ---
>  hw/xfree86/drivers/modesetting/drmmode_display.c | 402 +++++++++++++++++------
>  hw/xfree86/drivers/modesetting/drmmode_display.h |  35 +-
>  hw/xfree86/drivers/modesetting/pageflip.c        |   2 +-
>  hw/xfree86/drivers/modesetting/present.c         |   3 +-
>  4 files changed, 335 insertions(+), 107 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
> index 5d9770bb7..9caea858d 100644
> --- a/hw/xfree86/drivers/modesetting/drmmode_display.c
> +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
> @@ -279,16 +279,100 @@ plane_add_prop(drmModeAtomicReq *req, drmmode_crtc_private_ptr drmmode_crtc,
>                                     info->prop_id, val);
>      return (ret <= 0) ? -1 : 0;
>  }
> +
> +static int
> +crtc_add_prop(drmModeAtomicReq *req, drmmode_crtc_private_ptr drmmode_crtc,
> +              enum drmmode_crtc_property prop, uint64_t val)
> +{
> +    drmmode_prop_info_ptr info = &drmmode_crtc->props[prop];
> +    int ret;
> +
> +    if (!info)
> +        return -1;
> +
> +    ret = drmModeAtomicAddProperty(req, drmmode_crtc->mode_crtc->crtc_id,
> +                                   info->prop_id, val);
> +    return (ret <= 0) ? -1 : 0;
> +}
> +
> +static int
> +connector_add_prop(drmModeAtomicReq *req, drmmode_output_private_ptr drmmode_output,
> +                   enum drmmode_connector_property prop, uint64_t val)
> +{
> +    drmmode_prop_info_ptr info = &drmmode_output->props_connector[prop];
> +    int ret;
> +
> +    if (!info)
> +        return -1;
> +
> +    ret = drmModeAtomicAddProperty(req, drmmode_output->mode_output->connector_id,
> +                                   info->prop_id, val);

You can use the output_id directly:
    s/mode_output->connector_id/output_id/

We failed at least once handling the case of mode_output becoming NULL.
(And I'm going to send patches to rip the mode_output member out to
prevent such failures in the future.)


More information about the xorg-devel mailing list