[Xcb] [PATCH proto 1/9] randr: make padding explicit

Christian Linhart chris at demorecorder.com
Sun Sep 13 06:45:09 PDT 2015


Add explicit align-padding for:
* the request "SetCrtcTransform"
  Added 4-byte align-pad between list "filter_name" and list "filter_params"
  The spec does not show the padding
    http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt?id=randrproto-1.5.0#n1173
  But there has to be padding to make accesses to 32-bit values in list
  "filter_params" aligned.
  The Xlib implementation at
    http://cgit.freedesktop.org/xorg/lib/libXrandr/tree/src/XrrCrtc.c?id=libXrandr-1.5.0#n327
  correctly does the padding:
  The string "filter" is written with "Data" which does 4-byte padding at the end:
    http://cgit.freedesktop.org/xorg/lib/libX11/tree/include/X11/Xlibint.h?id=libX11-1.6.3#n535
    http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xcb_io.c?id=libX11-1.6.3#n484

* the reply of request "GetCrtcTransform"
  Added two 4-byte align-pads:
  - between lists "pending_filter_name" and "pending_params"
    the spec does not show the padding
        http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt?id=randrproto-1.5.0#n1205
    But there has to be padding to make accesses to 32-bit values in list
    "filter_params" aligned.
    The Xlib implementation at
      http://cgit.freedesktop.org/xorg/lib/libXrandr/tree/src/XrrCrtc.c?id=libXrandr-1.5.0#n434
    adds the padding.

  - between lists "current_filter_name" and "current_params"
    the spec does not show the padding
        http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt?id=randrproto-1.5.0#n1205
    But there has to be padding to make accesses to 32-bit values in list
    "current_params" aligned.
    The Xlib implementation at
      http://cgit.freedesktop.org/xorg/lib/libXrandr/tree/src/XrrCrtc.c?id=libXrandr-1.5.0#n445
    adds the padding.

Signed-off-by: Christian Linhart <chris at demorecorder.com>
---
 src/randr.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/randr.xml b/src/randr.xml
index 7dfc8a9..722f715 100644
--- a/src/randr.xml
+++ b/src/randr.xml
@@ -524,14 +524,15 @@ <request name="SetCrtcTransform" opcode="26">
 		<field type="CRTC" name="crtc" />
 		<field type="TRANSFORM" name="transform" />
 		<field type="CARD16" name="filter_len" />
 		<pad bytes="2" />
 		<list type="char" name="filter_name">
 			<fieldref>filter_len</fieldref>
 		</list>
+		<pad align="4" />
 		<list type="FIXED" name="filter_params" />
 	</request>
 
 	<request name="GetCrtcTransform" opcode="27">
 		<field type="CRTC" name="crtc" />
 		<reply>
 			<pad bytes="1" />
@@ -543,20 +544,22 @@ <request name="GetCrtcTransform" opcode="27">
 			<field type="CARD16" name="pending_len" />
 			<field type="CARD16" name="pending_nparams" />
 			<field type="CARD16" name="current_len" />
 			<field type="CARD16" name="current_nparams" />
 			<list type="char" name="pending_filter_name" >
 				<fieldref>pending_len</fieldref>
 			</list>
+			<pad align="4" />
 			<list type="FIXED" name="pending_params" >
 				<fieldref>pending_nparams</fieldref>
 			</list>
 			<list type="char" name="current_filter_name" >
 				<fieldref>current_len</fieldref>
 			</list>
+			<pad align="4" />
 			<list type="FIXED" name="current_params" >
 				<fieldref>current_nparams</fieldref>
 			</list>
 		</reply>
 	</request>
 
 	<request name="GetPanning" opcode="28">
-- 
2.1.4



More information about the Xcb mailing list