1*4882a593Smuzhiyun 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copyright (c) 2001 by The XFree86 Project, Inc. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 6*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 7*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 8*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 10*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 11*4882a593Smuzhiyun * 12*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be included in 13*4882a593Smuzhiyun * all copies or substantial portions of the Software. 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18*4882a593Smuzhiyun * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19*4882a593Smuzhiyun * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20*4882a593Smuzhiyun * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21*4882a593Smuzhiyun * OTHER DEALINGS IN THE SOFTWARE. 22*4882a593Smuzhiyun * 23*4882a593Smuzhiyun * Except as contained in this notice, the name of the copyright holder(s) 24*4882a593Smuzhiyun * and author(s) shall not be used in advertising or otherwise to promote 25*4882a593Smuzhiyun * the sale, use or other dealings in this Software without prior written 26*4882a593Smuzhiyun * authorization from the copyright holder(s) and author(s). 27*4882a593Smuzhiyun */ 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun #ifndef _XF86XVMC_H 30*4882a593Smuzhiyun #define _XF86XVMC_H 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun #include "xvmcext.h" 33*4882a593Smuzhiyun #include "xf86xv.h" 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun typedef struct { 36*4882a593Smuzhiyun int num_xvimages; 37*4882a593Smuzhiyun int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */ 38*4882a593Smuzhiyun } XF86MCImageIDList; 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun typedef struct { 41*4882a593Smuzhiyun int surface_type_id; /* Driver generated. Must be unique on the port */ 42*4882a593Smuzhiyun int chroma_format; 43*4882a593Smuzhiyun int color_description; /* no longer used */ 44*4882a593Smuzhiyun unsigned short max_width; 45*4882a593Smuzhiyun unsigned short max_height; 46*4882a593Smuzhiyun unsigned short subpicture_max_width; 47*4882a593Smuzhiyun unsigned short subpicture_max_height; 48*4882a593Smuzhiyun int mc_type; 49*4882a593Smuzhiyun int flags; 50*4882a593Smuzhiyun XF86MCImageIDList *compatible_subpictures; /* can be null, if none */ 51*4882a593Smuzhiyun } XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr; 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun /* 54*4882a593Smuzhiyun xf86XvMCCreateContextProc 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun DIX will fill everything out in the context except the driver_priv. 57*4882a593Smuzhiyun The port_priv holds the private data specified for the port when 58*4882a593Smuzhiyun Xv was initialized by the driver. 59*4882a593Smuzhiyun The driver may store whatever it wants in driver_priv and edit 60*4882a593Smuzhiyun the width, height and flags. If the driver wants to return something 61*4882a593Smuzhiyun to the client it can allocate space in priv and specify the number 62*4882a593Smuzhiyun of 32 bit words in num_priv. This must be dynamically allocated 63*4882a593Smuzhiyun space because DIX will free it after it passes it to the client. 64*4882a593Smuzhiyun */ 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun typedef int (*xf86XvMCCreateContextProcPtr) (ScrnInfoPtr pScrn, 67*4882a593Smuzhiyun XvMCContextPtr context, 68*4882a593Smuzhiyun int *num_priv, CARD32 **priv); 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun typedef void (*xf86XvMCDestroyContextProcPtr) (ScrnInfoPtr pScrn, 71*4882a593Smuzhiyun XvMCContextPtr context); 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun /* 74*4882a593Smuzhiyun xf86XvMCCreateSurfaceProc 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun DIX will fill everything out in the surface except the driver_priv. 77*4882a593Smuzhiyun The driver may store whatever it wants in driver_priv. The driver 78*4882a593Smuzhiyun may pass data back to the client in the same manner as the 79*4882a593Smuzhiyun xf86XvMCCreateContextProc. 80*4882a593Smuzhiyun */ 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun typedef int (*xf86XvMCCreateSurfaceProcPtr) (ScrnInfoPtr pScrn, 83*4882a593Smuzhiyun XvMCSurfacePtr surface, 84*4882a593Smuzhiyun int *num_priv, CARD32 **priv); 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun typedef void (*xf86XvMCDestroySurfaceProcPtr) (ScrnInfoPtr pScrn, 87*4882a593Smuzhiyun XvMCSurfacePtr surface); 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun /* 90*4882a593Smuzhiyun xf86XvMCCreateSubpictureProc 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun DIX will fill everything out in the subpicture except the driver_priv, 93*4882a593Smuzhiyun num_palette_entries, entry_bytes and component_order. The driver may 94*4882a593Smuzhiyun store whatever it wants in driver_priv and edit the width and height. 95*4882a593Smuzhiyun If it is a paletted subpicture the driver needs to fill out the 96*4882a593Smuzhiyun num_palette_entries, entry_bytes and component_order. These are 97*4882a593Smuzhiyun not communicated to the client until the time the surface is 98*4882a593Smuzhiyun created. 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun The driver may pass data back to the client in the same manner as the 101*4882a593Smuzhiyun xf86XvMCCreateContextProc. 102*4882a593Smuzhiyun */ 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun typedef int (*xf86XvMCCreateSubpictureProcPtr) (ScrnInfoPtr pScrn, 105*4882a593Smuzhiyun XvMCSubpicturePtr subpicture, 106*4882a593Smuzhiyun int *num_priv, CARD32 **priv); 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun typedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn, 109*4882a593Smuzhiyun XvMCSubpicturePtr subpicture); 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun typedef struct { 112*4882a593Smuzhiyun const char *name; 113*4882a593Smuzhiyun int num_surfaces; 114*4882a593Smuzhiyun XF86MCSurfaceInfoPtr *surfaces; 115*4882a593Smuzhiyun int num_subpictures; 116*4882a593Smuzhiyun XF86ImagePtr *subpictures; 117*4882a593Smuzhiyun xf86XvMCCreateContextProcPtr CreateContext; 118*4882a593Smuzhiyun xf86XvMCDestroyContextProcPtr DestroyContext; 119*4882a593Smuzhiyun xf86XvMCCreateSurfaceProcPtr CreateSurface; 120*4882a593Smuzhiyun xf86XvMCDestroySurfaceProcPtr DestroySurface; 121*4882a593Smuzhiyun xf86XvMCCreateSubpictureProcPtr CreateSubpicture; 122*4882a593Smuzhiyun xf86XvMCDestroySubpictureProcPtr DestroySubpicture; 123*4882a593Smuzhiyun } XF86MCAdaptorRec, *XF86MCAdaptorPtr; 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun /* 126*4882a593Smuzhiyun xf86XvMCScreenInit 127*4882a593Smuzhiyun 128*4882a593Smuzhiyun Unlike Xv, the adaptor data is not copied from this structure. 129*4882a593Smuzhiyun This structure's data is used so it must stick around for the 130*4882a593Smuzhiyun life of the server. Note that it's an array of pointers not 131*4882a593Smuzhiyun an array of structures. 132*4882a593Smuzhiyun */ 133*4882a593Smuzhiyun 134*4882a593Smuzhiyun extern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen, 135*4882a593Smuzhiyun int num_adaptors, 136*4882a593Smuzhiyun XF86MCAdaptorPtr * adaptors); 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void); 139*4882a593Smuzhiyun extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor); 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun #endif /* _XF86XVMC_H */ 142