[Xcb] [PATCH] c_client.py: Add padding after full_sequence for certain XGE events.
Keith Packard
keithp at keithp.com
Mon Dec 30 16:50:08 PST 2013
Keith Packard <keithp at keithp.com> writes:
> Kenneth Graunke <kenneth at whitecape.org> writes:
>
>> To correct this, we check if the field following full_sequence has a
>> type whose size is 8 bytes. If so, we add an additional uint32_t field
>> called "pad_fs" (pad after full_sequence). This is harmless on 32-bit
>> architectures, and essential for 64-bit architectures to function.
>
> I think you need to check to see if *any* extended (past-32bytes) field
> is 64 bits?
>
> Note that this change will break currently working libraries on 32-bit
> systems.
Ok, I think Ken and I came up with a terrible, but functional,
plan. Simply replace any uint64_t members in events with two uint32_t
members, and place those in correct order so that reading a uint64_t
From the same address will work (retaining binary compatibility with
32-bit apps).
I wrote this by hand, just to check to see if it worked (only tested on
32-bit, I'm afraid):
#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define xcb_uint64_t(x) uint32_t x ## _lo, x ## _hi
#else
#define xcb_uint64_t(x) uint32_t x ## _hi, x ## _lo
#endif
#define xcb_uint64(x,f) (((uint64_t) ((x).f ## _hi) << 32) | ((x).f ## _lo))
#define xcb_uint64_store(x,f,v) do { \
uint64_t __tmp__ = (v); \
((x).f ## _hi) = (__tmp__) >> 32; \
((x).f ## _lo) = (__tmp__); \
} while (0)
/**
* @brief xcb_present_complete_notify_event_t
**/
typedef struct xcb_present_complete_notify_event_t {
uint8_t response_type; /**< */
uint8_t extension; /**< */
uint16_t sequence; /**< */
uint32_t length; /**< */
uint16_t event_type; /**< */
uint8_t kind; /**< */
uint8_t mode; /**< */
xcb_present_event_t event; /**< */
xcb_window_t window; /**< */
uint32_t serial; /**< */
xcb_uint64_t (ust); /**< */
uint32_t full_sequence; /**< */
xcb_uint64_t (msc); /**< */
} xcb_present_complete_notify_event_t;
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20131230/a2f0c4c9/attachment.pgp>
More information about the Xcb
mailing list