[RFC] drm: atomic mode set API

Jesse Barnes jbarnes at virtuousgeek.org
Wed Feb 15 17:53:41 PST 2012

On Wed, 15 Feb 2012 17:59:45 -0500
Adam Jackson <ajax at redhat.com> wrote:

> On 2/15/12 5:42 PM, Jesse Barnes wrote:
> > +#define DRM_SET_CONFIG_TEST (1<<0) /* don't change the config, just test it for validity */
> > +
> > +struct drm_mode_set_config {
> > +	__u64 crtcs;
> > +	__u64 crtc_fbs;
> > +	__u64 crtc_xpos; /* array of x coords for crtcs */
> > +	__u64 crtc_ypos; /* array of y coords for crtcs */
> > +	__u32 count_crtcs;
> > +
> > +	__u64 plane_sets; /* array of set_plane structs */
> > +
> > +	__u32 count_planes;
> > +
> > +	__u64 connectors;
> > +	__u64 connector_modes;
> > +	__u32 count_connectors;
> > +
> > +	__u32 flags;
> > +};
> This appears to be missing some []s, but I think the intent is clear.

Yeah, all the u64s are arrays.

> >   #define DRM_MODE_ENCODER_NONE	0
> >   #define DRM_MODE_ENCODER_DAC	1
> >   #define DRM_MODE_ENCODER_TMDS	2
> >
> > This allows you to bind a bunch of fbs to crtcs with independent
> > positions, as well as set a bunch of planes to specific fbs and
> > layouts.  Finally, it lets you change the connector config at the same
> > time, with a flag to simply test a config instead of actually setting
> > it.
> >
> > Any comments?  Do we also need to set gamma or other properties as part
> > of this?  What about cursors?
> I guess you might want to set gamma atomically, but I can't imagine it 
> being a factor in anyone's "can I do this" logic.
> How do you pass in pixel format?  Do you just assume the existing fb is 
> already in the correct format?  That could work but it kind of sucks for 
> low-memory environments since you'd need to have enough room to 
> pre-create all the fbs.  You could still do the "tear everything down 
> first" approach to work around that, but then you'd still have the 
> possibility of having nothing lit up _and_ not being able to set what 
> was requested, and then needing to unwind in userspace.

Yeah, the assumption is that the fbs have already been set up.  You'll
need to do that anyway if you want to queue to a flip chain or
whatever.  I don't see an easy way of linking that in here, since to
format an fb you need an underlying buffer allocated, which is where
the memory issues you mentioned come in.  So in that sense, it works
like the other APIs in that it assumes you have an object with content
and the right pixel format all ready to go.

> I'd sort of also want to see audio reflected in this (sigh), since 
> that's going to affect the bandwidth math.  DP 1.2 makes that even worse.

Requesting a specific audio config?  Or just returning an informative
error code about why the mode was rejected (e.g. you're playing 7.1
audio on this link and there's not enough bw for the config you wanted)?

How to reasonably return errors from this is an open question; should
we return an array of error codes to indicate all the possible issues?
Or just try our best with a single dimension and hope userspace can
figure things out?

Jesse Barnes, Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20120215/c9f83573/attachment.pgp>

More information about the dri-devel mailing list