RandR 1.4 restart

Keith Packard keithp at keithp.com
Mon Feb 28 17:29:56 PST 2011


Ok, let's try to get a bit of protocol review, then look at the library
API, then the server internal APIs and finally the server
implementation. Most of the code already exists, so this shouldn't take
a terribly long time.

I've cleaned up the protocol a bit, reducing the changes so that we've
got only one 'set' and one 'get' request, each of which do 'everything'
except deal with output properties. The separate requests to set and
query the sprite transforms are gone.

For the library changes, I'd like to know is whether I should emulate
the new SetCrtcConfigs interface using old requests on old servers. That
would involve duplicating a bit of structure from the insides of the X
server, but would mean that applications could switch to the new
interface and not worry about preserving compatibility with the old.

Here's a diff from 1.3.2 of just the protocol specification. Please see
if this looks reasonable from a protocol perspective.

diff --git a/randrproto.txt b/randrproto.txt
index 9f3d4a1..094157a 100644
--- a/randrproto.txt
+++ b/randrproto.txt
@@ -1,5 +1,5 @@
 	       The X Resize, Rotate and Reflect Extension
-			     Version 1.3.1
+			     Version 1.4.0
 			       2009-10-5
 
 			      Jim Gettys
@@ -124,7 +124,54 @@ following features are added in this version:
    • Panning. It was removed with RandR 1.2 because the old semantics didn't
      fit any longer. With RandR 1.3 panning can be specified per crtc.
 
-1.1 Acknowledgements
+1.4 Introduction to version 1.4 of the extension
+
+Version 1.4 adds a couple more capabilities to further expose the
+underlying hardware to clients
+
+   • Per-crtc pixmaps. This provides for multiple scan-out buffers
+     which applications can create and assign to arbitrary collections
+     of crtcs.
+
+   • Sprite position and image transforms. These provide a projective
+     transform for both the hot spot location and the sprite image
+     itself for each CRTC.
+
+   • RRSetCrtcConfigs request. This supplies a set of
+     crtc configurations to the server that must be applied together
+     or not at all. This can reduce screen flicker while also
+     providing the server a complete configuration for appropriate
+     resource management.
+
+The first two additions, per-crtc pixmaps and sprite transforms are
+designed to solve two problems:
+
+ 1) Screen transforms. The software transform code in the X server
+    uses a shadow frame buffer, adding another copy to every graphics
+    operation. Worse, the server has no idea about when clients are
+    done drawing a frame, so the user gets additional latency and
+    judder.
+
+    The goal is to move this operation out to the compositing manager
+    which already deals with an extra copy of the frame buffer for
+    many operations. Have the compositing manager create and draw to a
+    separate pixmap for scanout. It can perform whatever transforms
+    are required to get the image in the right orientation for the
+    user.
+
+ 2) Hardware scanout engine size limits. With a single scanout buffer
+    for the entire screen, it's possible for the user to ask for a
+    configuration which requires that scanout buffer to be larger than
+    the hardware is capable of scanning out from. Again, having the
+    compositing manager create a pixmap for each CRTC will allow for
+    any configuration where monitor position within the virtual space
+    isn't limited by the scanout limits.
+
+In both of these cases, the Sprite transforms are necessary to ensure
+that the sprite appears at the desired spot on each CRTC and with the
+right shape.
+
+1.99 Acknowledgements
 
 Our thanks to the contributors to the design found on the xpert mailing
 list, in particular:
@@ -302,6 +349,126 @@ REFRESH { rates: LISTofCARD16 }
 
 			      ❧❧❧❧❧❧❧❧❧❧❧
 
+5.4. Protocol Types added in version 1.4 of the extension
+
+SCANOUTPIXMAPINFO { format: PICTFORMAT
+		    maxWidth, maxHeight: CARD16
+		    rotations: SETofROTATION }
+
+	'format' is the format of the pixels within the scanout
+	pixmap. Only 'Direct' formats are supported, this will never
+	be an 'Indexed' format.
+
+	'maxWidth' and 'maxHeight' define the largest supported
+	scanout pixmap. There is no minimum size; scanout pixmaps down
+	to 1x1 may be created.
+
+	'rotations' lists the set of rotations which can be provided
+	without additional latency or memory usage within the
+	environment. This typically means that they are supported
+	directly by the hardware. It is expected that a compositing
+	manager will perform other transforms as a part of the
+	compositing process in conjunction with the sprite transforms
+	described in this extension.
+
+SCREENFLAG { SetScreenPixmapSize
+             SetScreenSize
+	     SetScreenSizeInMillimeters
+	     SetScreenCrtcs }
+
+CRTCFLAG { SetCrtcPosition
+	   SetCrtcMode
+	   SetCrtcRotation
+	   SetCrtcOutputs
+	   SetCrtcSpritePositionTransform
+	   SetCrtcSpriteImageTransform
+	   SetCrtcPixmap
+	   SetCrtcPixmapPosition }
+
+CRTCCONFIG { crtc: CRTC
+	     set: SETofCRTCFLAG
+	     x, y: INT16
+	     mode: MODE
+	     rotation: ROTATION
+	     sprite-position-transform: TRANSFORM
+	     sprite-image-transform: TRANSFORM
+	     outputs: LISTofOUTPUT
+	     pixmap: PIXMAP or None
+	     pixmap-x, pixmap-y: INT16 }
+
+	If 'set' includes SetCrtcPosition, then
+	x and y specify the new screen position of the crtc.
+
+	If 'set' includes SetCrtcMode, then mode specifies
+	a new mode for the crtc.
+
+	If 'set' includes SetCrtcRotation, then 'rotation' specifies a
+	new rotation for this crtc. Furthurmore:
+
+	 * Any new or existing scanout pixmap must have had the
+	   specified 'rotation' included as a part of its creation
+	   parameters, or a Match error results.
+
+	 * If no scanout pixmap is in use, then the crtc must support
+	   'rotation' else a Value error results.
+	
+	If 'set' include SetCrtcOutputs, then outputs specifies
+	the new set of outputs for the crtc.
+
+	If 'set' includes SetCrtcSpritePositionTransform, then
+	sprite-position-transform is used to transform the position of
+	any sprite displayed on this crtc.
+
+	If 'set' includes SetCrtcSpriteImageTransform, then
+	sprite-image-transform is used to transform the image of
+	any sprite displayed on this crtc.
+
+	If 'set' includes SetCrtcPixmap, then 'pixmap' specifies the
+	source of pixel data to be presented on 'crtc', or None, in
+	which case data will come from the global screen pixels.
+	'pixmap' must specify a scanout pixmap as created by
+	RRCreateScanoutPixmap or None. Otherwise a Match error
+	results. Furthermore:
+
+	 * 'pixmap' must be at least as large as the area to be
+	   scanned out, or a Match error results.
+
+	 * If 'pixmap' is destroyed while still being used as a
+	   scanout pixmap, then the associated CRTC will have its
+	   scanout pixmap set back to None, the CRTC origin set back
+	   to 0,0 (to make sure it fits) and the screen pixmap width
+	   and height increased to be at least as big as the current
+	   CRTC mode.
+
+	 * Future crtc changes that do not change the scanout pixmap
+	   will cause an existing scanout pixmap to be resized to be
+	   large enough to hold the new mode at the then-current
+	   pixmap-x/pixmap-y location.
+
+	If 'set' includes SetCrtcPixmapPosition, then 'pixmap-x' and
+	'pixmap-y' specify the origin of the scanout data within any
+	scanout pixmap, the area from that location to pixmap-x +
+	width-of(mode), pixmap-y + height-of(mode) is what will be
+	seen on the connected outputs. When 'crtc' does not have a
+	scanout pixmap, these values are not used although they may be
+	set.
+
+CRTCINFO { crtc: CRTC
+	   set: SETofCRTCFLAG
+	   x, y: INT16
+	   width, height: CARD16
+	   mode: MODE
+	   rotation: ROTATION
+	   sprite-position-transform: TRANSFORM
+	   sprite-image-transform: TRANSFORM
+	   outputs: LISTofOUTPUT
+	   pixmap: PIXMAP or None
+	   pixmap-x, pixmap-y: INT16
+	   rotations: SETofROTATION
+	   possible-outputs: LISTofOUTPUT }
+
+			      ❧❧❧❧❧❧❧❧❧❧❧
+
 6. Extension Initialization
 
 The name of this extension is "RANDR".
@@ -1238,6 +1405,104 @@ dynamic changes in the display environment.
 
 			      ❧❧❧❧❧❧❧❧❧❧❧
 
+7.3. Extension Requests added in version 1.4 of the extension.
+
+┌───
+    RRQueryScanoutPixmaps
+	window: WINDOW
+      ▶
+	infos: LISTofSCANOUTPIXMAPINFO
+└───
+	Errors: Window
+
+	This request returns information about the server support for
+	alternate scanout pixmaps. For each pictformat, there is a set
+	of rotations and a maximum supported size. The rotations here
+	are those provided by the scanout hardware itself, not by
+	software emulation.
+
+┌───
+    RRCreateScanoutPixmap
+	pixmap: PIXMAP
+	drawable: DRAWABLE
+	width, height: CARD16
+	format: PICTFORMAT
+	rotations: SETofROTATION
+└───
+	Errors: Drawable, Match, Value
+
+	Creates a pixmap which can subsequently be used as a scanout
+	buffer for the screen associated with 'drawable'. 'rotations'
+	is the set of rotation values which may be used with the
+	resulting scanout buffer when it is associated with a CRTC.
+
+	'format' must be one of the supported scanout formats, or a
+	Match error results.
+
+	'width' and 'height' must be within the supported range for
+	the specified format or a Value error results.
+
+	'rotations' must be a subset of those supported for the
+	specified format or a Match error results.
+
+┌───
+    RRSetCrtcConfigs
+	drawable: DRAWABLE
+	set: SETofSCREENFLAG
+	screen-pixmap-width: CARD16
+	screen-pixmap-height: CARD16
+	screen-width: CARD16
+	screen-height: CARD16
+	width-in-millimeters: CARD32
+	height-in-millimeters: CARD32
+	configs: LISTofCRTCCONFIG
+      ▶
+	status: RRCONFIGSTATUS
+└───
+	Errors: Value, Match
+
+	This works much like RRSetScreenSize followed by a sequence of
+	RRSetCrtcConfig, except that the entire configuration can be set
+	in a single operation, either succeeding or failing without
+	any partial execution.
+
+	If 'set' includes 'SetScreenPixmapSize', then
+	'screen-pixmap-width' and 'screen-pixmap-height' specify the
+	new screen pixmap size.
+
+	If 'set' includes 'SetScreenSize', then 'screen-width' and
+	'screen-height' specify the new screen size.
+
+	If 'set' includes 'SetScreenSizeInMillimeters', then
+	'width-in-millimeters' and 'height-in-millimeters' specify
+	the new screen physical size.
+
+	If 'set' includes 'SetScreenCrtcs', then 'configs' includes
+	the list of new CRTC configurations.
+
+	In addition to the pre-1.4 semantics, this request adds the
+	ability to specific a scanout pixmap for each crtc, and
+	integrates the 1.4 sprite transform request as well.
+
+┌───
+    RRGetCrtcConfigs
+	drawable: DRAWABLE
+      ▶
+	screen-pixmap-width: CARD16
+	screen-pixmap-height: CARD16
+	screen-width: CARD16
+	screen-height: CARD16
+	width-in-millimeters: CARD32
+	height-in-millimeters: CARD32
+	configs: LISTofCRTCINFO
+└───
+	Errors: Drawable
+
+	This returns configuration information for the screen
+	associated with 'drawable'.
+
+			      ❧❧❧❧❧❧❧❧❧❧❧
+
 8. Extension Events
 
 Clients MAY select for ConfigureNotify on the root window to be


-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110228/e95dec07/attachment-0001.pgp>


More information about the xorg-devel mailing list