initial commit
[profile/ivi/xorg-x11-server.git] / hw / xfree86 / common / xf86xvmc.h
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 /*
55    xf86XvMCCreateContextProc 
56
57    DIX will fill everything out in the context except the driver_priv.
58    The port_priv holds the private data specified for the port when
59    Xv was initialized by the driver.
60    The driver may store whatever it wants in driver_priv and edit
61    the width, height and flags.  If the driver wants to return something
62    to the client it can allocate space in priv and specify the number
63    of 32 bit words in num_priv.  This must be dynamically allocated
64    space because DIX will free it after it passes it to the client.
65 */
66    
67
68 typedef int (*xf86XvMCCreateContextProcPtr) (
69   ScrnInfoPtr pScrn,
70   XvMCContextPtr context,
71   int *num_priv,
72   CARD32 **priv 
73 );
74
75 typedef void (*xf86XvMCDestroyContextProcPtr) (
76   ScrnInfoPtr pScrn,
77   XvMCContextPtr context
78 );
79
80 /*
81    xf86XvMCCreateSurfaceProc 
82
83    DIX will fill everything out in the surface except the driver_priv.
84    The driver may store whatever it wants in driver_priv.  The driver
85    may pass data back to the client in the same manner as the
86    xf86XvMCCreateContextProc.
87 */
88
89
90 typedef int (*xf86XvMCCreateSurfaceProcPtr) (
91   ScrnInfoPtr pScrn,
92   XvMCSurfacePtr surface,
93   int *num_priv,
94   CARD32 **priv
95 );
96
97 typedef void (*xf86XvMCDestroySurfaceProcPtr) (
98   ScrnInfoPtr pScrn,
99   XvMCSurfacePtr surface
100 );
101
102 /*
103    xf86XvMCCreateSubpictureProc 
104
105    DIX will fill everything out in the subpicture except the driver_priv,
106    num_palette_entries, entry_bytes and component_order.  The driver may
107    store whatever it wants in driver_priv and edit the width and height.
108    If it is a paletted subpicture the driver needs to fill out the
109    num_palette_entries, entry_bytes and component_order.  These are
110    not communicated to the client until the time the surface is
111    created.
112
113    The driver may pass data back to the client in the same manner as the
114    xf86XvMCCreateContextProc.
115 */
116
117
118 typedef int (*xf86XvMCCreateSubpictureProcPtr) (
119   ScrnInfoPtr pScrn,
120   XvMCSubpicturePtr subpicture,
121   int *num_priv,
122   CARD32 **priv
123 );
124
125 typedef void (*xf86XvMCDestroySubpictureProcPtr) (
126   ScrnInfoPtr pScrn,
127   XvMCSubpicturePtr subpicture
128 );
129
130
131 typedef struct {
132   char *name;
133   int num_surfaces;
134   XF86MCSurfaceInfoPtr *surfaces;
135   int num_subpictures;
136   XF86ImagePtr *subpictures;
137   xf86XvMCCreateContextProcPtr          CreateContext; 
138   xf86XvMCDestroyContextProcPtr         DestroyContext; 
139   xf86XvMCCreateSurfaceProcPtr          CreateSurface; 
140   xf86XvMCDestroySurfaceProcPtr         DestroySurface; 
141   xf86XvMCCreateSubpictureProcPtr       CreateSubpicture; 
142   xf86XvMCDestroySubpictureProcPtr      DestroySubpicture; 
143 } XF86MCAdaptorRec, *XF86MCAdaptorPtr;
144
145 /* 
146    xf86XvMCScreenInit 
147
148    Unlike Xv, the adaptor data is not copied from this structure.
149    This structure's data is used so it must stick around for the
150    life of the server.  Note that it's an array of pointers not
151    an array of structures.
152 */
153
154 extern _X_EXPORT Bool xf86XvMCScreenInit(
155   ScreenPtr pScreen, 
156   int num_adaptors,
157   XF86MCAdaptorPtr *adaptors
158 );
159
160 extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void);
161 extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
162
163 typedef int (*XvMCScreenInitProcPtr)(ScreenPtr, int, XvMCAdaptorPtr);
164 extern _X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc;
165
166 #endif /* _XF86XVMC_H */