[PATCH weston] compositor-drm: rename outputs to follow kernel style

Pekka Paalanen ppaalanen at gmail.com
Thu Aug 20 00:04:45 PDT 2015


On Wed, 19 Aug 2015 10:46:41 -0500
Derek Foreman <derekf at osg.samsung.com> wrote:

> Excellent!
> 
> Incidentally, this is also how Enlightenment names its outputs.
> 
> Reviewed-by: Derek Foreman <derekf at osg.samsung.com>

Cheers.

Any objections to landing this for 1.9-beta? It does force users to fix
their weston.ini if they have any DRM output configurations there.


Thanks,
pq

> On 19/08/15 07:54 AM, Pekka Paalanen wrote:
> > From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > 
> > The problem with the old table of names is that it contains duplicates.
> > It is possible to end up with multiple outputs with the same name. In
> > that case you cannot write individual configurations for these outputs
> > in weston.ini, because they are matched by the name.
> > 
> > Change all names to follow the kernel naming scheme set in
> > drivers/gpu/drm/drm_crtc.c. The snprintf format now follows the kernel
> > style, too. Use the DRM_MODE_CONNECTOR_* macros rather than implicit
> > table ordering.
> > 
> > Completely new entries in the table are "Virtual" and "DSI".
> > 
> > There should not be any gaps in the macro values, but if there are, deal
> > with a NULL entry.
> > 
> > Also change "UNKNOWN" to "UNNAMED" so it's easier to distinguish from
> > "Unknown" by the kernel.
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89361
> > Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > ---
> >  src/compositor-drm.c | 42 +++++++++++++++++++++++-------------------
> >  1 file changed, 23 insertions(+), 19 deletions(-)
> > 
> > diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> > index 26f0012..400bc0c 100644
> > --- a/src/compositor-drm.c
> > +++ b/src/compositor-drm.c
> > @@ -1745,34 +1745,38 @@ drm_set_dpms(struct weston_output *output_base, enum dpms_enum level)
> >  }
> >  
> >  static const char * const connector_type_names[] = {
> > -	"None",
> > -	"VGA",
> > -	"DVI",
> > -	"DVI",
> > -	"DVI",
> > -	"Composite",
> > -	"TV",
> > -	"LVDS",
> > -	"CTV",
> > -	"DIN",
> > -	"DP",
> > -	"HDMI",
> > -	"HDMI",
> > -	"TV",
> > -	"eDP",
> > +	[DRM_MODE_CONNECTOR_Unknown]     = "Unknown",
> > +	[DRM_MODE_CONNECTOR_VGA]         = "VGA",
> > +	[DRM_MODE_CONNECTOR_DVII]        = "DVI-I",
> > +	[DRM_MODE_CONNECTOR_DVID]        = "DVI-D",
> > +	[DRM_MODE_CONNECTOR_DVIA]        = "DVI-A",
> > +	[DRM_MODE_CONNECTOR_Composite]   = "Composite",
> > +	[DRM_MODE_CONNECTOR_SVIDEO]      = "SVIDEO",
> > +	[DRM_MODE_CONNECTOR_LVDS]        = "LVDS",
> > +	[DRM_MODE_CONNECTOR_Component]   = "Component",
> > +	[DRM_MODE_CONNECTOR_9PinDIN]     = "DIN",
> > +	[DRM_MODE_CONNECTOR_DisplayPort] = "DP",
> > +	[DRM_MODE_CONNECTOR_HDMIA]       = "HDMI-A",
> > +	[DRM_MODE_CONNECTOR_HDMIB]       = "HDMI-B",
> > +	[DRM_MODE_CONNECTOR_TV]          = "TV",
> > +	[DRM_MODE_CONNECTOR_eDP]         = "eDP",
> > +	[DRM_MODE_CONNECTOR_VIRTUAL]     = "Virtual",
> > +	[DRM_MODE_CONNECTOR_DSI]         = "DSI",
> >  };
> >  
> >  static char *
> >  make_connector_name(const drmModeConnector *con)
> >  {
> >  	char name[32];
> > -	const char *type_name;
> > +	const char *type_name = NULL;
> >  
> >  	if (con->connector_type < ARRAY_LENGTH(connector_type_names))
> >  		type_name = connector_type_names[con->connector_type];
> > -	else
> > -		type_name = "UNKNOWN";
> > -	snprintf(name, sizeof name, "%s%d", type_name, con->connector_type_id);
> > +
> > +	if (!type_name)
> > +		type_name = "UNNAMED";
> > +
> > +	snprintf(name, sizeof name, "%s-%d", type_name, con->connector_type_id);
> >  
> >  	return strdup(name);
> >  }
> > 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150820/32775b14/attachment.sig>


More information about the wayland-devel mailing list