| File: | Xext/xvdisp.c |
| Location: | line 1783, column 21 |
| Description: | Branch condition evaluates to a garbage value |
| 1 | /*********************************************************** | |||
| 2 | Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, | |||
| 3 | and the Massachusetts Institute of Technology, Cambridge, Massachusetts. | |||
| 4 | ||||
| 5 | All Rights Reserved | |||
| 6 | ||||
| 7 | Permission to use, copy, modify, and distribute this software and its | |||
| 8 | documentation for any purpose and without fee is hereby granted, | |||
| 9 | provided that the above copyright notice appear in all copies and that | |||
| 10 | both that copyright notice and this permission notice appear in | |||
| 11 | supporting documentation, and that the names of Digital or MIT not be | |||
| 12 | used in advertising or publicity pertaining to distribution of the | |||
| 13 | software without specific, written prior permission. | |||
| 14 | ||||
| 15 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |||
| 16 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |||
| 17 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | |||
| 18 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |||
| 19 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |||
| 20 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |||
| 21 | SOFTWARE. | |||
| 22 | ******************************************************************/ | |||
| 23 | ||||
| 24 | #ifdef HAVE_DIX_CONFIG_H1 | |||
| 25 | #include <dix-config.h> | |||
| 26 | #endif | |||
| 27 | ||||
| 28 | #include <string.h> | |||
| 29 | ||||
| 30 | #include <X11/X.h> | |||
| 31 | #include <X11/Xproto.h> | |||
| 32 | #include "misc.h" | |||
| 33 | #include "scrnintstr.h" | |||
| 34 | #include "windowstr.h" | |||
| 35 | #include "pixmapstr.h" | |||
| 36 | #include "gcstruct.h" | |||
| 37 | #include "dixstruct.h" | |||
| 38 | #include "resource.h" | |||
| 39 | #include "opaque.h" | |||
| 40 | ||||
| 41 | #include <X11/extensions/Xv.h> | |||
| 42 | #include <X11/extensions/Xvproto.h> | |||
| 43 | #include "xvdix.h" | |||
| 44 | #ifdef MITSHM1 | |||
| 45 | #include <X11/extensions/shmproto.h> | |||
| 46 | #include "shmint.h" | |||
| 47 | #endif | |||
| 48 | ||||
| 49 | #include "xvdisp.h" | |||
| 50 | ||||
| 51 | #ifdef PANORAMIX1 | |||
| 52 | #include "panoramiX.h" | |||
| 53 | #include "panoramiXsrv.h" | |||
| 54 | ||||
| 55 | unsigned long XvXRTPort; | |||
| 56 | #endif | |||
| 57 | ||||
| 58 | static int | |||
| 59 | SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep) | |||
| 60 | { | |||
| 61 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 62 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 63 | swaps(&rep->version)do { if (sizeof(*(&rep->version)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->version) & 1) && ((uintptr_t)(&rep->version) & 1) == 0) *(&rep->version) = lswaps(*(&rep->version)) ; else swap_uint16((uint16_t *)(&rep->version)); } while (0); | |||
| 64 | swaps(&rep->revision)do { if (sizeof(*(&rep->revision)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->revision) & 1) && ((uintptr_t)(&rep->revision) & 1) == 0) *(&rep->revision) = lswaps(*(&rep->revision )); else swap_uint16((uint16_t *)(&rep->revision)); } while (0); | |||
| 65 | ||||
| 66 | WriteToClient(client, sz_xvQueryExtensionReply32, rep); | |||
| 67 | ||||
| 68 | return Success0; | |||
| 69 | } | |||
| 70 | ||||
| 71 | static int | |||
| 72 | SWriteQueryAdaptorsReply(ClientPtr client, xvQueryAdaptorsReply * rep) | |||
| 73 | { | |||
| 74 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 75 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 76 | swaps(&rep->num_adaptors)do { if (sizeof(*(&rep->num_adaptors)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->num_adaptors ) & 1) && ((uintptr_t)(&rep->num_adaptors) & 1) == 0) *(&rep->num_adaptors) = lswaps(*(& rep->num_adaptors)); else swap_uint16((uint16_t *)(&rep ->num_adaptors)); } while (0); | |||
| 77 | ||||
| 78 | WriteToClient(client, sz_xvQueryAdaptorsReply32, rep); | |||
| 79 | ||||
| 80 | return Success0; | |||
| 81 | } | |||
| 82 | ||||
| 83 | static int | |||
| 84 | SWriteQueryEncodingsReply(ClientPtr client, xvQueryEncodingsReply * rep) | |||
| 85 | { | |||
| 86 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 87 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 88 | swaps(&rep->num_encodings)do { if (sizeof(*(&rep->num_encodings)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->num_encodings ) & 1) && ((uintptr_t)(&rep->num_encodings ) & 1) == 0) *(&rep->num_encodings) = lswaps(*(& rep->num_encodings)); else swap_uint16((uint16_t *)(&rep ->num_encodings)); } while (0); | |||
| 89 | ||||
| 90 | WriteToClient(client, sz_xvQueryEncodingsReply32, rep); | |||
| 91 | ||||
| 92 | return Success0; | |||
| 93 | } | |||
| 94 | ||||
| 95 | static int | |||
| 96 | SWriteAdaptorInfo(ClientPtr client, xvAdaptorInfo * pAdaptor) | |||
| 97 | { | |||
| 98 | swapl(&pAdaptor->base_id)do { if (sizeof(*(&pAdaptor->base_id)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pAdaptor->base_id ) & 3) && ((uintptr_t)(&pAdaptor->base_id) & 3) == 0) *(&pAdaptor->base_id) = lswapl(*(& pAdaptor->base_id)); else swap_uint32((uint32_t *)(&pAdaptor ->base_id)); } while (0); | |||
| 99 | swaps(&pAdaptor->name_size)do { if (sizeof(*(&pAdaptor->name_size)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pAdaptor->name_size ) & 1) && ((uintptr_t)(&pAdaptor->name_size ) & 1) == 0) *(&pAdaptor->name_size) = lswaps(*(& pAdaptor->name_size)); else swap_uint16((uint16_t *)(& pAdaptor->name_size)); } while (0); | |||
| 100 | swaps(&pAdaptor->num_ports)do { if (sizeof(*(&pAdaptor->num_ports)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pAdaptor->num_ports ) & 1) && ((uintptr_t)(&pAdaptor->num_ports ) & 1) == 0) *(&pAdaptor->num_ports) = lswaps(*(& pAdaptor->num_ports)); else swap_uint16((uint16_t *)(& pAdaptor->num_ports)); } while (0); | |||
| 101 | swaps(&pAdaptor->num_formats)do { if (sizeof(*(&pAdaptor->num_formats)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pAdaptor->num_formats ) & 1) && ((uintptr_t)(&pAdaptor->num_formats ) & 1) == 0) *(&pAdaptor->num_formats) = lswaps(*( &pAdaptor->num_formats)); else swap_uint16((uint16_t * )(&pAdaptor->num_formats)); } while (0); | |||
| 102 | ||||
| 103 | WriteToClient(client, sz_xvAdaptorInfo12, pAdaptor); | |||
| 104 | ||||
| 105 | return Success0; | |||
| 106 | } | |||
| 107 | ||||
| 108 | static int | |||
| 109 | SWriteEncodingInfo(ClientPtr client, xvEncodingInfo * pEncoding) | |||
| 110 | { | |||
| 111 | ||||
| 112 | swapl(&pEncoding->encoding)do { if (sizeof(*(&pEncoding->encoding)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pEncoding->encoding ) & 3) && ((uintptr_t)(&pEncoding->encoding ) & 3) == 0) *(&pEncoding->encoding) = lswapl(*(& pEncoding->encoding)); else swap_uint32((uint32_t *)(& pEncoding->encoding)); } while (0); | |||
| 113 | swaps(&pEncoding->name_size)do { if (sizeof(*(&pEncoding->name_size)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pEncoding->name_size ) & 1) && ((uintptr_t)(&pEncoding->name_size ) & 1) == 0) *(&pEncoding->name_size) = lswaps(*(& pEncoding->name_size)); else swap_uint16((uint16_t *)(& pEncoding->name_size)); } while (0); | |||
| 114 | swaps(&pEncoding->width)do { if (sizeof(*(&pEncoding->width)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pEncoding->width ) & 1) && ((uintptr_t)(&pEncoding->width) & 1) == 0) *(&pEncoding->width) = lswaps(*(&pEncoding ->width)); else swap_uint16((uint16_t *)(&pEncoding-> width)); } while (0); | |||
| 115 | swaps(&pEncoding->height)do { if (sizeof(*(&pEncoding->height)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pEncoding->height ) & 1) && ((uintptr_t)(&pEncoding->height) & 1) == 0) *(&pEncoding->height) = lswaps(*(& pEncoding->height)); else swap_uint16((uint16_t *)(&pEncoding ->height)); } while (0); | |||
| 116 | swapl(&pEncoding->rate.numerator)do { if (sizeof(*(&pEncoding->rate.numerator)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pEncoding->rate .numerator) & 3) && ((uintptr_t)(&pEncoding-> rate.numerator) & 3) == 0) *(&pEncoding->rate.numerator ) = lswapl(*(&pEncoding->rate.numerator)); else swap_uint32 ((uint32_t *)(&pEncoding->rate.numerator)); } while (0 ); | |||
| 117 | swapl(&pEncoding->rate.denominator)do { if (sizeof(*(&pEncoding->rate.denominator)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&pEncoding ->rate.denominator) & 3) && ((uintptr_t)(& pEncoding->rate.denominator) & 3) == 0) *(&pEncoding ->rate.denominator) = lswapl(*(&pEncoding->rate.denominator )); else swap_uint32((uint32_t *)(&pEncoding->rate.denominator )); } while (0); | |||
| 118 | WriteToClient(client, sz_xvEncodingInfo(12 + 8), pEncoding); | |||
| 119 | ||||
| 120 | return Success0; | |||
| 121 | } | |||
| 122 | ||||
| 123 | static int | |||
| 124 | SWriteFormat(ClientPtr client, xvFormat * pFormat) | |||
| 125 | { | |||
| 126 | swapl(&pFormat->visual)do { if (sizeof(*(&pFormat->visual)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&pFormat->visual ) & 3) && ((uintptr_t)(&pFormat->visual) & 3) == 0) *(&pFormat->visual) = lswapl(*(&pFormat-> visual)); else swap_uint32((uint32_t *)(&pFormat->visual )); } while (0); | |||
| 127 | WriteToClient(client, sz_xvFormat8, pFormat); | |||
| 128 | ||||
| 129 | return Success0; | |||
| 130 | } | |||
| 131 | ||||
| 132 | static int | |||
| 133 | SWriteAttributeInfo(ClientPtr client, xvAttributeInfo * pAtt) | |||
| 134 | { | |||
| 135 | swapl(&pAtt->flags)do { if (sizeof(*(&pAtt->flags)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&pAtt->flags) & 3) && ((uintptr_t)(&pAtt->flags) & 3) == 0 ) *(&pAtt->flags) = lswapl(*(&pAtt->flags)); else swap_uint32((uint32_t *)(&pAtt->flags)); } while (0); | |||
| 136 | swapl(&pAtt->size)do { if (sizeof(*(&pAtt->size)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&pAtt->size) & 3 ) && ((uintptr_t)(&pAtt->size) & 3) == 0) * (&pAtt->size) = lswapl(*(&pAtt->size)); else swap_uint32 ((uint32_t *)(&pAtt->size)); } while (0); | |||
| 137 | swapl(&pAtt->min)do { if (sizeof(*(&pAtt->min)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&pAtt->min) & 3) && ((uintptr_t)(&pAtt->min) & 3) == 0) *(&pAtt-> min) = lswapl(*(&pAtt->min)); else swap_uint32((uint32_t *)(&pAtt->min)); } while (0); | |||
| 138 | swapl(&pAtt->max)do { if (sizeof(*(&pAtt->max)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&pAtt->max) & 3) && ((uintptr_t)(&pAtt->max) & 3) == 0) *(&pAtt-> max) = lswapl(*(&pAtt->max)); else swap_uint32((uint32_t *)(&pAtt->max)); } while (0); | |||
| 139 | WriteToClient(client, sz_xvAttributeInfo16, pAtt); | |||
| 140 | ||||
| 141 | return Success0; | |||
| 142 | } | |||
| 143 | ||||
| 144 | static int | |||
| 145 | SWriteImageFormatInfo(ClientPtr client, xvImageFormatInfo * pImage) | |||
| 146 | { | |||
| 147 | swapl(&pImage->id)do { if (sizeof(*(&pImage->id)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&pImage->id) & 3 ) && ((uintptr_t)(&pImage->id) & 3) == 0) * (&pImage->id) = lswapl(*(&pImage->id)); else swap_uint32 ((uint32_t *)(&pImage->id)); } while (0); | |||
| 148 | swapl(&pImage->red_mask)do { if (sizeof(*(&pImage->red_mask)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->red_mask ) & 3) && ((uintptr_t)(&pImage->red_mask) & 3) == 0) *(&pImage->red_mask) = lswapl(*(&pImage-> red_mask)); else swap_uint32((uint32_t *)(&pImage->red_mask )); } while (0); | |||
| 149 | swapl(&pImage->green_mask)do { if (sizeof(*(&pImage->green_mask)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->green_mask ) & 3) && ((uintptr_t)(&pImage->green_mask ) & 3) == 0) *(&pImage->green_mask) = lswapl(*(& pImage->green_mask)); else swap_uint32((uint32_t *)(&pImage ->green_mask)); } while (0); | |||
| 150 | swapl(&pImage->blue_mask)do { if (sizeof(*(&pImage->blue_mask)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->blue_mask ) & 3) && ((uintptr_t)(&pImage->blue_mask) & 3) == 0) *(&pImage->blue_mask) = lswapl(*(& pImage->blue_mask)); else swap_uint32((uint32_t *)(&pImage ->blue_mask)); } while (0); | |||
| 151 | swapl(&pImage->y_sample_bits)do { if (sizeof(*(&pImage->y_sample_bits)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->y_sample_bits ) & 3) && ((uintptr_t)(&pImage->y_sample_bits ) & 3) == 0) *(&pImage->y_sample_bits) = lswapl(*( &pImage->y_sample_bits)); else swap_uint32((uint32_t * )(&pImage->y_sample_bits)); } while (0); | |||
| 152 | swapl(&pImage->u_sample_bits)do { if (sizeof(*(&pImage->u_sample_bits)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->u_sample_bits ) & 3) && ((uintptr_t)(&pImage->u_sample_bits ) & 3) == 0) *(&pImage->u_sample_bits) = lswapl(*( &pImage->u_sample_bits)); else swap_uint32((uint32_t * )(&pImage->u_sample_bits)); } while (0); | |||
| 153 | swapl(&pImage->v_sample_bits)do { if (sizeof(*(&pImage->v_sample_bits)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->v_sample_bits ) & 3) && ((uintptr_t)(&pImage->v_sample_bits ) & 3) == 0) *(&pImage->v_sample_bits) = lswapl(*( &pImage->v_sample_bits)); else swap_uint32((uint32_t * )(&pImage->v_sample_bits)); } while (0); | |||
| 154 | swapl(&pImage->horz_y_period)do { if (sizeof(*(&pImage->horz_y_period)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->horz_y_period ) & 3) && ((uintptr_t)(&pImage->horz_y_period ) & 3) == 0) *(&pImage->horz_y_period) = lswapl(*( &pImage->horz_y_period)); else swap_uint32((uint32_t * )(&pImage->horz_y_period)); } while (0); | |||
| 155 | swapl(&pImage->horz_u_period)do { if (sizeof(*(&pImage->horz_u_period)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->horz_u_period ) & 3) && ((uintptr_t)(&pImage->horz_u_period ) & 3) == 0) *(&pImage->horz_u_period) = lswapl(*( &pImage->horz_u_period)); else swap_uint32((uint32_t * )(&pImage->horz_u_period)); } while (0); | |||
| 156 | swapl(&pImage->horz_v_period)do { if (sizeof(*(&pImage->horz_v_period)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->horz_v_period ) & 3) && ((uintptr_t)(&pImage->horz_v_period ) & 3) == 0) *(&pImage->horz_v_period) = lswapl(*( &pImage->horz_v_period)); else swap_uint32((uint32_t * )(&pImage->horz_v_period)); } while (0); | |||
| 157 | swapl(&pImage->vert_y_period)do { if (sizeof(*(&pImage->vert_y_period)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->vert_y_period ) & 3) && ((uintptr_t)(&pImage->vert_y_period ) & 3) == 0) *(&pImage->vert_y_period) = lswapl(*( &pImage->vert_y_period)); else swap_uint32((uint32_t * )(&pImage->vert_y_period)); } while (0); | |||
| 158 | swapl(&pImage->vert_u_period)do { if (sizeof(*(&pImage->vert_u_period)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->vert_u_period ) & 3) && ((uintptr_t)(&pImage->vert_u_period ) & 3) == 0) *(&pImage->vert_u_period) = lswapl(*( &pImage->vert_u_period)); else swap_uint32((uint32_t * )(&pImage->vert_u_period)); } while (0); | |||
| 159 | swapl(&pImage->vert_v_period)do { if (sizeof(*(&pImage->vert_v_period)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&pImage->vert_v_period ) & 3) && ((uintptr_t)(&pImage->vert_v_period ) & 3) == 0) *(&pImage->vert_v_period) = lswapl(*( &pImage->vert_v_period)); else swap_uint32((uint32_t * )(&pImage->vert_v_period)); } while (0); | |||
| 160 | ||||
| 161 | WriteToClient(client, sz_xvImageFormatInfo128, pImage); | |||
| 162 | ||||
| 163 | return Success0; | |||
| 164 | } | |||
| 165 | ||||
| 166 | static int | |||
| 167 | SWriteGrabPortReply(ClientPtr client, xvGrabPortReply * rep) | |||
| 168 | { | |||
| 169 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 170 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 171 | ||||
| 172 | WriteToClient(client, sz_xvGrabPortReply32, rep); | |||
| 173 | ||||
| 174 | return Success0; | |||
| 175 | } | |||
| 176 | ||||
| 177 | static int | |||
| 178 | SWriteGetPortAttributeReply(ClientPtr client, xvGetPortAttributeReply * rep) | |||
| 179 | { | |||
| 180 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 181 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 182 | swapl(&rep->value)do { if (sizeof(*(&rep->value)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->value) & 3 ) && ((uintptr_t)(&rep->value) & 3) == 0) * (&rep->value) = lswapl(*(&rep->value)); else swap_uint32 ((uint32_t *)(&rep->value)); } while (0); | |||
| 183 | ||||
| 184 | WriteToClient(client, sz_xvGetPortAttributeReply32, rep); | |||
| 185 | ||||
| 186 | return Success0; | |||
| 187 | } | |||
| 188 | ||||
| 189 | static int | |||
| 190 | SWriteQueryBestSizeReply(ClientPtr client, xvQueryBestSizeReply * rep) | |||
| 191 | { | |||
| 192 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 193 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 194 | swaps(&rep->actual_width)do { if (sizeof(*(&rep->actual_width)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->actual_width ) & 1) && ((uintptr_t)(&rep->actual_width) & 1) == 0) *(&rep->actual_width) = lswaps(*(& rep->actual_width)); else swap_uint16((uint16_t *)(&rep ->actual_width)); } while (0); | |||
| 195 | swaps(&rep->actual_height)do { if (sizeof(*(&rep->actual_height)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->actual_height ) & 1) && ((uintptr_t)(&rep->actual_height ) & 1) == 0) *(&rep->actual_height) = lswaps(*(& rep->actual_height)); else swap_uint16((uint16_t *)(&rep ->actual_height)); } while (0); | |||
| 196 | ||||
| 197 | WriteToClient(client, sz_xvQueryBestSizeReply32, rep); | |||
| 198 | ||||
| 199 | return Success0; | |||
| 200 | } | |||
| 201 | ||||
| 202 | static int | |||
| 203 | SWriteQueryPortAttributesReply(ClientPtr client, | |||
| 204 | xvQueryPortAttributesReply * rep) | |||
| 205 | { | |||
| 206 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 207 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 208 | swapl(&rep->num_attributes)do { if (sizeof(*(&rep->num_attributes)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->num_attributes ) & 3) && ((uintptr_t)(&rep->num_attributes ) & 3) == 0) *(&rep->num_attributes) = lswapl(*(& rep->num_attributes)); else swap_uint32((uint32_t *)(& rep->num_attributes)); } while (0); | |||
| 209 | swapl(&rep->text_size)do { if (sizeof(*(&rep->text_size)) != 4) wrong_size() ; if (__builtin_constant_p((uintptr_t)(&rep->text_size ) & 3) && ((uintptr_t)(&rep->text_size) & 3) == 0) *(&rep->text_size) = lswapl(*(&rep->text_size )); else swap_uint32((uint32_t *)(&rep->text_size)); } while (0); | |||
| 210 | ||||
| 211 | WriteToClient(client, sz_xvQueryPortAttributesReply32, rep); | |||
| 212 | ||||
| 213 | return Success0; | |||
| 214 | } | |||
| 215 | ||||
| 216 | static int | |||
| 217 | SWriteQueryImageAttributesReply(ClientPtr client, | |||
| 218 | xvQueryImageAttributesReply * rep) | |||
| 219 | { | |||
| 220 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 221 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 222 | swapl(&rep->num_planes)do { if (sizeof(*(&rep->num_planes)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&rep->num_planes ) & 3) && ((uintptr_t)(&rep->num_planes) & 3) == 0) *(&rep->num_planes) = lswapl(*(&rep-> num_planes)); else swap_uint32((uint32_t *)(&rep->num_planes )); } while (0); | |||
| 223 | swapl(&rep->data_size)do { if (sizeof(*(&rep->data_size)) != 4) wrong_size() ; if (__builtin_constant_p((uintptr_t)(&rep->data_size ) & 3) && ((uintptr_t)(&rep->data_size) & 3) == 0) *(&rep->data_size) = lswapl(*(&rep->data_size )); else swap_uint32((uint32_t *)(&rep->data_size)); } while (0); | |||
| 224 | swaps(&rep->width)do { if (sizeof(*(&rep->width)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->width) & 1 ) && ((uintptr_t)(&rep->width) & 1) == 0) * (&rep->width) = lswaps(*(&rep->width)); else swap_uint16 ((uint16_t *)(&rep->width)); } while (0); | |||
| 225 | swaps(&rep->height)do { if (sizeof(*(&rep->height)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->height) & 1) && ((uintptr_t)(&rep->height) & 1) == 0 ) *(&rep->height) = lswaps(*(&rep->height)); else swap_uint16((uint16_t *)(&rep->height)); } while (0); | |||
| 226 | ||||
| 227 | WriteToClient(client, sz_xvQueryImageAttributesReply32, rep); | |||
| 228 | ||||
| 229 | return Success0; | |||
| 230 | } | |||
| 231 | ||||
| 232 | static int | |||
| 233 | SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep) | |||
| 234 | { | |||
| 235 | swaps(&rep->sequenceNumber)do { if (sizeof(*(&rep->sequenceNumber)) != 2) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->sequenceNumber ) & 1) && ((uintptr_t)(&rep->sequenceNumber ) & 1) == 0) *(&rep->sequenceNumber) = lswaps(*(& rep->sequenceNumber)); else swap_uint16((uint16_t *)(& rep->sequenceNumber)); } while (0); | |||
| 236 | swapl(&rep->length)do { if (sizeof(*(&rep->length)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&rep->length) & 3) && ((uintptr_t)(&rep->length) & 3) == 0 ) *(&rep->length) = lswapl(*(&rep->length)); else swap_uint32((uint32_t *)(&rep->length)); } while (0); | |||
| 237 | swapl(&rep->num_formats)do { if (sizeof(*(&rep->num_formats)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&rep->num_formats ) & 3) && ((uintptr_t)(&rep->num_formats) & 3) == 0) *(&rep->num_formats) = lswapl(*(&rep-> num_formats)); else swap_uint32((uint32_t *)(&rep->num_formats )); } while (0); | |||
| 238 | ||||
| 239 | WriteToClient(client, sz_xvListImageFormatsReply32, rep); | |||
| 240 | ||||
| 241 | return Success0; | |||
| 242 | } | |||
| 243 | ||||
| 244 | #define _WriteQueryAdaptorsReply(_c,_d)if ((_c)->swapped) SWriteQueryAdaptorsReply(_c, _d); else WriteToClient (_c, 32, _d) \ | |||
| 245 | if ((_c)->swapped) SWriteQueryAdaptorsReply(_c, _d); \ | |||
| 246 | else WriteToClient(_c, sz_xvQueryAdaptorsReply32, _d) | |||
| 247 | ||||
| 248 | #define _WriteQueryExtensionReply(_c,_d)if ((_c)->swapped) SWriteQueryExtensionReply(_c, _d); else WriteToClient(_c, 32, _d) \ | |||
| 249 | if ((_c)->swapped) SWriteQueryExtensionReply(_c, _d); \ | |||
| 250 | else WriteToClient(_c, sz_xvQueryExtensionReply32, _d) | |||
| 251 | ||||
| 252 | #define _WriteQueryEncodingsReply(_c,_d)if ((_c)->swapped) SWriteQueryEncodingsReply(_c, _d); else WriteToClient(_c, 32, _d) \ | |||
| 253 | if ((_c)->swapped) SWriteQueryEncodingsReply(_c, _d); \ | |||
| 254 | else WriteToClient(_c, sz_xvQueryEncodingsReply32, _d) | |||
| 255 | ||||
| 256 | #define _WriteAdaptorInfo(_c,_d)if ((_c)->swapped) SWriteAdaptorInfo(_c, _d); else WriteToClient (_c, 12, _d) \ | |||
| 257 | if ((_c)->swapped) SWriteAdaptorInfo(_c, _d); \ | |||
| 258 | else WriteToClient(_c, sz_xvAdaptorInfo12, _d) | |||
| 259 | ||||
| 260 | #define _WriteAttributeInfo(_c,_d)if ((_c)->swapped) SWriteAttributeInfo(_c, _d); else WriteToClient (_c, 16, _d) \ | |||
| 261 | if ((_c)->swapped) SWriteAttributeInfo(_c, _d); \ | |||
| 262 | else WriteToClient(_c, sz_xvAttributeInfo16, _d) | |||
| 263 | ||||
| 264 | #define _WriteEncodingInfo(_c,_d)if ((_c)->swapped) SWriteEncodingInfo(_c, _d); else WriteToClient (_c, (12 + 8), _d) \ | |||
| 265 | if ((_c)->swapped) SWriteEncodingInfo(_c, _d); \ | |||
| 266 | else WriteToClient(_c, sz_xvEncodingInfo(12 + 8), _d) | |||
| 267 | ||||
| 268 | #define _WriteFormat(_c,_d)if ((_c)->swapped) SWriteFormat(_c, _d); else WriteToClient (_c, 8, _d) \ | |||
| 269 | if ((_c)->swapped) SWriteFormat(_c, _d); \ | |||
| 270 | else WriteToClient(_c, sz_xvFormat8, _d) | |||
| 271 | ||||
| 272 | #define _WriteGrabPortReply(_c,_d)if ((_c)->swapped) SWriteGrabPortReply(_c, _d); else WriteToClient (_c, 32, _d) \ | |||
| 273 | if ((_c)->swapped) SWriteGrabPortReply(_c, _d); \ | |||
| 274 | else WriteToClient(_c, sz_xvGrabPortReply32, _d) | |||
| 275 | ||||
| 276 | #define _WriteGetPortAttributeReply(_c,_d)if ((_c)->swapped) SWriteGetPortAttributeReply(_c, _d); else WriteToClient(_c, 32, _d) \ | |||
| 277 | if ((_c)->swapped) SWriteGetPortAttributeReply(_c, _d); \ | |||
| 278 | else WriteToClient(_c, sz_xvGetPortAttributeReply32, _d) | |||
| 279 | ||||
| 280 | #define _WriteQueryBestSizeReply(_c,_d)if ((_c)->swapped) SWriteQueryBestSizeReply(_c, _d); else WriteToClient (_c, 32, _d) \ | |||
| 281 | if ((_c)->swapped) SWriteQueryBestSizeReply(_c, _d); \ | |||
| 282 | else WriteToClient(_c, sz_xvQueryBestSizeReply32, _d) | |||
| 283 | ||||
| 284 | #define _WriteQueryPortAttributesReply(_c,_d)if ((_c)->swapped) SWriteQueryPortAttributesReply(_c, _d); else WriteToClient(_c, 32, _d) \ | |||
| 285 | if ((_c)->swapped) SWriteQueryPortAttributesReply(_c, _d); \ | |||
| 286 | else WriteToClient(_c, sz_xvQueryPortAttributesReply32, _d) | |||
| 287 | ||||
| 288 | #define _WriteQueryImageAttributesReply(_c,_d)if ((_c)->swapped) SWriteQueryImageAttributesReply(_c, _d) ; else WriteToClient(_c, 32, _d) \ | |||
| 289 | if ((_c)->swapped) SWriteQueryImageAttributesReply(_c, _d); \ | |||
| 290 | else WriteToClient(_c, sz_xvQueryImageAttributesReply32, _d) | |||
| 291 | ||||
| 292 | #define _WriteListImageFormatsReply(_c,_d)if ((_c)->swapped) SWriteListImageFormatsReply(_c, _d); else WriteToClient(_c, 32, _d) \ | |||
| 293 | if ((_c)->swapped) SWriteListImageFormatsReply(_c, _d); \ | |||
| 294 | else WriteToClient(_c, sz_xvListImageFormatsReply32, _d) | |||
| 295 | ||||
| 296 | #define _WriteImageFormatInfo(_c,_d)if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); else WriteToClient (_c, 128, _d) \ | |||
| 297 | if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \ | |||
| 298 | else WriteToClient(_c, sz_xvImageFormatInfo128, _d) | |||
| 299 | ||||
| 300 | static int | |||
| 301 | ProcXvQueryExtension(ClientPtr client) | |||
| 302 | { | |||
| 303 | xvQueryExtensionReply rep = { | |||
| 304 | .type = X_Reply1, | |||
| 305 | .sequenceNumber = client->sequence, | |||
| 306 | .length = 0, | |||
| 307 | .version = XvVersion2, | |||
| 308 | .revision = XvRevision2 | |||
| 309 | }; | |||
| 310 | ||||
| 311 | /* REQUEST(xvQueryExtensionReq); */ | |||
| 312 | REQUEST_SIZE_MATCH(xvQueryExtensionReq)if ((sizeof(xvQueryExtensionReq) >> 2) != client->req_len ) return(16); | |||
| 313 | ||||
| 314 | _WriteQueryExtensionReply(client, &rep)if ((client)->swapped) SWriteQueryExtensionReply(client, & rep); else WriteToClient(client, 32, &rep); | |||
| 315 | ||||
| 316 | return Success0; | |||
| 317 | } | |||
| 318 | ||||
| 319 | static int | |||
| 320 | ProcXvQueryAdaptors(ClientPtr client) | |||
| 321 | { | |||
| 322 | xvFormat format; | |||
| 323 | xvAdaptorInfo ainfo; | |||
| 324 | xvQueryAdaptorsReply rep; | |||
| 325 | int totalSize, na, nf, rc; | |||
| 326 | int nameSize; | |||
| 327 | XvAdaptorPtr pa; | |||
| 328 | XvFormatPtr pf; | |||
| 329 | WindowPtr pWin; | |||
| 330 | ScreenPtr pScreen; | |||
| 331 | XvScreenPtr pxvs; | |||
| 332 | ||||
| 333 | REQUEST(xvQueryAdaptorsReq)xvQueryAdaptorsReq *stuff = (xvQueryAdaptorsReq *)client-> requestBuffer; | |||
| 334 | REQUEST_SIZE_MATCH(xvQueryAdaptorsReq)if ((sizeof(xvQueryAdaptorsReq) >> 2) != client->req_len ) return(16); | |||
| 335 | ||||
| 336 | rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess(1<<4)); | |||
| 337 | if (rc != Success0) | |||
| 338 | return rc; | |||
| 339 | ||||
| 340 | pScreen = pWin->drawable.pScreen; | |||
| 341 | pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, | |||
| 342 | XvGetScreenKey()); | |||
| 343 | if (!pxvs) { | |||
| 344 | rep = (xvQueryAdaptorsReply) { | |||
| 345 | .type = X_Reply1, | |||
| 346 | .sequenceNumber = client->sequence, | |||
| 347 | .length = 0, | |||
| 348 | .num_adaptors = 0 | |||
| 349 | }; | |||
| 350 | ||||
| 351 | _WriteQueryAdaptorsReply(client, &rep)if ((client)->swapped) SWriteQueryAdaptorsReply(client, & rep); else WriteToClient(client, 32, &rep); | |||
| 352 | ||||
| 353 | return Success0; | |||
| 354 | } | |||
| 355 | ||||
| 356 | rep = (xvQueryAdaptorsReply) { | |||
| 357 | .type = X_Reply1, | |||
| 358 | .sequenceNumber = client->sequence, | |||
| 359 | .num_adaptors = pxvs->nAdaptors | |||
| 360 | }; | |||
| 361 | ||||
| 362 | /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */ | |||
| 363 | ||||
| 364 | totalSize = pxvs->nAdaptors * sz_xvAdaptorInfo12; | |||
| 365 | ||||
| 366 | /* FOR EACH ADPATOR ADD UP THE BYTES FOR ENCODINGS AND FORMATS */ | |||
| 367 | ||||
| 368 | na = pxvs->nAdaptors; | |||
| 369 | pa = pxvs->pAdaptors; | |||
| 370 | while (na--) { | |||
| 371 | totalSize += pad_to_int32(strlen(pa->name)); | |||
| 372 | totalSize += pa->nFormats * sz_xvFormat8; | |||
| 373 | pa++; | |||
| 374 | } | |||
| 375 | ||||
| 376 | rep.length = bytes_to_int32(totalSize); | |||
| 377 | ||||
| 378 | _WriteQueryAdaptorsReply(client, &rep)if ((client)->swapped) SWriteQueryAdaptorsReply(client, & rep); else WriteToClient(client, 32, &rep); | |||
| 379 | ||||
| 380 | na = pxvs->nAdaptors; | |||
| 381 | pa = pxvs->pAdaptors; | |||
| 382 | while (na--) { | |||
| 383 | ||||
| 384 | ainfo.base_id = pa->base_id; | |||
| 385 | ainfo.num_ports = pa->nPorts; | |||
| 386 | ainfo.type = pa->type; | |||
| 387 | ainfo.name_size = nameSize = strlen(pa->name); | |||
| 388 | ainfo.num_formats = pa->nFormats; | |||
| 389 | ||||
| 390 | _WriteAdaptorInfo(client, &ainfo)if ((client)->swapped) SWriteAdaptorInfo(client, &ainfo ); else WriteToClient(client, 12, &ainfo); | |||
| 391 | ||||
| 392 | WriteToClient(client, nameSize, pa->name); | |||
| 393 | ||||
| 394 | nf = pa->nFormats; | |||
| 395 | pf = pa->pFormats; | |||
| 396 | while (nf--) { | |||
| 397 | format.depth = pf->depth; | |||
| 398 | format.visual = pf->visual; | |||
| 399 | _WriteFormat(client, &format)if ((client)->swapped) SWriteFormat(client, &format); else WriteToClient(client, 8, &format); | |||
| 400 | pf++; | |||
| 401 | } | |||
| 402 | ||||
| 403 | pa++; | |||
| 404 | ||||
| 405 | } | |||
| 406 | ||||
| 407 | return Success0; | |||
| 408 | } | |||
| 409 | ||||
| 410 | static int | |||
| 411 | ProcXvQueryEncodings(ClientPtr client) | |||
| 412 | { | |||
| 413 | xvEncodingInfo einfo; | |||
| 414 | xvQueryEncodingsReply rep; | |||
| 415 | int totalSize; | |||
| 416 | int nameSize; | |||
| 417 | XvPortPtr pPort; | |||
| 418 | int ne; | |||
| 419 | XvEncodingPtr pe; | |||
| 420 | ||||
| 421 | REQUEST(xvQueryEncodingsReq)xvQueryEncodingsReq *stuff = (xvQueryEncodingsReq *)client-> requestBuffer; | |||
| 422 | REQUEST_SIZE_MATCH(xvQueryEncodingsReq)if ((sizeof(xvQueryEncodingsReq) >> 2) != client->req_len ) return(16); | |||
| 423 | ||||
| 424 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 425 | ||||
| 426 | rep = (xvQueryEncodingsReply) { | |||
| 427 | .type = X_Reply1, | |||
| 428 | .sequenceNumber = client->sequence, | |||
| 429 | .num_encodings = pPort->pAdaptor->nEncodings | |||
| 430 | }; | |||
| 431 | ||||
| 432 | /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */ | |||
| 433 | ||||
| 434 | ne = pPort->pAdaptor->nEncodings; | |||
| 435 | pe = pPort->pAdaptor->pEncodings; | |||
| 436 | totalSize = ne * sz_xvEncodingInfo(12 + 8); | |||
| 437 | while (ne--) { | |||
| 438 | totalSize += pad_to_int32(strlen(pe->name)); | |||
| 439 | pe++; | |||
| 440 | } | |||
| 441 | ||||
| 442 | rep.length = bytes_to_int32(totalSize); | |||
| 443 | ||||
| 444 | _WriteQueryEncodingsReply(client, &rep)if ((client)->swapped) SWriteQueryEncodingsReply(client, & rep); else WriteToClient(client, 32, &rep); | |||
| 445 | ||||
| 446 | ne = pPort->pAdaptor->nEncodings; | |||
| 447 | pe = pPort->pAdaptor->pEncodings; | |||
| 448 | while (ne--) { | |||
| 449 | einfo.encoding = pe->id; | |||
| 450 | einfo.name_size = nameSize = strlen(pe->name); | |||
| 451 | einfo.width = pe->width; | |||
| 452 | einfo.height = pe->height; | |||
| 453 | einfo.rate.numerator = pe->rate.numerator; | |||
| 454 | einfo.rate.denominator = pe->rate.denominator; | |||
| 455 | _WriteEncodingInfo(client, &einfo)if ((client)->swapped) SWriteEncodingInfo(client, &einfo ); else WriteToClient(client, (12 + 8), &einfo); | |||
| 456 | WriteToClient(client, nameSize, pe->name); | |||
| 457 | pe++; | |||
| 458 | } | |||
| 459 | ||||
| 460 | return Success0; | |||
| 461 | } | |||
| 462 | ||||
| 463 | static int | |||
| 464 | ProcXvPutVideo(ClientPtr client) | |||
| 465 | { | |||
| 466 | DrawablePtr pDraw; | |||
| 467 | XvPortPtr pPort; | |||
| 468 | GCPtr pGC; | |||
| 469 | int status; | |||
| 470 | ||||
| 471 | REQUEST(xvPutVideoReq)xvPutVideoReq *stuff = (xvPutVideoReq *)client->requestBuffer; | |||
| 472 | REQUEST_SIZE_MATCH(xvPutVideoReq)if ((sizeof(xvPutVideoReq) >> 2) != client->req_len) return(16); | |||
| 473 | ||||
| 474 | VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess){ int tmprc = dixLookupDrawable(&(pDraw), stuff->drawable , client, (-1), (1<<1)); if (tmprc != 0) return tmprc; tmprc = dixLookupGC(&(pGC), stuff->gc, client, (1<<24 )); if (tmprc != 0) return tmprc; if ((pGC->depth != pDraw ->depth) || (pGC->pScreen != pDraw->pScreen)) return 8; } if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC);; | |||
| 475 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 476 | ||||
| 477 | if (!(pPort->pAdaptor->type & XvInputMask(1<<0)) || | |||
| 478 | !(pPort->pAdaptor->type & XvVideoMask0x00000004)) { | |||
| 479 | client->errorValue = stuff->port; | |||
| 480 | return BadMatch8; | |||
| 481 | } | |||
| 482 | ||||
| 483 | status = XvdiMatchPort(pPort, pDraw); | |||
| 484 | if (status != Success0) { | |||
| 485 | return status; | |||
| 486 | } | |||
| 487 | ||||
| 488 | return XvdiPutVideo(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, | |||
| 489 | stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, | |||
| 490 | stuff->drw_w, stuff->drw_h); | |||
| 491 | } | |||
| 492 | ||||
| 493 | static int | |||
| 494 | ProcXvPutStill(ClientPtr client) | |||
| 495 | { | |||
| 496 | DrawablePtr pDraw; | |||
| 497 | XvPortPtr pPort; | |||
| 498 | GCPtr pGC; | |||
| 499 | int status; | |||
| 500 | ||||
| 501 | REQUEST(xvPutStillReq)xvPutStillReq *stuff = (xvPutStillReq *)client->requestBuffer; | |||
| 502 | REQUEST_SIZE_MATCH(xvPutStillReq)if ((sizeof(xvPutStillReq) >> 2) != client->req_len) return(16); | |||
| 503 | ||||
| 504 | VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess){ int tmprc = dixLookupDrawable(&(pDraw), stuff->drawable , client, (-1), (1<<1)); if (tmprc != 0) return tmprc; tmprc = dixLookupGC(&(pGC), stuff->gc, client, (1<<24 )); if (tmprc != 0) return tmprc; if ((pGC->depth != pDraw ->depth) || (pGC->pScreen != pDraw->pScreen)) return 8; } if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC);; | |||
| 505 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 506 | ||||
| 507 | if (!(pPort->pAdaptor->type & XvInputMask(1<<0)) || | |||
| 508 | !(pPort->pAdaptor->type & XvStillMask0x00000008)) { | |||
| 509 | client->errorValue = stuff->port; | |||
| 510 | return BadMatch8; | |||
| 511 | } | |||
| 512 | ||||
| 513 | status = XvdiMatchPort(pPort, pDraw); | |||
| 514 | if (status != Success0) { | |||
| 515 | return status; | |||
| 516 | } | |||
| 517 | ||||
| 518 | return XvdiPutStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, | |||
| 519 | stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, | |||
| 520 | stuff->drw_w, stuff->drw_h); | |||
| 521 | } | |||
| 522 | ||||
| 523 | static int | |||
| 524 | ProcXvGetVideo(ClientPtr client) | |||
| 525 | { | |||
| 526 | DrawablePtr pDraw; | |||
| 527 | XvPortPtr pPort; | |||
| 528 | GCPtr pGC; | |||
| 529 | int status; | |||
| 530 | ||||
| 531 | REQUEST(xvGetVideoReq)xvGetVideoReq *stuff = (xvGetVideoReq *)client->requestBuffer; | |||
| 532 | REQUEST_SIZE_MATCH(xvGetVideoReq)if ((sizeof(xvGetVideoReq) >> 2) != client->req_len) return(16); | |||
| 533 | ||||
| 534 | VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess){ int tmprc = dixLookupDrawable(&(pDraw), stuff->drawable , client, (-1), (1<<0)); if (tmprc != 0) return tmprc; tmprc = dixLookupGC(&(pGC), stuff->gc, client, (1<<24 )); if (tmprc != 0) return tmprc; if ((pGC->depth != pDraw ->depth) || (pGC->pScreen != pDraw->pScreen)) return 8; } if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC);; | |||
| 535 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 536 | ||||
| 537 | if (!(pPort->pAdaptor->type & XvOutputMask(1<<1)) || | |||
| 538 | !(pPort->pAdaptor->type & XvVideoMask0x00000004)) { | |||
| 539 | client->errorValue = stuff->port; | |||
| 540 | return BadMatch8; | |||
| 541 | } | |||
| 542 | ||||
| 543 | status = XvdiMatchPort(pPort, pDraw); | |||
| 544 | if (status != Success0) { | |||
| 545 | return status; | |||
| 546 | } | |||
| 547 | ||||
| 548 | return XvdiGetVideo(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, | |||
| 549 | stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, | |||
| 550 | stuff->drw_w, stuff->drw_h); | |||
| 551 | } | |||
| 552 | ||||
| 553 | static int | |||
| 554 | ProcXvGetStill(ClientPtr client) | |||
| 555 | { | |||
| 556 | DrawablePtr pDraw; | |||
| 557 | XvPortPtr pPort; | |||
| 558 | GCPtr pGC; | |||
| 559 | int status; | |||
| 560 | ||||
| 561 | REQUEST(xvGetStillReq)xvGetStillReq *stuff = (xvGetStillReq *)client->requestBuffer; | |||
| 562 | REQUEST_SIZE_MATCH(xvGetStillReq)if ((sizeof(xvGetStillReq) >> 2) != client->req_len) return(16); | |||
| 563 | ||||
| 564 | VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess){ int tmprc = dixLookupDrawable(&(pDraw), stuff->drawable , client, (-1), (1<<0)); if (tmprc != 0) return tmprc; tmprc = dixLookupGC(&(pGC), stuff->gc, client, (1<<24 )); if (tmprc != 0) return tmprc; if ((pGC->depth != pDraw ->depth) || (pGC->pScreen != pDraw->pScreen)) return 8; } if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC);; | |||
| 565 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 566 | ||||
| 567 | if (!(pPort->pAdaptor->type & XvOutputMask(1<<1)) || | |||
| 568 | !(pPort->pAdaptor->type & XvStillMask0x00000008)) { | |||
| 569 | client->errorValue = stuff->port; | |||
| 570 | return BadMatch8; | |||
| 571 | } | |||
| 572 | ||||
| 573 | status = XvdiMatchPort(pPort, pDraw); | |||
| 574 | if (status != Success0) { | |||
| 575 | return status; | |||
| 576 | } | |||
| 577 | ||||
| 578 | return XvdiGetStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, | |||
| 579 | stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, | |||
| 580 | stuff->drw_w, stuff->drw_h); | |||
| 581 | } | |||
| 582 | ||||
| 583 | static int | |||
| 584 | ProcXvSelectVideoNotify(ClientPtr client) | |||
| 585 | { | |||
| 586 | DrawablePtr pDraw; | |||
| 587 | int rc; | |||
| 588 | ||||
| 589 | REQUEST(xvSelectVideoNotifyReq)xvSelectVideoNotifyReq *stuff = (xvSelectVideoNotifyReq *)client ->requestBuffer; | |||
| 590 | REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq)if ((sizeof(xvSelectVideoNotifyReq) >> 2) != client-> req_len) return(16); | |||
| 591 | ||||
| 592 | rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, | |||
| 593 | DixReceiveAccess(1<<23)); | |||
| 594 | if (rc != Success0) | |||
| 595 | return rc; | |||
| 596 | ||||
| 597 | return XvdiSelectVideoNotify(client, pDraw, stuff->onoff); | |||
| 598 | } | |||
| 599 | ||||
| 600 | static int | |||
| 601 | ProcXvSelectPortNotify(ClientPtr client) | |||
| 602 | { | |||
| 603 | XvPortPtr pPort; | |||
| 604 | ||||
| 605 | REQUEST(xvSelectPortNotifyReq)xvSelectPortNotifyReq *stuff = (xvSelectPortNotifyReq *)client ->requestBuffer; | |||
| 606 | REQUEST_SIZE_MATCH(xvSelectPortNotifyReq)if ((sizeof(xvSelectPortNotifyReq) >> 2) != client-> req_len) return(16); | |||
| 607 | ||||
| 608 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 609 | ||||
| 610 | return XvdiSelectPortNotify(client, pPort, stuff->onoff); | |||
| 611 | } | |||
| 612 | ||||
| 613 | static int | |||
| 614 | ProcXvGrabPort(ClientPtr client) | |||
| 615 | { | |||
| 616 | int result, status; | |||
| 617 | XvPortPtr pPort; | |||
| 618 | xvGrabPortReply rep; | |||
| 619 | ||||
| 620 | REQUEST(xvGrabPortReq)xvGrabPortReq *stuff = (xvGrabPortReq *)client->requestBuffer; | |||
| 621 | REQUEST_SIZE_MATCH(xvGrabPortReq)if ((sizeof(xvGrabPortReq) >> 2) != client->req_len) return(16); | |||
| 622 | ||||
| 623 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 624 | ||||
| 625 | status = XvdiGrabPort(client, pPort, stuff->time, &result); | |||
| 626 | ||||
| 627 | if (status != Success0) { | |||
| 628 | return status; | |||
| 629 | } | |||
| 630 | rep = (xvGrabPortReply) { | |||
| 631 | .type = X_Reply1, | |||
| 632 | .sequenceNumber = client->sequence, | |||
| 633 | .length = 0, | |||
| 634 | .result = result | |||
| 635 | }; | |||
| 636 | ||||
| 637 | _WriteGrabPortReply(client, &rep)if ((client)->swapped) SWriteGrabPortReply(client, &rep ); else WriteToClient(client, 32, &rep); | |||
| 638 | ||||
| 639 | return Success0; | |||
| 640 | } | |||
| 641 | ||||
| 642 | static int | |||
| 643 | ProcXvUngrabPort(ClientPtr client) | |||
| 644 | { | |||
| 645 | XvPortPtr pPort; | |||
| 646 | ||||
| 647 | REQUEST(xvGrabPortReq)xvGrabPortReq *stuff = (xvGrabPortReq *)client->requestBuffer; | |||
| 648 | REQUEST_SIZE_MATCH(xvGrabPortReq)if ((sizeof(xvGrabPortReq) >> 2) != client->req_len) return(16); | |||
| 649 | ||||
| 650 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 651 | ||||
| 652 | return XvdiUngrabPort(client, pPort, stuff->time); | |||
| 653 | } | |||
| 654 | ||||
| 655 | static int | |||
| 656 | ProcXvStopVideo(ClientPtr client) | |||
| 657 | { | |||
| 658 | int ret; | |||
| 659 | DrawablePtr pDraw; | |||
| 660 | XvPortPtr pPort; | |||
| 661 | ||||
| 662 | REQUEST(xvStopVideoReq)xvStopVideoReq *stuff = (xvStopVideoReq *)client->requestBuffer; | |||
| 663 | REQUEST_SIZE_MATCH(xvStopVideoReq)if ((sizeof(xvStopVideoReq) >> 2) != client->req_len ) return(16); | |||
| 664 | ||||
| 665 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 666 | ||||
| 667 | ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess(1<<1)); | |||
| 668 | if (ret != Success0) | |||
| 669 | return ret; | |||
| 670 | ||||
| 671 | return XvdiStopVideo(client, pPort, pDraw); | |||
| 672 | } | |||
| 673 | ||||
| 674 | static int | |||
| 675 | ProcXvSetPortAttribute(ClientPtr client) | |||
| 676 | { | |||
| 677 | int status; | |||
| 678 | XvPortPtr pPort; | |||
| 679 | ||||
| 680 | REQUEST(xvSetPortAttributeReq)xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)client ->requestBuffer; | |||
| 681 | REQUEST_SIZE_MATCH(xvSetPortAttributeReq)if ((sizeof(xvSetPortAttributeReq) >> 2) != client-> req_len) return(16); | |||
| 682 | ||||
| 683 | VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<5)); if (rc != 0) return rc; }; | |||
| 684 | ||||
| 685 | if (!ValidAtom(stuff->attribute)) { | |||
| 686 | client->errorValue = stuff->attribute; | |||
| 687 | return BadAtom5; | |||
| 688 | } | |||
| 689 | ||||
| 690 | status = | |||
| 691 | XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value); | |||
| 692 | ||||
| 693 | if (status == BadMatch8) | |||
| 694 | client->errorValue = stuff->attribute; | |||
| 695 | else | |||
| 696 | client->errorValue = stuff->value; | |||
| 697 | ||||
| 698 | return status; | |||
| 699 | } | |||
| 700 | ||||
| 701 | static int | |||
| 702 | ProcXvGetPortAttribute(ClientPtr client) | |||
| 703 | { | |||
| 704 | INT32 value; | |||
| 705 | int status; | |||
| 706 | XvPortPtr pPort; | |||
| 707 | xvGetPortAttributeReply rep; | |||
| 708 | ||||
| 709 | REQUEST(xvGetPortAttributeReq)xvGetPortAttributeReq *stuff = (xvGetPortAttributeReq *)client ->requestBuffer; | |||
| 710 | REQUEST_SIZE_MATCH(xvGetPortAttributeReq)if ((sizeof(xvGetPortAttributeReq) >> 2) != client-> req_len) return(16); | |||
| 711 | ||||
| 712 | VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<4)); if (rc != 0) return rc; }; | |||
| 713 | ||||
| 714 | if (!ValidAtom(stuff->attribute)) { | |||
| 715 | client->errorValue = stuff->attribute; | |||
| 716 | return BadAtom5; | |||
| 717 | } | |||
| 718 | ||||
| 719 | status = XvdiGetPortAttribute(client, pPort, stuff->attribute, &value); | |||
| 720 | if (status != Success0) { | |||
| 721 | client->errorValue = stuff->attribute; | |||
| 722 | return status; | |||
| 723 | } | |||
| 724 | ||||
| 725 | rep = (xvGetPortAttributeReply) { | |||
| 726 | .type = X_Reply1, | |||
| 727 | .sequenceNumber = client->sequence, | |||
| 728 | .length = 0, | |||
| 729 | .value = value | |||
| 730 | }; | |||
| 731 | ||||
| 732 | _WriteGetPortAttributeReply(client, &rep)if ((client)->swapped) SWriteGetPortAttributeReply(client, &rep); else WriteToClient(client, 32, &rep); | |||
| 733 | ||||
| 734 | return Success0; | |||
| 735 | } | |||
| 736 | ||||
| 737 | static int | |||
| 738 | ProcXvQueryBestSize(ClientPtr client) | |||
| 739 | { | |||
| 740 | unsigned int actual_width, actual_height; | |||
| 741 | XvPortPtr pPort; | |||
| 742 | xvQueryBestSizeReply rep; | |||
| 743 | ||||
| 744 | REQUEST(xvQueryBestSizeReq)xvQueryBestSizeReq *stuff = (xvQueryBestSizeReq *)client-> requestBuffer; | |||
| 745 | REQUEST_SIZE_MATCH(xvQueryBestSizeReq)if ((sizeof(xvQueryBestSizeReq) >> 2) != client->req_len ) return(16); | |||
| 746 | ||||
| 747 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 748 | ||||
| 749 | (*pPort->pAdaptor->ddQueryBestSize) (pPort, stuff->motion, | |||
| 750 | stuff->vid_w, stuff->vid_h, | |||
| 751 | stuff->drw_w, stuff->drw_h, | |||
| 752 | &actual_width, &actual_height); | |||
| 753 | ||||
| 754 | rep = (xvQueryBestSizeReply) { | |||
| 755 | .type = X_Reply1, | |||
| 756 | .sequenceNumber = client->sequence, | |||
| 757 | .length = 0, | |||
| 758 | .actual_width = actual_width, | |||
| 759 | .actual_height = actual_height | |||
| 760 | }; | |||
| 761 | ||||
| 762 | _WriteQueryBestSizeReply(client, &rep)if ((client)->swapped) SWriteQueryBestSizeReply(client, & rep); else WriteToClient(client, 32, &rep); | |||
| 763 | ||||
| 764 | return Success0; | |||
| 765 | } | |||
| 766 | ||||
| 767 | static int | |||
| 768 | ProcXvQueryPortAttributes(ClientPtr client) | |||
| 769 | { | |||
| 770 | int size, i; | |||
| 771 | XvPortPtr pPort; | |||
| 772 | XvAttributePtr pAtt; | |||
| 773 | xvQueryPortAttributesReply rep; | |||
| 774 | xvAttributeInfo Info; | |||
| 775 | ||||
| 776 | REQUEST(xvQueryPortAttributesReq)xvQueryPortAttributesReq *stuff = (xvQueryPortAttributesReq * )client->requestBuffer; | |||
| 777 | REQUEST_SIZE_MATCH(xvQueryPortAttributesReq)if ((sizeof(xvQueryPortAttributesReq) >> 2) != client-> req_len) return(16); | |||
| 778 | ||||
| 779 | VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<4)); if (rc != 0) return rc; }; | |||
| 780 | ||||
| 781 | rep = (xvQueryPortAttributesReply) { | |||
| 782 | .type = X_Reply1, | |||
| 783 | .sequenceNumber = client->sequence, | |||
| 784 | .num_attributes = pPort->pAdaptor->nAttributes, | |||
| 785 | .text_size = 0 | |||
| 786 | }; | |||
| 787 | ||||
| 788 | for (i = 0, pAtt = pPort->pAdaptor->pAttributes; | |||
| 789 | i < pPort->pAdaptor->nAttributes; i++, pAtt++) { | |||
| 790 | rep.text_size += pad_to_int32(strlen(pAtt->name) + 1); | |||
| 791 | } | |||
| 792 | ||||
| 793 | rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo16) | |||
| 794 | + rep.text_size; | |||
| 795 | rep.length >>= 2; | |||
| 796 | ||||
| 797 | _WriteQueryPortAttributesReply(client, &rep)if ((client)->swapped) SWriteQueryPortAttributesReply(client , &rep); else WriteToClient(client, 32, &rep); | |||
| 798 | ||||
| 799 | for (i = 0, pAtt = pPort->pAdaptor->pAttributes; | |||
| 800 | i < pPort->pAdaptor->nAttributes; i++, pAtt++) { | |||
| 801 | size = strlen(pAtt->name) + 1; /* pass the NULL */ | |||
| 802 | Info.flags = pAtt->flags; | |||
| 803 | Info.min = pAtt->min_value; | |||
| 804 | Info.max = pAtt->max_value; | |||
| 805 | Info.size = pad_to_int32(size); | |||
| 806 | ||||
| 807 | _WriteAttributeInfo(client, &Info)if ((client)->swapped) SWriteAttributeInfo(client, &Info ); else WriteToClient(client, 16, &Info); | |||
| 808 | ||||
| 809 | WriteToClient(client, size, pAtt->name); | |||
| 810 | } | |||
| 811 | ||||
| 812 | return Success0; | |||
| 813 | } | |||
| 814 | ||||
| 815 | static int | |||
| 816 | ProcXvPutImage(ClientPtr client) | |||
| 817 | { | |||
| 818 | DrawablePtr pDraw; | |||
| 819 | XvPortPtr pPort; | |||
| 820 | XvImagePtr pImage = NULL((void*)0); | |||
| 821 | GCPtr pGC; | |||
| 822 | int status, i, size; | |||
| 823 | CARD16 width, height; | |||
| 824 | ||||
| 825 | REQUEST(xvPutImageReq)xvPutImageReq *stuff = (xvPutImageReq *)client->requestBuffer; | |||
| 826 | REQUEST_AT_LEAST_SIZE(xvPutImageReq)if ((sizeof(xvPutImageReq) >> 2) > client->req_len ) return(16); | |||
| 827 | ||||
| 828 | VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess){ int tmprc = dixLookupDrawable(&(pDraw), stuff->drawable , client, (-1), (1<<1)); if (tmprc != 0) return tmprc; tmprc = dixLookupGC(&(pGC), stuff->gc, client, (1<<24 )); if (tmprc != 0) return tmprc; if ((pGC->depth != pDraw ->depth) || (pGC->pScreen != pDraw->pScreen)) return 8; } if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC);; | |||
| 829 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 830 | ||||
| 831 | if (!(pPort->pAdaptor->type & XvImageMask0x00000010) || | |||
| 832 | !(pPort->pAdaptor->type & XvInputMask(1<<0))) { | |||
| 833 | client->errorValue = stuff->port; | |||
| 834 | return BadMatch8; | |||
| 835 | } | |||
| 836 | ||||
| 837 | status = XvdiMatchPort(pPort, pDraw); | |||
| 838 | if (status != Success0) { | |||
| 839 | return status; | |||
| 840 | } | |||
| 841 | ||||
| 842 | for (i = 0; i < pPort->pAdaptor->nImages; i++) { | |||
| 843 | if (pPort->pAdaptor->pImages[i].id == stuff->id) { | |||
| 844 | pImage = &(pPort->pAdaptor->pImages[i]); | |||
| 845 | break; | |||
| 846 | } | |||
| 847 | } | |||
| 848 | ||||
| 849 | if (!pImage) | |||
| 850 | return BadMatch8; | |||
| 851 | ||||
| 852 | width = stuff->width; | |||
| 853 | height = stuff->height; | |||
| 854 | size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width, | |||
| 855 | &height, NULL((void*)0), NULL((void*)0)); | |||
| 856 | size += sizeof(xvPutImageReq); | |||
| 857 | size = bytes_to_int32(size); | |||
| 858 | ||||
| 859 | if ((width < stuff->width) || (height < stuff->height)) | |||
| 860 | return BadValue2; | |||
| 861 | ||||
| 862 | if (client->req_len < size) | |||
| 863 | return BadLength16; | |||
| 864 | ||||
| 865 | return XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y, | |||
| 866 | stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y, | |||
| 867 | stuff->drw_w, stuff->drw_h, pImage, | |||
| 868 | (unsigned char *) (&stuff[1]), FALSE0, | |||
| 869 | stuff->width, stuff->height); | |||
| 870 | } | |||
| 871 | ||||
| 872 | #ifdef MITSHM1 | |||
| 873 | ||||
| 874 | static int | |||
| 875 | ProcXvShmPutImage(ClientPtr client) | |||
| 876 | { | |||
| 877 | ShmDescPtr shmdesc; | |||
| 878 | DrawablePtr pDraw; | |||
| 879 | XvPortPtr pPort; | |||
| 880 | XvImagePtr pImage = NULL((void*)0); | |||
| 881 | GCPtr pGC; | |||
| 882 | int status, size_needed, i; | |||
| 883 | CARD16 width, height; | |||
| 884 | ||||
| 885 | REQUEST(xvShmPutImageReq)xvShmPutImageReq *stuff = (xvShmPutImageReq *)client->requestBuffer; | |||
| 886 | REQUEST_SIZE_MATCH(xvShmPutImageReq)if ((sizeof(xvShmPutImageReq) >> 2) != client->req_len ) return(16); | |||
| 887 | ||||
| 888 | VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess){ int tmprc = dixLookupDrawable(&(pDraw), stuff->drawable , client, (-1), (1<<1)); if (tmprc != 0) return tmprc; tmprc = dixLookupGC(&(pGC), stuff->gc, client, (1<<24 )); if (tmprc != 0) return tmprc; if ((pGC->depth != pDraw ->depth) || (pGC->pScreen != pDraw->pScreen)) return 8; } if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC);; | |||
| 889 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 890 | ||||
| 891 | if (!(pPort->pAdaptor->type & XvImageMask0x00000010) || | |||
| 892 | !(pPort->pAdaptor->type & XvInputMask(1<<0))) { | |||
| 893 | client->errorValue = stuff->port; | |||
| 894 | return BadMatch8; | |||
| 895 | } | |||
| 896 | ||||
| 897 | status = XvdiMatchPort(pPort, pDraw); | |||
| 898 | if (status != Success0) { | |||
| 899 | return status; | |||
| 900 | } | |||
| 901 | ||||
| 902 | for (i = 0; i < pPort->pAdaptor->nImages; i++) { | |||
| 903 | if (pPort->pAdaptor->pImages[i].id == stuff->id) { | |||
| 904 | pImage = &(pPort->pAdaptor->pImages[i]); | |||
| 905 | break; | |||
| 906 | } | |||
| 907 | } | |||
| 908 | ||||
| 909 | if (!pImage) | |||
| 910 | return BadMatch8; | |||
| 911 | ||||
| 912 | status = dixLookupResourceByType((void **) &shmdesc, stuff->shmseg, | |||
| 913 | ShmSegType, serverClient, DixReadAccess(1<<0)); | |||
| 914 | if (status != Success0) | |||
| 915 | return status; | |||
| 916 | ||||
| 917 | width = stuff->width; | |||
| 918 | height = stuff->height; | |||
| 919 | size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, | |||
| 920 | &width, &height, | |||
| 921 | NULL((void*)0), NULL((void*)0)); | |||
| 922 | if ((size_needed + stuff->offset) > shmdesc->size) | |||
| 923 | return BadAccess10; | |||
| 924 | ||||
| 925 | if ((width < stuff->width) || (height < stuff->height)) | |||
| 926 | return BadValue2; | |||
| 927 | ||||
| 928 | status = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y, | |||
| 929 | stuff->src_w, stuff->src_h, stuff->drw_x, | |||
| 930 | stuff->drw_y, stuff->drw_w, stuff->drw_h, pImage, | |||
| 931 | (unsigned char *) shmdesc->addr + stuff->offset, | |||
| 932 | stuff->send_event, stuff->width, stuff->height); | |||
| 933 | ||||
| 934 | if ((status == Success0) && stuff->send_event) { | |||
| 935 | xShmCompletionEvent ev = { | |||
| 936 | .type = ShmCompletionCode, | |||
| 937 | .drawable = stuff->drawable, | |||
| 938 | .minorEvent = xv_ShmPutImage19, | |||
| 939 | .majorEvent = XvReqCode, | |||
| 940 | .shmseg = stuff->shmseg, | |||
| 941 | .offset = stuff->offset | |||
| 942 | }; | |||
| 943 | WriteEventsToClient(client, 1, (xEvent *) &ev); | |||
| 944 | } | |||
| 945 | ||||
| 946 | return status; | |||
| 947 | } | |||
| 948 | #else /* !MITSHM */ | |||
| 949 | static int | |||
| 950 | ProcXvShmPutImage(ClientPtr client) | |||
| 951 | { | |||
| 952 | SendErrorToClient(client, XvReqCode, xv_ShmPutImage19, 0, BadImplementation17); | |||
| 953 | return BadImplementation17; | |||
| 954 | } | |||
| 955 | #endif | |||
| 956 | ||||
| 957 | #ifdef XvMCExtension1 | |||
| 958 | #include "xvmcext.h" | |||
| 959 | #endif | |||
| 960 | ||||
| 961 | static int | |||
| 962 | ProcXvQueryImageAttributes(ClientPtr client) | |||
| 963 | { | |||
| 964 | xvQueryImageAttributesReply rep; | |||
| 965 | int size, num_planes, i; | |||
| 966 | CARD16 width, height; | |||
| 967 | XvImagePtr pImage = NULL((void*)0); | |||
| 968 | XvPortPtr pPort; | |||
| 969 | int *offsets; | |||
| 970 | int *pitches; | |||
| 971 | int planeLength; | |||
| 972 | ||||
| 973 | REQUEST(xvQueryImageAttributesReq)xvQueryImageAttributesReq *stuff = (xvQueryImageAttributesReq *)client->requestBuffer; | |||
| 974 | ||||
| 975 | REQUEST_SIZE_MATCH(xvQueryImageAttributesReq)if ((sizeof(xvQueryImageAttributesReq) >> 2) != client-> req_len) return(16); | |||
| 976 | ||||
| 977 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 978 | ||||
| 979 | for (i = 0; i < pPort->pAdaptor->nImages; i++) { | |||
| 980 | if (pPort->pAdaptor->pImages[i].id == stuff->id) { | |||
| 981 | pImage = &(pPort->pAdaptor->pImages[i]); | |||
| 982 | break; | |||
| 983 | } | |||
| 984 | } | |||
| 985 | ||||
| 986 | #ifdef XvMCExtension1 | |||
| 987 | if (!pImage) | |||
| 988 | pImage = XvMCFindXvImage(pPort, stuff->id); | |||
| 989 | #endif | |||
| 990 | ||||
| 991 | if (!pImage) | |||
| 992 | return BadMatch8; | |||
| 993 | ||||
| 994 | num_planes = pImage->num_planes; | |||
| 995 | ||||
| 996 | if (!(offsets = malloc(num_planes << 3))) | |||
| 997 | return BadAlloc11; | |||
| 998 | pitches = offsets + num_planes; | |||
| 999 | ||||
| 1000 | width = stuff->width; | |||
| 1001 | height = stuff->height; | |||
| 1002 | ||||
| 1003 | size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, | |||
| 1004 | &width, &height, offsets, | |||
| 1005 | pitches); | |||
| 1006 | ||||
| 1007 | rep = (xvQueryImageAttributesReply) { | |||
| 1008 | .type = X_Reply1, | |||
| 1009 | .sequenceNumber = client->sequence, | |||
| 1010 | .length = planeLength = num_planes << 1, | |||
| 1011 | .num_planes = num_planes, | |||
| 1012 | .width = width, | |||
| 1013 | .height = height, | |||
| 1014 | .data_size = size | |||
| 1015 | }; | |||
| 1016 | ||||
| 1017 | _WriteQueryImageAttributesReply(client, &rep)if ((client)->swapped) SWriteQueryImageAttributesReply(client , &rep); else WriteToClient(client, 32, &rep); | |||
| 1018 | if (client->swapped) | |||
| 1019 | SwapLongs((CARD32 *) offsets, planeLength); | |||
| 1020 | WriteToClient(client, planeLength << 2, offsets); | |||
| 1021 | ||||
| 1022 | free(offsets); | |||
| 1023 | ||||
| 1024 | return Success0; | |||
| 1025 | } | |||
| 1026 | ||||
| 1027 | static int | |||
| 1028 | ProcXvListImageFormats(ClientPtr client) | |||
| 1029 | { | |||
| 1030 | XvPortPtr pPort; | |||
| 1031 | XvImagePtr pImage; | |||
| 1032 | int i; | |||
| 1033 | xvListImageFormatsReply rep; | |||
| 1034 | xvImageFormatInfo info; | |||
| 1035 | ||||
| 1036 | REQUEST(xvListImageFormatsReq)xvListImageFormatsReq *stuff = (xvListImageFormatsReq *)client ->requestBuffer; | |||
| 1037 | ||||
| 1038 | REQUEST_SIZE_MATCH(xvListImageFormatsReq)if ((sizeof(xvListImageFormatsReq) >> 2) != client-> req_len) return(16); | |||
| 1039 | ||||
| 1040 | VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(pPort), stuff ->port, XvRTPort, client, (1<<0)); if (rc != 0) return rc; }; | |||
| 1041 | ||||
| 1042 | rep = (xvListImageFormatsReply) { | |||
| 1043 | .type = X_Reply1, | |||
| 1044 | .sequenceNumber = client->sequence, | |||
| 1045 | .num_formats = pPort->pAdaptor->nImages, | |||
| 1046 | .length = | |||
| 1047 | bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo128) | |||
| 1048 | }; | |||
| 1049 | ||||
| 1050 | _WriteListImageFormatsReply(client, &rep)if ((client)->swapped) SWriteListImageFormatsReply(client, &rep); else WriteToClient(client, 32, &rep); | |||
| 1051 | ||||
| 1052 | pImage = pPort->pAdaptor->pImages; | |||
| 1053 | ||||
| 1054 | for (i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) { | |||
| 1055 | info.id = pImage->id; | |||
| 1056 | info.type = pImage->type; | |||
| 1057 | info.byte_order = pImage->byte_order; | |||
| 1058 | memcpy(&info.guid, pImage->guid, 16)__builtin___memcpy_chk (&info.guid, pImage->guid, 16, __builtin_object_size (&info.guid, 0)); | |||
| 1059 | info.bpp = pImage->bits_per_pixel; | |||
| 1060 | info.num_planes = pImage->num_planes; | |||
| 1061 | info.depth = pImage->depth; | |||
| 1062 | info.red_mask = pImage->red_mask; | |||
| 1063 | info.green_mask = pImage->green_mask; | |||
| 1064 | info.blue_mask = pImage->blue_mask; | |||
| 1065 | info.format = pImage->format; | |||
| 1066 | info.y_sample_bits = pImage->y_sample_bits; | |||
| 1067 | info.u_sample_bits = pImage->u_sample_bits; | |||
| 1068 | info.v_sample_bits = pImage->v_sample_bits; | |||
| 1069 | info.horz_y_period = pImage->horz_y_period; | |||
| 1070 | info.horz_u_period = pImage->horz_u_period; | |||
| 1071 | info.horz_v_period = pImage->horz_v_period; | |||
| 1072 | info.vert_y_period = pImage->vert_y_period; | |||
| 1073 | info.vert_u_period = pImage->vert_u_period; | |||
| 1074 | info.vert_v_period = pImage->vert_v_period; | |||
| 1075 | memcpy(&info.comp_order, pImage->component_order, 32)__builtin___memcpy_chk (&info.comp_order, pImage->component_order , 32, __builtin_object_size (&info.comp_order, 0)); | |||
| 1076 | info.scanline_order = pImage->scanline_order; | |||
| 1077 | _WriteImageFormatInfo(client, &info)if ((client)->swapped) SWriteImageFormatInfo(client, & info); else WriteToClient(client, 128, &info); | |||
| 1078 | } | |||
| 1079 | ||||
| 1080 | return Success0; | |||
| 1081 | } | |||
| 1082 | ||||
| 1083 | static int (*XvProcVector[xvNumRequests(19 + 1)]) (ClientPtr) = { | |||
| 1084 | ProcXvQueryExtension, | |||
| 1085 | ProcXvQueryAdaptors, | |||
| 1086 | ProcXvQueryEncodings, | |||
| 1087 | ProcXvGrabPort, | |||
| 1088 | ProcXvUngrabPort, | |||
| 1089 | ProcXvPutVideo, | |||
| 1090 | ProcXvPutStill, | |||
| 1091 | ProcXvGetVideo, | |||
| 1092 | ProcXvGetStill, | |||
| 1093 | ProcXvStopVideo, | |||
| 1094 | ProcXvSelectVideoNotify, | |||
| 1095 | ProcXvSelectPortNotify, | |||
| 1096 | ProcXvQueryBestSize, | |||
| 1097 | ProcXvSetPortAttribute, | |||
| 1098 | ProcXvGetPortAttribute, | |||
| 1099 | ProcXvQueryPortAttributes, | |||
| 1100 | ProcXvListImageFormats, | |||
| 1101 | ProcXvQueryImageAttributes, ProcXvPutImage, ProcXvShmPutImage,}; | |||
| 1102 | ||||
| 1103 | int | |||
| 1104 | ProcXvDispatch(ClientPtr client) | |||
| 1105 | { | |||
| 1106 | REQUEST(xReq)xReq *stuff = (xReq *)client->requestBuffer; | |||
| 1107 | ||||
| 1108 | UpdateCurrentTime(); | |||
| 1109 | ||||
| 1110 | if (stuff->data >= xvNumRequests(19 + 1)) { | |||
| 1111 | SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest1); | |||
| 1112 | return BadRequest1; | |||
| 1113 | } | |||
| 1114 | ||||
| 1115 | return XvProcVector[stuff->data] (client); | |||
| 1116 | } | |||
| 1117 | ||||
| 1118 | /* Swapped Procs */ | |||
| 1119 | ||||
| 1120 | static int | |||
| 1121 | SProcXvQueryExtension(ClientPtr client) | |||
| 1122 | { | |||
| 1123 | REQUEST(xvQueryExtensionReq)xvQueryExtensionReq *stuff = (xvQueryExtensionReq *)client-> requestBuffer; | |||
| 1124 | REQUEST_SIZE_MATCH(xvQueryExtensionReq)if ((sizeof(xvQueryExtensionReq) >> 2) != client->req_len ) return(16); | |||
| 1125 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1126 | return XvProcVector[xv_QueryExtension0] (client); | |||
| 1127 | } | |||
| 1128 | ||||
| 1129 | static int | |||
| 1130 | SProcXvQueryAdaptors(ClientPtr client) | |||
| 1131 | { | |||
| 1132 | REQUEST(xvQueryAdaptorsReq)xvQueryAdaptorsReq *stuff = (xvQueryAdaptorsReq *)client-> requestBuffer; | |||
| 1133 | REQUEST_SIZE_MATCH(xvQueryAdaptorsReq)if ((sizeof(xvQueryAdaptorsReq) >> 2) != client->req_len ) return(16); | |||
| 1134 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1135 | swapl(&stuff->window)do { if (sizeof(*(&stuff->window)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->window) & 3) && ((uintptr_t)(&stuff->window) & 3) == 0) *(&stuff->window) = lswapl(*(&stuff->window )); else swap_uint32((uint32_t *)(&stuff->window)); } while (0); | |||
| 1136 | return XvProcVector[xv_QueryAdaptors1] (client); | |||
| 1137 | } | |||
| 1138 | ||||
| 1139 | static int | |||
| 1140 | SProcXvQueryEncodings(ClientPtr client) | |||
| 1141 | { | |||
| 1142 | REQUEST(xvQueryEncodingsReq)xvQueryEncodingsReq *stuff = (xvQueryEncodingsReq *)client-> requestBuffer; | |||
| 1143 | REQUEST_SIZE_MATCH(xvQueryEncodingsReq)if ((sizeof(xvQueryEncodingsReq) >> 2) != client->req_len ) return(16); | |||
| 1144 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1145 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1146 | return XvProcVector[xv_QueryEncodings2] (client); | |||
| 1147 | } | |||
| 1148 | ||||
| 1149 | static int | |||
| 1150 | SProcXvGrabPort(ClientPtr client) | |||
| 1151 | { | |||
| 1152 | REQUEST(xvGrabPortReq)xvGrabPortReq *stuff = (xvGrabPortReq *)client->requestBuffer; | |||
| 1153 | REQUEST_SIZE_MATCH(xvGrabPortReq)if ((sizeof(xvGrabPortReq) >> 2) != client->req_len) return(16); | |||
| 1154 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1155 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1156 | swapl(&stuff->time)do { if (sizeof(*(&stuff->time)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->time) & 3) && ((uintptr_t)(&stuff->time) & 3) == 0 ) *(&stuff->time) = lswapl(*(&stuff->time)); else swap_uint32((uint32_t *)(&stuff->time)); } while (0); | |||
| 1157 | return XvProcVector[xv_GrabPort3] (client); | |||
| 1158 | } | |||
| 1159 | ||||
| 1160 | static int | |||
| 1161 | SProcXvUngrabPort(ClientPtr client) | |||
| 1162 | { | |||
| 1163 | REQUEST(xvUngrabPortReq)xvUngrabPortReq *stuff = (xvUngrabPortReq *)client->requestBuffer; | |||
| 1164 | REQUEST_SIZE_MATCH(xvUngrabPortReq)if ((sizeof(xvUngrabPortReq) >> 2) != client->req_len ) return(16); | |||
| 1165 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1166 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1167 | swapl(&stuff->time)do { if (sizeof(*(&stuff->time)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->time) & 3) && ((uintptr_t)(&stuff->time) & 3) == 0 ) *(&stuff->time) = lswapl(*(&stuff->time)); else swap_uint32((uint32_t *)(&stuff->time)); } while (0); | |||
| 1168 | return XvProcVector[xv_UngrabPort4] (client); | |||
| 1169 | } | |||
| 1170 | ||||
| 1171 | static int | |||
| 1172 | SProcXvPutVideo(ClientPtr client) | |||
| 1173 | { | |||
| 1174 | REQUEST(xvPutVideoReq)xvPutVideoReq *stuff = (xvPutVideoReq *)client->requestBuffer; | |||
| 1175 | REQUEST_SIZE_MATCH(xvPutVideoReq)if ((sizeof(xvPutVideoReq) >> 2) != client->req_len) return(16); | |||
| 1176 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1177 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1178 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1179 | swapl(&stuff->gc)do { if (sizeof(*(&stuff->gc)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->gc) & 3) && ((uintptr_t)(&stuff->gc) & 3) == 0) *(&stuff-> gc) = lswapl(*(&stuff->gc)); else swap_uint32((uint32_t *)(&stuff->gc)); } while (0); | |||
| 1180 | swaps(&stuff->vid_x)do { if (sizeof(*(&stuff->vid_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_x) & 1) && ((uintptr_t)(&stuff->vid_x) & 1) == 0) *(&stuff->vid_x) = lswaps(*(&stuff->vid_x)) ; else swap_uint16((uint16_t *)(&stuff->vid_x)); } while (0); | |||
| 1181 | swaps(&stuff->vid_y)do { if (sizeof(*(&stuff->vid_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_y) & 1) && ((uintptr_t)(&stuff->vid_y) & 1) == 0) *(&stuff->vid_y) = lswaps(*(&stuff->vid_y)) ; else swap_uint16((uint16_t *)(&stuff->vid_y)); } while (0); | |||
| 1182 | swaps(&stuff->vid_w)do { if (sizeof(*(&stuff->vid_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_w) & 1) && ((uintptr_t)(&stuff->vid_w) & 1) == 0) *(&stuff->vid_w) = lswaps(*(&stuff->vid_w)) ; else swap_uint16((uint16_t *)(&stuff->vid_w)); } while (0); | |||
| 1183 | swaps(&stuff->vid_h)do { if (sizeof(*(&stuff->vid_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_h) & 1) && ((uintptr_t)(&stuff->vid_h) & 1) == 0) *(&stuff->vid_h) = lswaps(*(&stuff->vid_h)) ; else swap_uint16((uint16_t *)(&stuff->vid_h)); } while (0); | |||
| 1184 | swaps(&stuff->drw_x)do { if (sizeof(*(&stuff->drw_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_x) & 1) && ((uintptr_t)(&stuff->drw_x) & 1) == 0) *(&stuff->drw_x) = lswaps(*(&stuff->drw_x)) ; else swap_uint16((uint16_t *)(&stuff->drw_x)); } while (0); | |||
| 1185 | swaps(&stuff->drw_y)do { if (sizeof(*(&stuff->drw_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_y) & 1) && ((uintptr_t)(&stuff->drw_y) & 1) == 0) *(&stuff->drw_y) = lswaps(*(&stuff->drw_y)) ; else swap_uint16((uint16_t *)(&stuff->drw_y)); } while (0); | |||
| 1186 | swaps(&stuff->drw_w)do { if (sizeof(*(&stuff->drw_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_w) & 1) && ((uintptr_t)(&stuff->drw_w) & 1) == 0) *(&stuff->drw_w) = lswaps(*(&stuff->drw_w)) ; else swap_uint16((uint16_t *)(&stuff->drw_w)); } while (0); | |||
| 1187 | swaps(&stuff->drw_h)do { if (sizeof(*(&stuff->drw_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_h) & 1) && ((uintptr_t)(&stuff->drw_h) & 1) == 0) *(&stuff->drw_h) = lswaps(*(&stuff->drw_h)) ; else swap_uint16((uint16_t *)(&stuff->drw_h)); } while (0); | |||
| 1188 | return XvProcVector[xv_PutVideo5] (client); | |||
| 1189 | } | |||
| 1190 | ||||
| 1191 | static int | |||
| 1192 | SProcXvPutStill(ClientPtr client) | |||
| 1193 | { | |||
| 1194 | REQUEST(xvPutStillReq)xvPutStillReq *stuff = (xvPutStillReq *)client->requestBuffer; | |||
| 1195 | REQUEST_SIZE_MATCH(xvPutStillReq)if ((sizeof(xvPutStillReq) >> 2) != client->req_len) return(16); | |||
| 1196 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1197 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1198 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1199 | swapl(&stuff->gc)do { if (sizeof(*(&stuff->gc)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->gc) & 3) && ((uintptr_t)(&stuff->gc) & 3) == 0) *(&stuff-> gc) = lswapl(*(&stuff->gc)); else swap_uint32((uint32_t *)(&stuff->gc)); } while (0); | |||
| 1200 | swaps(&stuff->vid_x)do { if (sizeof(*(&stuff->vid_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_x) & 1) && ((uintptr_t)(&stuff->vid_x) & 1) == 0) *(&stuff->vid_x) = lswaps(*(&stuff->vid_x)) ; else swap_uint16((uint16_t *)(&stuff->vid_x)); } while (0); | |||
| 1201 | swaps(&stuff->vid_y)do { if (sizeof(*(&stuff->vid_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_y) & 1) && ((uintptr_t)(&stuff->vid_y) & 1) == 0) *(&stuff->vid_y) = lswaps(*(&stuff->vid_y)) ; else swap_uint16((uint16_t *)(&stuff->vid_y)); } while (0); | |||
| 1202 | swaps(&stuff->vid_w)do { if (sizeof(*(&stuff->vid_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_w) & 1) && ((uintptr_t)(&stuff->vid_w) & 1) == 0) *(&stuff->vid_w) = lswaps(*(&stuff->vid_w)) ; else swap_uint16((uint16_t *)(&stuff->vid_w)); } while (0); | |||
| 1203 | swaps(&stuff->vid_h)do { if (sizeof(*(&stuff->vid_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_h) & 1) && ((uintptr_t)(&stuff->vid_h) & 1) == 0) *(&stuff->vid_h) = lswaps(*(&stuff->vid_h)) ; else swap_uint16((uint16_t *)(&stuff->vid_h)); } while (0); | |||
| 1204 | swaps(&stuff->drw_x)do { if (sizeof(*(&stuff->drw_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_x) & 1) && ((uintptr_t)(&stuff->drw_x) & 1) == 0) *(&stuff->drw_x) = lswaps(*(&stuff->drw_x)) ; else swap_uint16((uint16_t *)(&stuff->drw_x)); } while (0); | |||
| 1205 | swaps(&stuff->drw_y)do { if (sizeof(*(&stuff->drw_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_y) & 1) && ((uintptr_t)(&stuff->drw_y) & 1) == 0) *(&stuff->drw_y) = lswaps(*(&stuff->drw_y)) ; else swap_uint16((uint16_t *)(&stuff->drw_y)); } while (0); | |||
| 1206 | swaps(&stuff->drw_w)do { if (sizeof(*(&stuff->drw_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_w) & 1) && ((uintptr_t)(&stuff->drw_w) & 1) == 0) *(&stuff->drw_w) = lswaps(*(&stuff->drw_w)) ; else swap_uint16((uint16_t *)(&stuff->drw_w)); } while (0); | |||
| 1207 | swaps(&stuff->drw_h)do { if (sizeof(*(&stuff->drw_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_h) & 1) && ((uintptr_t)(&stuff->drw_h) & 1) == 0) *(&stuff->drw_h) = lswaps(*(&stuff->drw_h)) ; else swap_uint16((uint16_t *)(&stuff->drw_h)); } while (0); | |||
| 1208 | return XvProcVector[xv_PutStill6] (client); | |||
| 1209 | } | |||
| 1210 | ||||
| 1211 | static int | |||
| 1212 | SProcXvGetVideo(ClientPtr client) | |||
| 1213 | { | |||
| 1214 | REQUEST(xvGetVideoReq)xvGetVideoReq *stuff = (xvGetVideoReq *)client->requestBuffer; | |||
| 1215 | REQUEST_SIZE_MATCH(xvGetVideoReq)if ((sizeof(xvGetVideoReq) >> 2) != client->req_len) return(16); | |||
| 1216 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1217 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1218 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1219 | swapl(&stuff->gc)do { if (sizeof(*(&stuff->gc)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->gc) & 3) && ((uintptr_t)(&stuff->gc) & 3) == 0) *(&stuff-> gc) = lswapl(*(&stuff->gc)); else swap_uint32((uint32_t *)(&stuff->gc)); } while (0); | |||
| 1220 | swaps(&stuff->vid_x)do { if (sizeof(*(&stuff->vid_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_x) & 1) && ((uintptr_t)(&stuff->vid_x) & 1) == 0) *(&stuff->vid_x) = lswaps(*(&stuff->vid_x)) ; else swap_uint16((uint16_t *)(&stuff->vid_x)); } while (0); | |||
| 1221 | swaps(&stuff->vid_y)do { if (sizeof(*(&stuff->vid_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_y) & 1) && ((uintptr_t)(&stuff->vid_y) & 1) == 0) *(&stuff->vid_y) = lswaps(*(&stuff->vid_y)) ; else swap_uint16((uint16_t *)(&stuff->vid_y)); } while (0); | |||
| 1222 | swaps(&stuff->vid_w)do { if (sizeof(*(&stuff->vid_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_w) & 1) && ((uintptr_t)(&stuff->vid_w) & 1) == 0) *(&stuff->vid_w) = lswaps(*(&stuff->vid_w)) ; else swap_uint16((uint16_t *)(&stuff->vid_w)); } while (0); | |||
| 1223 | swaps(&stuff->vid_h)do { if (sizeof(*(&stuff->vid_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_h) & 1) && ((uintptr_t)(&stuff->vid_h) & 1) == 0) *(&stuff->vid_h) = lswaps(*(&stuff->vid_h)) ; else swap_uint16((uint16_t *)(&stuff->vid_h)); } while (0); | |||
| 1224 | swaps(&stuff->drw_x)do { if (sizeof(*(&stuff->drw_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_x) & 1) && ((uintptr_t)(&stuff->drw_x) & 1) == 0) *(&stuff->drw_x) = lswaps(*(&stuff->drw_x)) ; else swap_uint16((uint16_t *)(&stuff->drw_x)); } while (0); | |||
| 1225 | swaps(&stuff->drw_y)do { if (sizeof(*(&stuff->drw_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_y) & 1) && ((uintptr_t)(&stuff->drw_y) & 1) == 0) *(&stuff->drw_y) = lswaps(*(&stuff->drw_y)) ; else swap_uint16((uint16_t *)(&stuff->drw_y)); } while (0); | |||
| 1226 | swaps(&stuff->drw_w)do { if (sizeof(*(&stuff->drw_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_w) & 1) && ((uintptr_t)(&stuff->drw_w) & 1) == 0) *(&stuff->drw_w) = lswaps(*(&stuff->drw_w)) ; else swap_uint16((uint16_t *)(&stuff->drw_w)); } while (0); | |||
| 1227 | swaps(&stuff->drw_h)do { if (sizeof(*(&stuff->drw_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_h) & 1) && ((uintptr_t)(&stuff->drw_h) & 1) == 0) *(&stuff->drw_h) = lswaps(*(&stuff->drw_h)) ; else swap_uint16((uint16_t *)(&stuff->drw_h)); } while (0); | |||
| 1228 | return XvProcVector[xv_GetVideo7] (client); | |||
| 1229 | } | |||
| 1230 | ||||
| 1231 | static int | |||
| 1232 | SProcXvGetStill(ClientPtr client) | |||
| 1233 | { | |||
| 1234 | REQUEST(xvGetStillReq)xvGetStillReq *stuff = (xvGetStillReq *)client->requestBuffer; | |||
| 1235 | REQUEST_SIZE_MATCH(xvGetStillReq)if ((sizeof(xvGetStillReq) >> 2) != client->req_len) return(16); | |||
| 1236 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1237 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1238 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1239 | swapl(&stuff->gc)do { if (sizeof(*(&stuff->gc)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->gc) & 3) && ((uintptr_t)(&stuff->gc) & 3) == 0) *(&stuff-> gc) = lswapl(*(&stuff->gc)); else swap_uint32((uint32_t *)(&stuff->gc)); } while (0); | |||
| 1240 | swaps(&stuff->vid_x)do { if (sizeof(*(&stuff->vid_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_x) & 1) && ((uintptr_t)(&stuff->vid_x) & 1) == 0) *(&stuff->vid_x) = lswaps(*(&stuff->vid_x)) ; else swap_uint16((uint16_t *)(&stuff->vid_x)); } while (0); | |||
| 1241 | swaps(&stuff->vid_y)do { if (sizeof(*(&stuff->vid_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_y) & 1) && ((uintptr_t)(&stuff->vid_y) & 1) == 0) *(&stuff->vid_y) = lswaps(*(&stuff->vid_y)) ; else swap_uint16((uint16_t *)(&stuff->vid_y)); } while (0); | |||
| 1242 | swaps(&stuff->vid_w)do { if (sizeof(*(&stuff->vid_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_w) & 1) && ((uintptr_t)(&stuff->vid_w) & 1) == 0) *(&stuff->vid_w) = lswaps(*(&stuff->vid_w)) ; else swap_uint16((uint16_t *)(&stuff->vid_w)); } while (0); | |||
| 1243 | swaps(&stuff->vid_h)do { if (sizeof(*(&stuff->vid_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_h) & 1) && ((uintptr_t)(&stuff->vid_h) & 1) == 0) *(&stuff->vid_h) = lswaps(*(&stuff->vid_h)) ; else swap_uint16((uint16_t *)(&stuff->vid_h)); } while (0); | |||
| 1244 | swaps(&stuff->drw_x)do { if (sizeof(*(&stuff->drw_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_x) & 1) && ((uintptr_t)(&stuff->drw_x) & 1) == 0) *(&stuff->drw_x) = lswaps(*(&stuff->drw_x)) ; else swap_uint16((uint16_t *)(&stuff->drw_x)); } while (0); | |||
| 1245 | swaps(&stuff->drw_y)do { if (sizeof(*(&stuff->drw_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_y) & 1) && ((uintptr_t)(&stuff->drw_y) & 1) == 0) *(&stuff->drw_y) = lswaps(*(&stuff->drw_y)) ; else swap_uint16((uint16_t *)(&stuff->drw_y)); } while (0); | |||
| 1246 | swaps(&stuff->drw_w)do { if (sizeof(*(&stuff->drw_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_w) & 1) && ((uintptr_t)(&stuff->drw_w) & 1) == 0) *(&stuff->drw_w) = lswaps(*(&stuff->drw_w)) ; else swap_uint16((uint16_t *)(&stuff->drw_w)); } while (0); | |||
| 1247 | swaps(&stuff->drw_h)do { if (sizeof(*(&stuff->drw_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_h) & 1) && ((uintptr_t)(&stuff->drw_h) & 1) == 0) *(&stuff->drw_h) = lswaps(*(&stuff->drw_h)) ; else swap_uint16((uint16_t *)(&stuff->drw_h)); } while (0); | |||
| 1248 | return XvProcVector[xv_GetStill8] (client); | |||
| 1249 | } | |||
| 1250 | ||||
| 1251 | static int | |||
| 1252 | SProcXvPutImage(ClientPtr client) | |||
| 1253 | { | |||
| 1254 | REQUEST(xvPutImageReq)xvPutImageReq *stuff = (xvPutImageReq *)client->requestBuffer; | |||
| 1255 | REQUEST_AT_LEAST_SIZE(xvPutImageReq)if ((sizeof(xvPutImageReq) >> 2) > client->req_len ) return(16); | |||
| 1256 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1257 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1258 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1259 | swapl(&stuff->gc)do { if (sizeof(*(&stuff->gc)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->gc) & 3) && ((uintptr_t)(&stuff->gc) & 3) == 0) *(&stuff-> gc) = lswapl(*(&stuff->gc)); else swap_uint32((uint32_t *)(&stuff->gc)); } while (0); | |||
| 1260 | swapl(&stuff->id)do { if (sizeof(*(&stuff->id)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->id) & 3) && ((uintptr_t)(&stuff->id) & 3) == 0) *(&stuff-> id) = lswapl(*(&stuff->id)); else swap_uint32((uint32_t *)(&stuff->id)); } while (0); | |||
| 1261 | swaps(&stuff->src_x)do { if (sizeof(*(&stuff->src_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_x) & 1) && ((uintptr_t)(&stuff->src_x) & 1) == 0) *(&stuff->src_x) = lswaps(*(&stuff->src_x)) ; else swap_uint16((uint16_t *)(&stuff->src_x)); } while (0); | |||
| 1262 | swaps(&stuff->src_y)do { if (sizeof(*(&stuff->src_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_y) & 1) && ((uintptr_t)(&stuff->src_y) & 1) == 0) *(&stuff->src_y) = lswaps(*(&stuff->src_y)) ; else swap_uint16((uint16_t *)(&stuff->src_y)); } while (0); | |||
| 1263 | swaps(&stuff->src_w)do { if (sizeof(*(&stuff->src_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_w) & 1) && ((uintptr_t)(&stuff->src_w) & 1) == 0) *(&stuff->src_w) = lswaps(*(&stuff->src_w)) ; else swap_uint16((uint16_t *)(&stuff->src_w)); } while (0); | |||
| 1264 | swaps(&stuff->src_h)do { if (sizeof(*(&stuff->src_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_h) & 1) && ((uintptr_t)(&stuff->src_h) & 1) == 0) *(&stuff->src_h) = lswaps(*(&stuff->src_h)) ; else swap_uint16((uint16_t *)(&stuff->src_h)); } while (0); | |||
| 1265 | swaps(&stuff->drw_x)do { if (sizeof(*(&stuff->drw_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_x) & 1) && ((uintptr_t)(&stuff->drw_x) & 1) == 0) *(&stuff->drw_x) = lswaps(*(&stuff->drw_x)) ; else swap_uint16((uint16_t *)(&stuff->drw_x)); } while (0); | |||
| 1266 | swaps(&stuff->drw_y)do { if (sizeof(*(&stuff->drw_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_y) & 1) && ((uintptr_t)(&stuff->drw_y) & 1) == 0) *(&stuff->drw_y) = lswaps(*(&stuff->drw_y)) ; else swap_uint16((uint16_t *)(&stuff->drw_y)); } while (0); | |||
| 1267 | swaps(&stuff->drw_w)do { if (sizeof(*(&stuff->drw_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_w) & 1) && ((uintptr_t)(&stuff->drw_w) & 1) == 0) *(&stuff->drw_w) = lswaps(*(&stuff->drw_w)) ; else swap_uint16((uint16_t *)(&stuff->drw_w)); } while (0); | |||
| 1268 | swaps(&stuff->drw_h)do { if (sizeof(*(&stuff->drw_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_h) & 1) && ((uintptr_t)(&stuff->drw_h) & 1) == 0) *(&stuff->drw_h) = lswaps(*(&stuff->drw_h)) ; else swap_uint16((uint16_t *)(&stuff->drw_h)); } while (0); | |||
| 1269 | swaps(&stuff->width)do { if (sizeof(*(&stuff->width)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->width) & 1) && ((uintptr_t)(&stuff->width) & 1) == 0) *(&stuff->width) = lswaps(*(&stuff->width)) ; else swap_uint16((uint16_t *)(&stuff->width)); } while (0); | |||
| 1270 | swaps(&stuff->height)do { if (sizeof(*(&stuff->height)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->height) & 1) && ((uintptr_t)(&stuff->height) & 1) == 0) *(&stuff->height) = lswaps(*(&stuff->height )); else swap_uint16((uint16_t *)(&stuff->height)); } while (0); | |||
| 1271 | return XvProcVector[xv_PutImage18] (client); | |||
| 1272 | } | |||
| 1273 | ||||
| 1274 | #ifdef MITSHM1 | |||
| 1275 | static int | |||
| 1276 | SProcXvShmPutImage(ClientPtr client) | |||
| 1277 | { | |||
| 1278 | REQUEST(xvShmPutImageReq)xvShmPutImageReq *stuff = (xvShmPutImageReq *)client->requestBuffer; | |||
| 1279 | REQUEST_SIZE_MATCH(xvShmPutImageReq)if ((sizeof(xvShmPutImageReq) >> 2) != client->req_len ) return(16); | |||
| 1280 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1281 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1282 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1283 | swapl(&stuff->gc)do { if (sizeof(*(&stuff->gc)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->gc) & 3) && ((uintptr_t)(&stuff->gc) & 3) == 0) *(&stuff-> gc) = lswapl(*(&stuff->gc)); else swap_uint32((uint32_t *)(&stuff->gc)); } while (0); | |||
| 1284 | swapl(&stuff->shmseg)do { if (sizeof(*(&stuff->shmseg)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->shmseg) & 3) && ((uintptr_t)(&stuff->shmseg) & 3) == 0) *(&stuff->shmseg) = lswapl(*(&stuff->shmseg )); else swap_uint32((uint32_t *)(&stuff->shmseg)); } while (0); | |||
| 1285 | swapl(&stuff->id)do { if (sizeof(*(&stuff->id)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->id) & 3) && ((uintptr_t)(&stuff->id) & 3) == 0) *(&stuff-> id) = lswapl(*(&stuff->id)); else swap_uint32((uint32_t *)(&stuff->id)); } while (0); | |||
| 1286 | swapl(&stuff->offset)do { if (sizeof(*(&stuff->offset)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->offset) & 3) && ((uintptr_t)(&stuff->offset) & 3) == 0) *(&stuff->offset) = lswapl(*(&stuff->offset )); else swap_uint32((uint32_t *)(&stuff->offset)); } while (0); | |||
| 1287 | swaps(&stuff->src_x)do { if (sizeof(*(&stuff->src_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_x) & 1) && ((uintptr_t)(&stuff->src_x) & 1) == 0) *(&stuff->src_x) = lswaps(*(&stuff->src_x)) ; else swap_uint16((uint16_t *)(&stuff->src_x)); } while (0); | |||
| 1288 | swaps(&stuff->src_y)do { if (sizeof(*(&stuff->src_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_y) & 1) && ((uintptr_t)(&stuff->src_y) & 1) == 0) *(&stuff->src_y) = lswaps(*(&stuff->src_y)) ; else swap_uint16((uint16_t *)(&stuff->src_y)); } while (0); | |||
| 1289 | swaps(&stuff->src_w)do { if (sizeof(*(&stuff->src_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_w) & 1) && ((uintptr_t)(&stuff->src_w) & 1) == 0) *(&stuff->src_w) = lswaps(*(&stuff->src_w)) ; else swap_uint16((uint16_t *)(&stuff->src_w)); } while (0); | |||
| 1290 | swaps(&stuff->src_h)do { if (sizeof(*(&stuff->src_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->src_h) & 1) && ((uintptr_t)(&stuff->src_h) & 1) == 0) *(&stuff->src_h) = lswaps(*(&stuff->src_h)) ; else swap_uint16((uint16_t *)(&stuff->src_h)); } while (0); | |||
| 1291 | swaps(&stuff->drw_x)do { if (sizeof(*(&stuff->drw_x)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_x) & 1) && ((uintptr_t)(&stuff->drw_x) & 1) == 0) *(&stuff->drw_x) = lswaps(*(&stuff->drw_x)) ; else swap_uint16((uint16_t *)(&stuff->drw_x)); } while (0); | |||
| 1292 | swaps(&stuff->drw_y)do { if (sizeof(*(&stuff->drw_y)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_y) & 1) && ((uintptr_t)(&stuff->drw_y) & 1) == 0) *(&stuff->drw_y) = lswaps(*(&stuff->drw_y)) ; else swap_uint16((uint16_t *)(&stuff->drw_y)); } while (0); | |||
| 1293 | swaps(&stuff->drw_w)do { if (sizeof(*(&stuff->drw_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_w) & 1) && ((uintptr_t)(&stuff->drw_w) & 1) == 0) *(&stuff->drw_w) = lswaps(*(&stuff->drw_w)) ; else swap_uint16((uint16_t *)(&stuff->drw_w)); } while (0); | |||
| 1294 | swaps(&stuff->drw_h)do { if (sizeof(*(&stuff->drw_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_h) & 1) && ((uintptr_t)(&stuff->drw_h) & 1) == 0) *(&stuff->drw_h) = lswaps(*(&stuff->drw_h)) ; else swap_uint16((uint16_t *)(&stuff->drw_h)); } while (0); | |||
| 1295 | swaps(&stuff->width)do { if (sizeof(*(&stuff->width)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->width) & 1) && ((uintptr_t)(&stuff->width) & 1) == 0) *(&stuff->width) = lswaps(*(&stuff->width)) ; else swap_uint16((uint16_t *)(&stuff->width)); } while (0); | |||
| 1296 | swaps(&stuff->height)do { if (sizeof(*(&stuff->height)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->height) & 1) && ((uintptr_t)(&stuff->height) & 1) == 0) *(&stuff->height) = lswaps(*(&stuff->height )); else swap_uint16((uint16_t *)(&stuff->height)); } while (0); | |||
| 1297 | return XvProcVector[xv_ShmPutImage19] (client); | |||
| 1298 | } | |||
| 1299 | #else /* MITSHM */ | |||
| 1300 | #define SProcXvShmPutImage ProcXvShmPutImage | |||
| 1301 | #endif | |||
| 1302 | ||||
| 1303 | static int | |||
| 1304 | SProcXvSelectVideoNotify(ClientPtr client) | |||
| 1305 | { | |||
| 1306 | REQUEST(xvSelectVideoNotifyReq)xvSelectVideoNotifyReq *stuff = (xvSelectVideoNotifyReq *)client ->requestBuffer; | |||
| 1307 | REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq)if ((sizeof(xvSelectVideoNotifyReq) >> 2) != client-> req_len) return(16); | |||
| 1308 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1309 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1310 | return XvProcVector[xv_SelectVideoNotify10] (client); | |||
| 1311 | } | |||
| 1312 | ||||
| 1313 | static int | |||
| 1314 | SProcXvSelectPortNotify(ClientPtr client) | |||
| 1315 | { | |||
| 1316 | REQUEST(xvSelectPortNotifyReq)xvSelectPortNotifyReq *stuff = (xvSelectPortNotifyReq *)client ->requestBuffer; | |||
| 1317 | REQUEST_SIZE_MATCH(xvSelectPortNotifyReq)if ((sizeof(xvSelectPortNotifyReq) >> 2) != client-> req_len) return(16); | |||
| 1318 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1319 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1320 | return XvProcVector[xv_SelectPortNotify11] (client); | |||
| 1321 | } | |||
| 1322 | ||||
| 1323 | static int | |||
| 1324 | SProcXvStopVideo(ClientPtr client) | |||
| 1325 | { | |||
| 1326 | REQUEST(xvStopVideoReq)xvStopVideoReq *stuff = (xvStopVideoReq *)client->requestBuffer; | |||
| 1327 | REQUEST_SIZE_MATCH(xvStopVideoReq)if ((sizeof(xvStopVideoReq) >> 2) != client->req_len ) return(16); | |||
| 1328 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1329 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1330 | swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size( ); if (__builtin_constant_p((uintptr_t)(&stuff->drawable ) & 3) && ((uintptr_t)(&stuff->drawable) & 3) == 0) *(&stuff->drawable) = lswapl(*(&stuff-> drawable)); else swap_uint32((uint32_t *)(&stuff->drawable )); } while (0); | |||
| 1331 | return XvProcVector[xv_StopVideo9] (client); | |||
| 1332 | } | |||
| 1333 | ||||
| 1334 | static int | |||
| 1335 | SProcXvSetPortAttribute(ClientPtr client) | |||
| 1336 | { | |||
| 1337 | REQUEST(xvSetPortAttributeReq)xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)client ->requestBuffer; | |||
| 1338 | REQUEST_SIZE_MATCH(xvSetPortAttributeReq)if ((sizeof(xvSetPortAttributeReq) >> 2) != client-> req_len) return(16); | |||
| 1339 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1340 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1341 | swapl(&stuff->attribute)do { if (sizeof(*(&stuff->attribute)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&stuff->attribute ) & 3) && ((uintptr_t)(&stuff->attribute) & 3) == 0) *(&stuff->attribute) = lswapl(*(&stuff-> attribute)); else swap_uint32((uint32_t *)(&stuff->attribute )); } while (0); | |||
| 1342 | swapl(&stuff->value)do { if (sizeof(*(&stuff->value)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->value) & 3) && ((uintptr_t)(&stuff->value) & 3) == 0) *(&stuff->value) = lswapl(*(&stuff->value)) ; else swap_uint32((uint32_t *)(&stuff->value)); } while (0); | |||
| 1343 | return XvProcVector[xv_SetPortAttribute13] (client); | |||
| 1344 | } | |||
| 1345 | ||||
| 1346 | static int | |||
| 1347 | SProcXvGetPortAttribute(ClientPtr client) | |||
| 1348 | { | |||
| 1349 | REQUEST(xvGetPortAttributeReq)xvGetPortAttributeReq *stuff = (xvGetPortAttributeReq *)client ->requestBuffer; | |||
| 1350 | REQUEST_SIZE_MATCH(xvGetPortAttributeReq)if ((sizeof(xvGetPortAttributeReq) >> 2) != client-> req_len) return(16); | |||
| 1351 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1352 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1353 | swapl(&stuff->attribute)do { if (sizeof(*(&stuff->attribute)) != 4) wrong_size (); if (__builtin_constant_p((uintptr_t)(&stuff->attribute ) & 3) && ((uintptr_t)(&stuff->attribute) & 3) == 0) *(&stuff->attribute) = lswapl(*(&stuff-> attribute)); else swap_uint32((uint32_t *)(&stuff->attribute )); } while (0); | |||
| 1354 | return XvProcVector[xv_GetPortAttribute14] (client); | |||
| 1355 | } | |||
| 1356 | ||||
| 1357 | static int | |||
| 1358 | SProcXvQueryBestSize(ClientPtr client) | |||
| 1359 | { | |||
| 1360 | REQUEST(xvQueryBestSizeReq)xvQueryBestSizeReq *stuff = (xvQueryBestSizeReq *)client-> requestBuffer; | |||
| 1361 | REQUEST_SIZE_MATCH(xvQueryBestSizeReq)if ((sizeof(xvQueryBestSizeReq) >> 2) != client->req_len ) return(16); | |||
| 1362 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1363 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1364 | swaps(&stuff->vid_w)do { if (sizeof(*(&stuff->vid_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_w) & 1) && ((uintptr_t)(&stuff->vid_w) & 1) == 0) *(&stuff->vid_w) = lswaps(*(&stuff->vid_w)) ; else swap_uint16((uint16_t *)(&stuff->vid_w)); } while (0); | |||
| 1365 | swaps(&stuff->vid_h)do { if (sizeof(*(&stuff->vid_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->vid_h) & 1) && ((uintptr_t)(&stuff->vid_h) & 1) == 0) *(&stuff->vid_h) = lswaps(*(&stuff->vid_h)) ; else swap_uint16((uint16_t *)(&stuff->vid_h)); } while (0); | |||
| 1366 | swaps(&stuff->drw_w)do { if (sizeof(*(&stuff->drw_w)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_w) & 1) && ((uintptr_t)(&stuff->drw_w) & 1) == 0) *(&stuff->drw_w) = lswaps(*(&stuff->drw_w)) ; else swap_uint16((uint16_t *)(&stuff->drw_w)); } while (0); | |||
| 1367 | swaps(&stuff->drw_h)do { if (sizeof(*(&stuff->drw_h)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->drw_h) & 1) && ((uintptr_t)(&stuff->drw_h) & 1) == 0) *(&stuff->drw_h) = lswaps(*(&stuff->drw_h)) ; else swap_uint16((uint16_t *)(&stuff->drw_h)); } while (0); | |||
| 1368 | return XvProcVector[xv_QueryBestSize12] (client); | |||
| 1369 | } | |||
| 1370 | ||||
| 1371 | static int | |||
| 1372 | SProcXvQueryPortAttributes(ClientPtr client) | |||
| 1373 | { | |||
| 1374 | REQUEST(xvQueryPortAttributesReq)xvQueryPortAttributesReq *stuff = (xvQueryPortAttributesReq * )client->requestBuffer; | |||
| 1375 | REQUEST_SIZE_MATCH(xvQueryPortAttributesReq)if ((sizeof(xvQueryPortAttributesReq) >> 2) != client-> req_len) return(16); | |||
| 1376 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1377 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1378 | return XvProcVector[xv_QueryPortAttributes15] (client); | |||
| 1379 | } | |||
| 1380 | ||||
| 1381 | static int | |||
| 1382 | SProcXvQueryImageAttributes(ClientPtr client) | |||
| 1383 | { | |||
| 1384 | REQUEST(xvQueryImageAttributesReq)xvQueryImageAttributesReq *stuff = (xvQueryImageAttributesReq *)client->requestBuffer; | |||
| 1385 | REQUEST_SIZE_MATCH(xvQueryImageAttributesReq)if ((sizeof(xvQueryImageAttributesReq) >> 2) != client-> req_len) return(16); | |||
| 1386 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1387 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1388 | swapl(&stuff->id)do { if (sizeof(*(&stuff->id)) != 4) wrong_size(); if ( __builtin_constant_p((uintptr_t)(&stuff->id) & 3) && ((uintptr_t)(&stuff->id) & 3) == 0) *(&stuff-> id) = lswapl(*(&stuff->id)); else swap_uint32((uint32_t *)(&stuff->id)); } while (0); | |||
| 1389 | swaps(&stuff->width)do { if (sizeof(*(&stuff->width)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->width) & 1) && ((uintptr_t)(&stuff->width) & 1) == 0) *(&stuff->width) = lswaps(*(&stuff->width)) ; else swap_uint16((uint16_t *)(&stuff->width)); } while (0); | |||
| 1390 | swaps(&stuff->height)do { if (sizeof(*(&stuff->height)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->height) & 1) && ((uintptr_t)(&stuff->height) & 1) == 0) *(&stuff->height) = lswaps(*(&stuff->height )); else swap_uint16((uint16_t *)(&stuff->height)); } while (0); | |||
| 1391 | return XvProcVector[xv_QueryImageAttributes17] (client); | |||
| 1392 | } | |||
| 1393 | ||||
| 1394 | static int | |||
| 1395 | SProcXvListImageFormats(ClientPtr client) | |||
| 1396 | { | |||
| 1397 | REQUEST(xvListImageFormatsReq)xvListImageFormatsReq *stuff = (xvListImageFormatsReq *)client ->requestBuffer; | |||
| 1398 | REQUEST_SIZE_MATCH(xvListImageFormatsReq)if ((sizeof(xvListImageFormatsReq) >> 2) != client-> req_len) return(16); | |||
| 1399 | swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->length) & 1) && ((uintptr_t)(&stuff->length) & 1) == 0) *(&stuff->length) = lswaps(*(&stuff->length )); else swap_uint16((uint16_t *)(&stuff->length)); } while (0); | |||
| 1400 | swapl(&stuff->port)do { if (sizeof(*(&stuff->port)) != 4) wrong_size(); if (__builtin_constant_p((uintptr_t)(&stuff->port) & 3) && ((uintptr_t)(&stuff->port) & 3) == 0 ) *(&stuff->port) = lswapl(*(&stuff->port)); else swap_uint32((uint32_t *)(&stuff->port)); } while (0); | |||
| 1401 | return XvProcVector[xv_ListImageFormats16] (client); | |||
| 1402 | } | |||
| 1403 | ||||
| 1404 | static int (*SXvProcVector[xvNumRequests(19 + 1)]) (ClientPtr) = { | |||
| 1405 | SProcXvQueryExtension, | |||
| 1406 | SProcXvQueryAdaptors, | |||
| 1407 | SProcXvQueryEncodings, | |||
| 1408 | SProcXvGrabPort, | |||
| 1409 | SProcXvUngrabPort, | |||
| 1410 | SProcXvPutVideo, | |||
| 1411 | SProcXvPutStill, | |||
| 1412 | SProcXvGetVideo, | |||
| 1413 | SProcXvGetStill, | |||
| 1414 | SProcXvStopVideo, | |||
| 1415 | SProcXvSelectVideoNotify, | |||
| 1416 | SProcXvSelectPortNotify, | |||
| 1417 | SProcXvQueryBestSize, | |||
| 1418 | SProcXvSetPortAttribute, | |||
| 1419 | SProcXvGetPortAttribute, | |||
| 1420 | SProcXvQueryPortAttributes, | |||
| 1421 | SProcXvListImageFormats, | |||
| 1422 | SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,}; | |||
| 1423 | ||||
| 1424 | int | |||
| 1425 | SProcXvDispatch(ClientPtr client) | |||
| 1426 | { | |||
| 1427 | REQUEST(xReq)xReq *stuff = (xReq *)client->requestBuffer; | |||
| 1428 | ||||
| 1429 | UpdateCurrentTime(); | |||
| 1430 | ||||
| 1431 | if (stuff->data >= xvNumRequests(19 + 1)) { | |||
| 1432 | SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest1); | |||
| 1433 | return BadRequest1; | |||
| 1434 | } | |||
| 1435 | ||||
| 1436 | return SXvProcVector[stuff->data] (client); | |||
| 1437 | } | |||
| 1438 | ||||
| 1439 | #ifdef PANORAMIX1 | |||
| 1440 | static int | |||
| 1441 | XineramaXvStopVideo(ClientPtr client) | |||
| 1442 | { | |||
| 1443 | int result, i; | |||
| 1444 | PanoramiXRes *draw, *port; | |||
| 1445 | ||||
| 1446 | REQUEST(xvStopVideoReq)xvStopVideoReq *stuff = (xvStopVideoReq *)client->requestBuffer; | |||
| 1447 | REQUEST_SIZE_MATCH(xvStopVideoReq)if ((sizeof(xvStopVideoReq) >> 2) != client->req_len ) return(16); | |||
| 1448 | ||||
| 1449 | result = dixLookupResourceByClass((void **) &draw, stuff->drawable, | |||
| 1450 | XRC_DRAWABLE, client, DixWriteAccess(1<<1)); | |||
| 1451 | if (result != Success0) | |||
| 1452 | return (result == BadValue2) ? BadDrawable9 : result; | |||
| 1453 | ||||
| 1454 | result = dixLookupResourceByType((void **) &port, stuff->port, | |||
| 1455 | XvXRTPort, client, DixReadAccess(1<<0)); | |||
| 1456 | if (result != Success0) | |||
| 1457 | return result; | |||
| 1458 | ||||
| 1459 | FOR_NSCREENS_BACKWARD(i)for(i = PanoramiXNumScreens - 1; i >= 0; i--) { | |||
| 1460 | if (port->info[i].id) { | |||
| 1461 | stuff->drawable = draw->info[i].id; | |||
| 1462 | stuff->port = port->info[i].id; | |||
| 1463 | result = ProcXvStopVideo(client); | |||
| 1464 | } | |||
| 1465 | } | |||
| 1466 | ||||
| 1467 | return result; | |||
| 1468 | } | |||
| 1469 | ||||
| 1470 | static int | |||
| 1471 | XineramaXvSetPortAttribute(ClientPtr client) | |||
| 1472 | { | |||
| 1473 | REQUEST(xvSetPortAttributeReq)xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)client ->requestBuffer; | |||
| 1474 | PanoramiXRes *port; | |||
| 1475 | int result, i; | |||
| 1476 | ||||
| 1477 | REQUEST_SIZE_MATCH(xvSetPortAttributeReq)if ((sizeof(xvSetPortAttributeReq) >> 2) != client-> req_len) return(16); | |||
| 1478 | ||||
| 1479 | result = dixLookupResourceByType((void **) &port, stuff->port, | |||
| 1480 | XvXRTPort, client, DixReadAccess(1<<0)); | |||
| 1481 | if (result != Success0) | |||
| 1482 | return result; | |||
| 1483 | ||||
| 1484 | FOR_NSCREENS_BACKWARD(i)for(i = PanoramiXNumScreens - 1; i >= 0; i--) { | |||
| 1485 | if (port->info[i].id) { | |||
| 1486 | stuff->port = port->info[i].id; | |||
| 1487 | result = ProcXvSetPortAttribute(client); | |||
| 1488 | } | |||
| 1489 | } | |||
| 1490 | return result; | |||
| 1491 | } | |||
| 1492 | ||||
| 1493 | #ifdef MITSHM1 | |||
| 1494 | static int | |||
| 1495 | XineramaXvShmPutImage(ClientPtr client) | |||
| 1496 | { | |||
| 1497 | REQUEST(xvShmPutImageReq)xvShmPutImageReq *stuff = (xvShmPutImageReq *)client->requestBuffer; | |||
| 1498 | PanoramiXRes *draw, *gc, *port; | |||
| 1499 | Bool send_event = stuff->send_event; | |||
| 1500 | Bool isRoot; | |||
| 1501 | int result, i, x, y; | |||
| 1502 | ||||
| 1503 | REQUEST_SIZE_MATCH(xvShmPutImageReq)if ((sizeof(xvShmPutImageReq) >> 2) != client->req_len ) return(16); | |||
| 1504 | ||||
| 1505 | result = dixLookupResourceByClass((void **) &draw, stuff->drawable, | |||
| 1506 | XRC_DRAWABLE, client, DixWriteAccess(1<<1)); | |||
| 1507 | if (result != Success0) | |||
| 1508 | return (result == BadValue2) ? BadDrawable9 : result; | |||
| 1509 | ||||
| 1510 | result = dixLookupResourceByType((void **) &gc, stuff->gc, | |||
| 1511 | XRT_GC, client, DixReadAccess(1<<0)); | |||
| 1512 | if (result != Success0) | |||
| 1513 | return result; | |||
| 1514 | ||||
| 1515 | result = dixLookupResourceByType((void **) &port, stuff->port, | |||
| 1516 | XvXRTPort, client, DixReadAccess(1<<0)); | |||
| 1517 | if (result != Success0) | |||
| 1518 | return result; | |||
| 1519 | ||||
| 1520 | isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; | |||
| 1521 | ||||
| 1522 | x = stuff->drw_x; | |||
| 1523 | y = stuff->drw_y; | |||
| 1524 | ||||
| 1525 | FOR_NSCREENS_BACKWARD(i)for(i = PanoramiXNumScreens - 1; i >= 0; i--) { | |||
| 1526 | if (port->info[i].id) { | |||
| 1527 | stuff->drawable = draw->info[i].id; | |||
| 1528 | stuff->port = port->info[i].id; | |||
| 1529 | stuff->gc = gc->info[i].id; | |||
| 1530 | stuff->drw_x = x; | |||
| 1531 | stuff->drw_y = y; | |||
| 1532 | if (isRoot) { | |||
| 1533 | stuff->drw_x -= screenInfo.screens[i]->x; | |||
| 1534 | stuff->drw_y -= screenInfo.screens[i]->y; | |||
| 1535 | } | |||
| 1536 | stuff->send_event = (send_event && !i) ? 1 : 0; | |||
| 1537 | ||||
| 1538 | result = ProcXvShmPutImage(client); | |||
| 1539 | } | |||
| 1540 | } | |||
| 1541 | return result; | |||
| 1542 | } | |||
| 1543 | #else | |||
| 1544 | #define XineramaXvShmPutImage ProcXvShmPutImage | |||
| 1545 | #endif | |||
| 1546 | ||||
| 1547 | static int | |||
| 1548 | XineramaXvPutImage(ClientPtr client) | |||
| 1549 | { | |||
| 1550 | REQUEST(xvPutImageReq)xvPutImageReq *stuff = (xvPutImageReq *)client->requestBuffer; | |||
| 1551 | PanoramiXRes *draw, *gc, *port; | |||
| 1552 | Bool isRoot; | |||
| 1553 | int result, i, x, y; | |||
| 1554 | ||||
| 1555 | REQUEST_AT_LEAST_SIZE(xvPutImageReq)if ((sizeof(xvPutImageReq) >> 2) > client->req_len ) return(16); | |||
| 1556 | ||||
| 1557 | result = dixLookupResourceByClass((void **) &draw, stuff->drawable, | |||
| 1558 | XRC_DRAWABLE, client, DixWriteAccess(1<<1)); | |||
| 1559 | if (result != Success0) | |||
| 1560 | return (result == BadValue2) ? BadDrawable9 : result; | |||
| 1561 | ||||
| 1562 | result = dixLookupResourceByType((void **) &gc, stuff->gc, | |||
| 1563 | XRT_GC, client, DixReadAccess(1<<0)); | |||
| 1564 | if (result != Success0) | |||
| 1565 | return result; | |||
| 1566 | ||||
| 1567 | result = dixLookupResourceByType((void **) &port, stuff->port, | |||
| 1568 | XvXRTPort, client, DixReadAccess(1<<0)); | |||
| 1569 | if (result != Success0) | |||
| 1570 | return result; | |||
| 1571 | ||||
| 1572 | isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; | |||
| 1573 | ||||
| 1574 | x = stuff->drw_x; | |||
| 1575 | y = stuff->drw_y; | |||
| 1576 | ||||
| 1577 | FOR_NSCREENS_BACKWARD(i)for(i = PanoramiXNumScreens - 1; i >= 0; i--) { | |||
| 1578 | if (port->info[i].id) { | |||
| 1579 | stuff->drawable = draw->info[i].id; | |||
| 1580 | stuff->port = port->info[i].id; | |||
| 1581 | stuff->gc = gc->info[i].id; | |||
| 1582 | stuff->drw_x = x; | |||
| 1583 | stuff->drw_y = y; | |||
| 1584 | if (isRoot) { | |||
| 1585 | stuff->drw_x -= screenInfo.screens[i]->x; | |||
| 1586 | stuff->drw_y -= screenInfo.screens[i]->y; | |||
| 1587 | } | |||
| 1588 | ||||
| 1589 | result = ProcXvPutImage(client); | |||
| 1590 | } | |||
| 1591 | } | |||
| 1592 | return result; | |||
| 1593 | } | |||
| 1594 | ||||
| 1595 | static int | |||
| 1596 | XineramaXvPutVideo(ClientPtr client) | |||
| 1597 | { | |||
| 1598 | REQUEST(xvPutImageReq)xvPutImageReq *stuff = (xvPutImageReq *)client->requestBuffer; | |||
| 1599 | PanoramiXRes *draw, *gc, *port; | |||
| 1600 | Bool isRoot; | |||
| 1601 | int result, i, x, y; | |||
| 1602 | ||||
| 1603 | REQUEST_AT_LEAST_SIZE(xvPutVideoReq)if ((sizeof(xvPutVideoReq) >> 2) > client->req_len ) return(16); | |||
| 1604 | ||||
| 1605 | result = dixLookupResourceByClass((void **) &draw, stuff->drawable, | |||
| 1606 | XRC_DRAWABLE, client, DixWriteAccess(1<<1)); | |||
| 1607 | if (result != Success0) | |||
| 1608 | return (result == BadValue2) ? BadDrawable9 : result; | |||
| 1609 | ||||
| 1610 | result = dixLookupResourceByType((void **) &gc, stuff->gc, | |||
| 1611 | XRT_GC, client, DixReadAccess(1<<0)); | |||
| 1612 | if (result != Success0) | |||
| 1613 | return result; | |||
| 1614 | ||||
| 1615 | result = dixLookupResourceByType((void **) &port, stuff->port, | |||
| 1616 | XvXRTPort, client, DixReadAccess(1<<0)); | |||
| 1617 | if (result != Success0) | |||
| 1618 | return result; | |||
| 1619 | ||||
| 1620 | isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; | |||
| 1621 | ||||
| 1622 | x = stuff->drw_x; | |||
| 1623 | y = stuff->drw_y; | |||
| 1624 | ||||
| 1625 | FOR_NSCREENS_BACKWARD(i)for(i = PanoramiXNumScreens - 1; i >= 0; i--) { | |||
| 1626 | if (port->info[i].id) { | |||
| 1627 | stuff->drawable = draw->info[i].id; | |||
| 1628 | stuff->port = port->info[i].id; | |||
| 1629 | stuff->gc = gc->info[i].id; | |||
| 1630 | stuff->drw_x = x; | |||
| 1631 | stuff->drw_y = y; | |||
| 1632 | if (isRoot) { | |||
| 1633 | stuff->drw_x -= screenInfo.screens[i]->x; | |||
| 1634 | stuff->drw_y -= screenInfo.screens[i]->y; | |||
| 1635 | } | |||
| 1636 | ||||
| 1637 | result = ProcXvPutVideo(client); | |||
| 1638 | } | |||
| 1639 | } | |||
| 1640 | return result; | |||
| 1641 | } | |||
| 1642 | ||||
| 1643 | static int | |||
| 1644 | XineramaXvPutStill(ClientPtr client) | |||
| 1645 | { | |||
| 1646 | REQUEST(xvPutImageReq)xvPutImageReq *stuff = (xvPutImageReq *)client->requestBuffer; | |||
| 1647 | PanoramiXRes *draw, *gc, *port; | |||
| 1648 | Bool isRoot; | |||
| 1649 | int result, i, x, y; | |||
| 1650 | ||||
| 1651 | REQUEST_AT_LEAST_SIZE(xvPutImageReq)if ((sizeof(xvPutImageReq) >> 2) > client->req_len ) return(16); | |||
| 1652 | ||||
| 1653 | result = dixLookupResourceByClass((void **) &draw, stuff->drawable, | |||
| 1654 | XRC_DRAWABLE, client, DixWriteAccess(1<<1)); | |||
| 1655 | if (result != Success0) | |||
| 1656 | return (result == BadValue2) ? BadDrawable9 : result; | |||
| 1657 | ||||
| 1658 | result = dixLookupResourceByType((void **) &gc, stuff->gc, | |||
| 1659 | XRT_GC, client, DixReadAccess(1<<0)); | |||
| 1660 | if (result != Success0) | |||
| 1661 | return result; | |||
| 1662 | ||||
| 1663 | result = dixLookupResourceByType((void **) &port, stuff->port, | |||
| 1664 | XvXRTPort, client, DixReadAccess(1<<0)); | |||
| 1665 | if (result != Success0) | |||
| 1666 | return result; | |||
| 1667 | ||||
| 1668 | isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; | |||
| 1669 | ||||
| 1670 | x = stuff->drw_x; | |||
| 1671 | y = stuff->drw_y; | |||
| 1672 | ||||
| 1673 | FOR_NSCREENS_BACKWARD(i)for(i = PanoramiXNumScreens - 1; i >= 0; i--) { | |||
| 1674 | if (port->info[i].id) { | |||
| 1675 | stuff->drawable = draw->info[i].id; | |||
| 1676 | stuff->port = port->info[i].id; | |||
| 1677 | stuff->gc = gc->info[i].id; | |||
| 1678 | stuff->drw_x = x; | |||
| 1679 | stuff->drw_y = y; | |||
| 1680 | if (isRoot) { | |||
| 1681 | stuff->drw_x -= screenInfo.screens[i]->x; | |||
| 1682 | stuff->drw_y -= screenInfo.screens[i]->y; | |||
| 1683 | } | |||
| 1684 | ||||
| 1685 | result = ProcXvPutStill(client); | |||
| 1686 | } | |||
| 1687 | } | |||
| 1688 | return result; | |||
| 1689 | } | |||
| 1690 | ||||
| 1691 | static Bool | |||
| 1692 | isImageAdaptor(XvAdaptorPtr pAdapt) | |||
| 1693 | { | |||
| 1694 | return (pAdapt->type & XvImageMask0x00000010) && (pAdapt->nImages > 0); | |||
| 1695 | } | |||
| 1696 | ||||
| 1697 | static Bool | |||
| 1698 | hasOverlay(XvAdaptorPtr pAdapt) | |||
| 1699 | { | |||
| 1700 | int i; | |||
| 1701 | ||||
| 1702 | for (i = 0; i < pAdapt->nAttributes; i++) | |||
| 1703 | if (!strcmp(pAdapt->pAttributes[i].name, "XV_COLORKEY")) | |||
| 1704 | return TRUE1; | |||
| 1705 | return FALSE0; | |||
| 1706 | } | |||
| 1707 | ||||
| 1708 | static XvAdaptorPtr | |||
| 1709 | matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay) | |||
| 1710 | { | |||
| 1711 | int i; | |||
| 1712 | XvScreenPtr xvsp = | |||
| 1713 | dixLookupPrivate(&pScreen->devPrivates, XvGetScreenKey()); | |||
| 1714 | /* Do not try to go on if xv is not supported on this screen */ | |||
| 1715 | if (xvsp == NULL((void*)0)) | |||
| 1716 | return NULL((void*)0); | |||
| 1717 | ||||
| 1718 | /* if the adaptor has the same name it's a perfect match */ | |||
| 1719 | for (i = 0; i < xvsp->nAdaptors; i++) { | |||
| 1720 | XvAdaptorPtr pAdapt = xvsp->pAdaptors + i; | |||
| 1721 | ||||
| 1722 | if (!strcmp(refAdapt->name, pAdapt->name)) | |||
| 1723 | return pAdapt; | |||
| 1724 | } | |||
| 1725 | ||||
| 1726 | /* otherwise we only look for XvImage adaptors */ | |||
| 1727 | if (!isImageAdaptor(refAdapt)) | |||
| 1728 | return NULL((void*)0); | |||
| 1729 | ||||
| 1730 | /* prefer overlay/overlay non-overlay/non-overlay pairing */ | |||
| 1731 | for (i = 0; i < xvsp->nAdaptors; i++) { | |||
| 1732 | XvAdaptorPtr pAdapt = xvsp->pAdaptors + i; | |||
| 1733 | ||||
| 1734 | if (isImageAdaptor(pAdapt) && isOverlay == hasOverlay(pAdapt)) | |||
| 1735 | return pAdapt; | |||
| 1736 | } | |||
| 1737 | ||||
| 1738 | /* but we'll take any XvImage pairing if we can get it */ | |||
| 1739 | for (i = 0; i < xvsp->nAdaptors; i++) { | |||
| 1740 | XvAdaptorPtr pAdapt = xvsp->pAdaptors + i; | |||
| 1741 | ||||
| 1742 | if (isImageAdaptor(pAdapt)) | |||
| 1743 | return pAdapt; | |||
| 1744 | } | |||
| 1745 | return NULL((void*)0); | |||
| 1746 | } | |||
| 1747 | ||||
| 1748 | void | |||
| 1749 | XineramifyXv(void) | |||
| 1750 | { | |||
| 1751 | XvScreenPtr xvsp0 = | |||
| 1752 | dixLookupPrivate(&screenInfo.screens[0]->devPrivates, XvGetScreenKey()); | |||
| 1753 | XvAdaptorPtr MatchingAdaptors[MAXSCREENS16]; | |||
| 1754 | int i, j, k; | |||
| 1755 | ||||
| 1756 | XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort"); | |||
| 1757 | ||||
| 1758 | if (!xvsp0 || !XvXRTPort) | |||
| ||||
| 1759 | return; | |||
| 1760 | SetResourceTypeErrorValue(XvXRTPort, _XvBadPort(0 +XvErrorBase)); | |||
| 1761 | ||||
| 1762 | for (i = 0; i < xvsp0->nAdaptors; i++) { | |||
| 1763 | Bool isOverlay; | |||
| 1764 | XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i; | |||
| 1765 | ||||
| 1766 | if (!(refAdapt->type & XvInputMask(1<<0))) | |||
| 1767 | continue; | |||
| 1768 | ||||
| 1769 | MatchingAdaptors[0] = refAdapt; | |||
| 1770 | isOverlay = hasOverlay(refAdapt); | |||
| 1771 | FOR_NSCREENS_FORWARD_SKIP(j)for(j = 1; j < PanoramiXNumScreens; j++) | |||
| 1772 | MatchingAdaptors[j] = | |||
| 1773 | matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay); | |||
| 1774 | ||||
| 1775 | /* now create a resource for each port */ | |||
| 1776 | for (j = 0; j < refAdapt->nPorts; j++) { | |||
| 1777 | PanoramiXRes *port = malloc(sizeof(PanoramiXRes)); | |||
| 1778 | ||||
| 1779 | if (!port) | |||
| 1780 | break; | |||
| 1781 | ||||
| 1782 | FOR_NSCREENS(k)for(k = 0; k < PanoramiXNumScreens; k++) { | |||
| 1783 | if (MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j)) | |||
| ||||
| 1784 | port->info[k].id = MatchingAdaptors[k]->base_id + j; | |||
| 1785 | else | |||
| 1786 | port->info[k].id = 0; | |||
| 1787 | } | |||
| 1788 | AddResourceDarwin_X_AddResource(port->info[0].id, XvXRTPort, port); | |||
| 1789 | } | |||
| 1790 | } | |||
| 1791 | ||||
| 1792 | /* munge the dispatch vector */ | |||
| 1793 | XvProcVector[xv_PutVideo5] = XineramaXvPutVideo; | |||
| 1794 | XvProcVector[xv_PutStill6] = XineramaXvPutStill; | |||
| 1795 | XvProcVector[xv_StopVideo9] = XineramaXvStopVideo; | |||
| 1796 | XvProcVector[xv_SetPortAttribute13] = XineramaXvSetPortAttribute; | |||
| 1797 | XvProcVector[xv_PutImage18] = XineramaXvPutImage; | |||
| 1798 | XvProcVector[xv_ShmPutImage19] = XineramaXvShmPutImage; | |||
| 1799 | } | |||
| 1800 | #endif /* PANORAMIX */ | |||
| 1801 | ||||
| 1802 | void | |||
| 1803 | XvResetProcVector(void) | |||
| 1804 | { | |||
| 1805 | #ifdef PANORAMIX1 | |||
| 1806 | XvProcVector[xv_PutVideo5] = ProcXvPutVideo; | |||
| 1807 | XvProcVector[xv_PutStill6] = ProcXvPutStill; | |||
| 1808 | XvProcVector[xv_StopVideo9] = ProcXvStopVideo; | |||
| 1809 | XvProcVector[xv_SetPortAttribute13] = ProcXvSetPortAttribute; | |||
| 1810 | XvProcVector[xv_PutImage18] = ProcXvPutImage; | |||
| 1811 | XvProcVector[xv_ShmPutImage19] = ProcXvShmPutImage; | |||
| 1812 | #endif | |||
| 1813 | } |