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