[PATCH weston 3/9] compositor-drm: factor out drm_output_init_crtc()

Daniel Stone daniel at fooishbar.org
Mon Feb 12 12:27:56 UTC 2018


Hi Pekka,

On 9 February 2018 at 13:07, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> +       i = find_crtc_for_connector(b, resources, connector);
> +       if (i < 0) {
> +               weston_log("No usable crtc/encoder pair for connector.\n");
> +               return -1;
> +       }
> +
> +       crtc_id = resources->crtcs[i];
> +
> +       props = drmModeObjectGetProperties(b->drm.fd, crtc_id,
> +                                          DRM_MODE_OBJECT_CRTC);
> +       if (!props) {
> +               weston_log("failed to get CRTC properties\n");
> +               return -1;
> +       }
> +       drm_property_info_populate(b, crtc_props, output->props_crtc,
> +                                  WDRM_CRTC__COUNT, props);
> +       drmModeFreeObjectProperties(props);
> +
> +       output->crtc_id = crtc_id;
> +       output->pipe = i;
> +
> +       output->scanout_plane =
> +               drm_output_find_special_plane(b, output,
> +                                             WDRM_PLANE_TYPE_PRIMARY);
> +       if (!output->scanout_plane) {
> +               weston_log("Failed to find primary plane for output %s\n",
> +                          output->base.name);
> +               output->crtc_id = 0;
> +               return -1;
> +       }

First nitpick: this leaves output->pipe set. Probably best to just
init crtc_id and pipe at the very top, then undo both in a goto err.

Cheers,
Daniel


More information about the wayland-devel mailing list