[PATCH:libXv 5/7] Replace custom copy of GetReq macro with call to Xlib 1.5's _XGetRequest
Alan Coopersmith
alan.coopersmith at oracle.com
Sun Jun 23 11:53:48 PDT 2013
xvproto.h names don't match those required by the Xlibint.h GetReq* macros,
but at least we can rely on the _XGetRequest function for the bulk of the
work now, instead of duplicating it.
Also clears clang warnings repeated for every request function:
Xv.c:137:5: warning: cast from 'char *' to 'xvQueryExtensionReq *' increases re
quired alignment from 1 to 2 [-Wcast-align]
XvGetReq(QueryExtension, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Xvlibint.h:52:8: note: expanded from macro 'XvGetReq'
req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xv.c:137:5: warning: implicit conversion loses integer precision: 'int' to 'CAR
D8' (aka 'unsigned char') [-Wconversion]
XvGetReq(QueryExtension, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Xvlibint.h:53:30: note: expanded from macro 'XvGetReq'
req->reqType = info->codes->major_opcode;\
~ ~~~~~~~~~~~~~^~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
configure.ac | 2 +-
src/Xvlibint.h | 15 ++++++---------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4f8c5f2..53f8d7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ XORG_DEFAULT_OPTIONS
XORG_CHECK_MALLOC_ZERO
# Obtain compiler/linker options for depedencies
-PKG_CHECK_MODULES(XV, x11 xext xextproto videoproto)
+PKG_CHECK_MODULES(XV, [x11 > 1.5 xext xextproto videoproto])
# Check for _XEatDataWords function that may be patched into older Xlib release
SAVE_LIBS="$LIBS"
diff --git a/src/Xvlibint.h b/src/Xvlibint.h
index af46605..c2ae7d6 100644
--- a/src/Xvlibint.h
+++ b/src/Xvlibint.h
@@ -44,15 +44,12 @@ SOFTWARE.
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/Xvlib.h>
+/* names in Xvproto.h don't match the expectation of Xlib's GetReq* macros,
+ so we have to provide our own implementation */
+
#define XvGetReq(name, req) \
- WORD64ALIGN \
- if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax) \
- _XFlush(dpy); \
- req = (xv##name##Req *)(dpy->last_req = dpy->bufptr); \
- req->reqType = info->codes->major_opcode; \
- req->xvReqType = xv_##name; \
- req->length = (SIZEOF(xv##name##Req)) >> 2; \
- dpy->bufptr += SIZEOF(xv##name##Req); \
- dpy->request++
+ req = (xv##name##Req *) _XGetRequest( \
+ dpy, (CARD8) info->codes->major_opcode, SIZEOF(xv##name##Req)); \
+ req->xvReqType = xv_##name;
#endif /* XVLIBINT_H */
--
1.7.9.2
More information about the xorg-devel
mailing list