[PATCH weston v3] drm: port the drm backend to the new init api

Pekka Paalanen ppaalanen at gmail.com
Tue Feb 23 12:53:01 UTC 2016


On Tue, 24 Nov 2015 16:31:42 +0200
Giulio Camuffo <giuliocamuffo at gmail.com> wrote:

> 2015-11-20 11:38 GMT+02:00 Quentin Glidic <sardemff7+wayland at sardemff7.net>:
> > For now, I will just comment on the part I am not too happy with.
> >
> > On 31/10/2015 12:08, Giulio Camuffo wrote:  
> >>
> >> [snip]

> >> +static void
> >> +drm_configure_output(struct weston_compositor *c, const char *name,
> >> +                    struct weston_drm_backend_output_config *config)
> >> +{
> >> +       struct weston_config *wc = weston_compositor_get_user_data(c);
> >> +       struct weston_config_section *section;
> >> +       char *s;
> >> +       int scale;
> >> +
> >> +       section = weston_config_get_section(wc, "output", "name", name);
> >> +       weston_config_section_get_string(section, "mode", &s,
> >> "preferred");
> >> +       if (strcmp(s, "off") == 0)
> >> +               config->type = WESTON_DRM_BACKEND_OUTPUT_TYPE_OFF;
> >> +       else if (strcmp(s, "preferred") == 0)
> >> +               config->type = WESTON_DRM_BACKEND_OUTPUT_TYPE_PREFERRED;
> >> +       else if (strcmp(s, "current") == 0)
> >> +               config->type = WESTON_DRM_BACKEND_OUTPUT_TYPE_CURRENT;
> >> +       else if (sscanf(s, "%dx%d", &config->base.width,
> >> +                                   &config->base.height) == 2)
> >> +               config->type = WESTON_DRM_BACKEND_OUTPUT_TYPE_MODE;
> >> +       else if (parse_modeline(s, &config->modeline) == 0)
> >> +               config->type = WESTON_DRM_BACKEND_OUTPUT_TYPE_MODELINE;
> >> +       else {
> >> +               weston_log("Invalid mode \"%s\" for output %s\n",
> >> +                          s, name);
> >> +               config->type = WESTON_DRM_BACKEND_OUTPUT_TYPE_PREFERRED;
> >> +       }
> >> +       free(s);  
> >
> >
> > I would like this part shared between the backend and the compositor.
> > As I said, the parsing of modeline should be in the backend, but also what I
> > would call “light modeline”, i.e. "width x height". That put the “technical”
> > part into the “technical code”.
> > Then you have a separate setting for on/off(/current).
> >
> > The configure_output function would return a boolean, which indicates
> > whether or not to activate that output. The modeline would be passed as a
> > string (config->moduline) and could be NULL.
> > Returning FALSE obviously means that all the configuration will be ignored
> > (and thus, you can return early, keeping everything to NULL) and the meaning
> > of TRUE depends on the modeline:
> > - if it is a well-formed modeline (or “light modeline”), use it;
> > - if it is malformed, fallback to NULL;
> > - if it is NULL, use the preferred setting.
> >
> > If “current” is really a needed setting (I do not know the use case it was
> > added for), we can just use a 3-values enum as the return value:
> > - OFF = 0
> > - PREFERRED = 1
> > - CURRENT = -1
> > which will change the meaning of a NULL modeline.  
> 
> I'm not sure what current is for but i would not remove it.

Hi,

FWIW, these are the same as explained in weston.ini man page. Preferred
means the preferred mode in EDID or similar, while current means the
currently active video mode when the compositor is starting, to allow
avoiding a mode switch in case preferred != current. E.g. when you
force the mode on kernel command line.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160223/af68bb6a/attachment-0001.sig>


More information about the wayland-devel mailing list