mismatch between the size of xDRI2BufferSwapComplete and sz_xDRI2BufferSwapComplete

Julien Cristau jcristau at debian.org
Tue Apr 26 01:06:24 PDT 2011


On Fri, Apr 15, 2011 at 14:21:03 +0900, SooChan Lim wrote:

> Hi, all.
> I have been trying to test the DRI2 protocol in my local machine, and I
> found that my test program gets the wrong sbc value when a test application
> has the DRI2BufferSwapComplete Event.
> I have looked into the source code related to DRI2, I found out that the
> size of the xDRI2BufferSwapComplete is not 32 bytes.
> The size of the xDRI2BufferSwapComplete is 36 bytes, but
> sz_xDRI2BufferSwapComplete is defined 32 bytes.
> The xEvent has to be 32 bytes, so I think that the size of
> the xDRI2BufferSwapComplete has to be 32 bytes.

That's been reported before, this should probably be fixed in a DRI2
protocol version bump.

> Therefore, I modified the dri2proto header.
> Please see below and give me some opinion.
> Thank you.
> SooChan Lim
> 
> - protocol of xDRI2BufferSwapComplete
> typedef struct {
>     CARD8 type;
>     CARD8 pad;
>     CARD16 sequenceNumber B16;
>     CARD16 event_type B16;
>     CARD32 drawable B32;
>     CARD32 ust_hi B32;
>     CARD32 ust_lo B32;
>     CARD32 msc_hi B32;
>     CARD32 msc_lo B32;
>     CARD32 sbc_hi B32;
>     CARD32 sbc_lo B32;
> } xDRI2BufferSwapComplete;
> #define sz_xDRI2BufferSwapComplete 32
> 
> - file patched
> 
> diff --git a/dri2proto.h b/dri2proto.h
> 
> old mode 100644
> 
> new mode 100755
> 
> index 9708a4a..e9d77e2
> 
> --- a/dri2proto.h
> 
> +++ b/dri2proto.h
> 
> @@ -287,9 +287,8 @@ typedef struct {
> 
> 
> 
>  typedef struct {
> 
>      CARD8 type;
> 
> -    CARD8 pad;
> 
> +    CARD8 event_type;
> 
>      CARD16 sequenceNumber B16;
> 
> -    CARD16 event_type B16;
> 
>      CARD32 drawable B32;
> 
>      CARD32 ust_hi B32;
>      CARD32 ust_lo B32;

This is awfully whitespace-mangled.  Also, doing that is going to break
existing apps, so what you need is a new structure with the fixed
layout, IMHO.  Which means converting to generic events since we've
stopped adding new regular events to protocol extensions.

Cheers,
Julien


More information about the xorg-devel mailing list