dri: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping much easier. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
32f6a22dd1
commit
d03d79f96b
|
|
@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
|
|
||||||
#include "dix/dix_priv.h"
|
#include "dix/dix_priv.h"
|
||||||
|
#include "dix/request_priv.h"
|
||||||
|
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
@ -77,6 +78,8 @@ XF86DRIResetProc(ExtensionEntry *extEntry)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIQueryVersion(register ClientPtr client)
|
ProcXF86DRIQueryVersion(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRIQueryVersionReq);
|
||||||
|
|
||||||
xXF86DRIQueryVersionReply rep = {
|
xXF86DRIQueryVersionReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
|
@ -85,7 +88,6 @@ ProcXF86DRIQueryVersion(register ClientPtr client)
|
||||||
.patchVersion = SERVER_XF86DRI_PATCH_VERSION
|
.patchVersion = SERVER_XF86DRI_PATCH_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
|
@ -100,10 +102,11 @@ ProcXF86DRIQueryVersion(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRIQueryDirectRenderingCapableReq);
|
||||||
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
|
||||||
Bool isCapable;
|
Bool isCapable;
|
||||||
|
|
||||||
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -137,12 +140,12 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIOpenConnection(register ClientPtr client)
|
ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRIOpenConnectionReq);
|
||||||
|
|
||||||
drm_handle_t hSAREA;
|
drm_handle_t hSAREA;
|
||||||
char *busIdString;
|
char *busIdString;
|
||||||
CARD32 busIdStringLength = 0;
|
CARD32 busIdStringLength = 0;
|
||||||
|
|
||||||
REQUEST(xXF86DRIOpenConnectionReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -179,14 +182,14 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIAuthConnection(register ClientPtr client)
|
ProcXF86DRIAuthConnection(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRIAuthConnectionReq);
|
||||||
|
|
||||||
xXF86DRIAuthConnectionReply rep = {
|
xXF86DRIAuthConnectionReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.authenticated = 1
|
.authenticated = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
REQUEST(xXF86DRIAuthConnectionReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -203,8 +206,8 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRICloseConnection(register ClientPtr client)
|
ProcXF86DRICloseConnection(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86DRICloseConnectionReq);
|
REQUEST_HEAD_STRUCT(xXF86DRICloseConnectionReq);
|
||||||
REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -218,14 +221,14 @@ ProcXF86DRICloseConnection(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRIGetClientDriverNameReq);
|
||||||
|
|
||||||
xXF86DRIGetClientDriverNameReply rep = {
|
xXF86DRIGetClientDriverNameReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
};
|
};
|
||||||
char *clientDriverName;
|
char *clientDriverName;
|
||||||
|
|
||||||
REQUEST(xXF86DRIGetClientDriverNameReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -252,14 +255,14 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRICreateContext(register ClientPtr client)
|
ProcXF86DRICreateContext(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRICreateContextReq);
|
||||||
|
|
||||||
xXF86DRICreateContextReply rep = {
|
xXF86DRICreateContextReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
};
|
};
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
|
|
||||||
REQUEST(xXF86DRICreateContextReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -280,8 +283,8 @@ ProcXF86DRICreateContext(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIDestroyContext(register ClientPtr client)
|
ProcXF86DRIDestroyContext(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86DRIDestroyContextReq);
|
REQUEST_HEAD_STRUCT(xXF86DRIDestroyContextReq);
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -297,6 +300,8 @@ ProcXF86DRIDestroyContext(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRICreateDrawable(ClientPtr client)
|
ProcXF86DRICreateDrawable(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRICreateDrawableReq);
|
||||||
|
|
||||||
xXF86DRICreateDrawableReply rep = {
|
xXF86DRICreateDrawableReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
|
@ -304,8 +309,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
|
||||||
DrawablePtr pDrawable;
|
DrawablePtr pDrawable;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xXF86DRICreateDrawableReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -328,12 +331,11 @@ ProcXF86DRICreateDrawable(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIDestroyDrawable(register ClientPtr client)
|
ProcXF86DRIDestroyDrawable(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86DRIDestroyDrawableReq);
|
REQUEST_HEAD_STRUCT(xXF86DRIDestroyDrawableReq);
|
||||||
|
|
||||||
DrawablePtr pDrawable;
|
DrawablePtr pDrawable;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -355,6 +357,8 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRIGetDrawableInfoReq);
|
||||||
|
|
||||||
xXF86DRIGetDrawableInfoReply rep = {
|
xXF86DRIGetDrawableInfoReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
|
@ -365,8 +369,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
drm_clip_rect_t *pBackClipRects;
|
drm_clip_rect_t *pBackClipRects;
|
||||||
int backX, backY, rc;
|
int backX, backY, rc;
|
||||||
|
|
||||||
REQUEST(xXF86DRIGetDrawableInfoReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -453,6 +455,8 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86DRIGetDeviceInfoReq);
|
||||||
|
|
||||||
xXF86DRIGetDeviceInfoReply rep = {
|
xXF86DRIGetDeviceInfoReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
|
@ -460,8 +464,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
||||||
drm_handle_t hFrameBuffer;
|
drm_handle_t hFrameBuffer;
|
||||||
void *pDevPrivate;
|
void *pDevPrivate;
|
||||||
|
|
||||||
REQUEST(xXF86DRIGetDeviceInfoReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -536,15 +538,6 @@ ProcXF86DRIDispatch(register ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
|
|
||||||
swapl(&stuff->screen);
|
|
||||||
return ProcXF86DRIQueryDirectRenderingCapable(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
static int _X_COLD
|
||||||
SProcXF86DRIDispatch(register ClientPtr client)
|
SProcXF86DRIDispatch(register ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -558,7 +551,7 @@ SProcXF86DRIDispatch(register ClientPtr client)
|
||||||
case X_XF86DRIQueryVersion:
|
case X_XF86DRIQueryVersion:
|
||||||
return ProcXF86DRIQueryVersion(client);
|
return ProcXF86DRIQueryVersion(client);
|
||||||
case X_XF86DRIQueryDirectRenderingCapable:
|
case X_XF86DRIQueryDirectRenderingCapable:
|
||||||
return SProcXF86DRIQueryDirectRenderingCapable(client);
|
return ProcXF86DRIQueryDirectRenderingCapable(client);
|
||||||
default:
|
default:
|
||||||
return DRIErrorBase + XF86DRIClientNotLocal;
|
return DRIErrorBase + XF86DRIClientNotLocal;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue