[Xcb] [PATCH proto 8/9] xv: struct "EncodingInfo": add explicit align pad

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


The align pad is needed so that a in list of struct "EncodingInfo",
the 32-bit fiels in subsequent "EncodingInfo" are aligned.
(the field "encoding" is a 32-bit value, and the field "rate"
contains two 32-bit values)

The xv-protocol-spec does not contain the protocol encoding.
(it specifies the protocol on a higher level)

The X-Server uses function "WriteToClient" to write the list "name"
to the connection:
http://cgit.freedesktop.org/xorg/xserver/tree/Xext/xvdisp.c?id=xorg-server-1.17.99.901#n456

Function "WriteToClient" does 4-byte alignment padding:
http://cgit.freedesktop.org/xorg/xserver/tree/os/io.c?id=xorg-server-1.17.99.901#n804

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

diff --git a/src/xv.xml b/src/xv.xml
index 47a05d0..d99711c 100644
--- a/src/xv.xml
+++ b/src/xv.xml
@@ -114,14 +114,15 @@ <struct name="EncodingInfo">
         <field type="CARD16" name="width" />
         <field type="CARD16" name="height" />
         <pad bytes="2" />
         <field type="Rational" name="rate" />
         <list type="char" name="name">
             <fieldref>name_size</fieldref>
         </list>
+        <pad align="4" />
     </struct>
 
     <struct name="Image">
         <field type="CARD32" name="id" />
         <field type="CARD16" name="width" />
         <field type="CARD16" name="height" />
         <field type="CARD32" name="data_size" />
-- 
2.1.4



More information about the Xcb mailing list