1706f2543Smrg
2706f2543Smrg/*
3706f2543Smrg * Copyright (c) 2001 by The XFree86 Project, Inc.
4706f2543Smrg *
5706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a
6706f2543Smrg * copy of this software and associated documentation files (the "Software"),
7706f2543Smrg * to deal in the Software without restriction, including without limitation
8706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the
10706f2543Smrg * Software is furnished to do so, subject to the following conditions:
11706f2543Smrg *
12706f2543Smrg * The above copyright notice and this permission notice shall be included in
13706f2543Smrg * all copies or substantial portions of the Software.
14706f2543Smrg *
15706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16706f2543Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18706f2543Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19706f2543Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20706f2543Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21706f2543Smrg * OTHER DEALINGS IN THE SOFTWARE.
22706f2543Smrg *
23706f2543Smrg * Except as contained in this notice, the name of the copyright holder(s)
24706f2543Smrg * and author(s) shall not be used in advertising or otherwise to promote
25706f2543Smrg * the sale, use or other dealings in this Software without prior written
26706f2543Smrg * authorization from the copyright holder(s) and author(s).
27706f2543Smrg */
28706f2543Smrg
29706f2543Smrg#ifndef _XF86XVMC_H
30706f2543Smrg#define _XF86XVMC_H
31706f2543Smrg
32706f2543Smrg#include "xvmcext.h"
33706f2543Smrg#include "xf86xv.h"
34706f2543Smrg
35706f2543Smrgtypedef struct {
36706f2543Smrg  int num_xvimages;
37706f2543Smrg  int *xvimage_ids;  /* reference the subpictures in the XF86MCAdaptorRec */
38706f2543Smrg} XF86MCImageIDList;
39706f2543Smrg
40706f2543Smrgtypedef struct {
41706f2543Smrg  int surface_type_id;  /* Driver generated.  Must be unique on the port */
42706f2543Smrg  int chroma_format;
43706f2543Smrg  int color_description;  /* no longer used */
44706f2543Smrg  unsigned short max_width;
45706f2543Smrg  unsigned short max_height;
46706f2543Smrg  unsigned short subpicture_max_width;
47706f2543Smrg  unsigned short subpicture_max_height;
48706f2543Smrg  int mc_type;
49706f2543Smrg  int flags;
50706f2543Smrg  XF86MCImageIDList *compatible_subpictures; /* can be null, if none */
51706f2543Smrg} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr;
52706f2543Smrg
53706f2543Smrg
54706f2543Smrg/*
55706f2543Smrg   xf86XvMCCreateContextProc
56706f2543Smrg
57706f2543Smrg   DIX will fill everything out in the context except the driver_priv.
58706f2543Smrg   The port_priv holds the private data specified for the port when
59706f2543Smrg   Xv was initialized by the driver.
60706f2543Smrg   The driver may store whatever it wants in driver_priv and edit
61706f2543Smrg   the width, height and flags.  If the driver wants to return something
62706f2543Smrg   to the client it can allocate space in priv and specify the number
63706f2543Smrg   of 32 bit words in num_priv.  This must be dynamically allocated
64706f2543Smrg   space because DIX will free it after it passes it to the client.
65706f2543Smrg*/
66706f2543Smrg
67706f2543Smrg
68706f2543Smrgtypedef int (*xf86XvMCCreateContextProcPtr) (
69706f2543Smrg  ScrnInfoPtr pScrn,
70706f2543Smrg  XvMCContextPtr context,
71706f2543Smrg  int *num_priv,
72706f2543Smrg  CARD32 **priv
73706f2543Smrg);
74706f2543Smrg
75706f2543Smrgtypedef void (*xf86XvMCDestroyContextProcPtr) (
76706f2543Smrg  ScrnInfoPtr pScrn,
77706f2543Smrg  XvMCContextPtr context
78706f2543Smrg);
79706f2543Smrg
80706f2543Smrg/*
81706f2543Smrg   xf86XvMCCreateSurfaceProc
82706f2543Smrg
83706f2543Smrg   DIX will fill everything out in the surface except the driver_priv.
84706f2543Smrg   The driver may store whatever it wants in driver_priv.  The driver
85706f2543Smrg   may pass data back to the client in the same manner as the
86706f2543Smrg   xf86XvMCCreateContextProc.
87706f2543Smrg*/
88706f2543Smrg
89706f2543Smrg
90706f2543Smrgtypedef int (*xf86XvMCCreateSurfaceProcPtr) (
91706f2543Smrg  ScrnInfoPtr pScrn,
92706f2543Smrg  XvMCSurfacePtr surface,
93706f2543Smrg  int *num_priv,
94706f2543Smrg  CARD32 **priv
95706f2543Smrg);
96706f2543Smrg
97706f2543Smrgtypedef void (*xf86XvMCDestroySurfaceProcPtr) (
98706f2543Smrg  ScrnInfoPtr pScrn,
99706f2543Smrg  XvMCSurfacePtr surface
100706f2543Smrg);
101706f2543Smrg
102706f2543Smrg/*
103706f2543Smrg   xf86XvMCCreateSubpictureProc
104706f2543Smrg
105706f2543Smrg   DIX will fill everything out in the subpicture except the driver_priv,
106706f2543Smrg   num_palette_entries, entry_bytes and component_order.  The driver may
107706f2543Smrg   store whatever it wants in driver_priv and edit the width and height.
108706f2543Smrg   If it is a paletted subpicture the driver needs to fill out the
109706f2543Smrg   num_palette_entries, entry_bytes and component_order.  These are
110706f2543Smrg   not communicated to the client until the time the surface is
111706f2543Smrg   created.
112706f2543Smrg
113706f2543Smrg   The driver may pass data back to the client in the same manner as the
114706f2543Smrg   xf86XvMCCreateContextProc.
115706f2543Smrg*/
116706f2543Smrg
117706f2543Smrg
118706f2543Smrgtypedef int (*xf86XvMCCreateSubpictureProcPtr) (
119706f2543Smrg  ScrnInfoPtr pScrn,
120706f2543Smrg  XvMCSubpicturePtr subpicture,
121706f2543Smrg  int *num_priv,
122706f2543Smrg  CARD32 **priv
123706f2543Smrg);
124706f2543Smrg
125706f2543Smrgtypedef void (*xf86XvMCDestroySubpictureProcPtr) (
126706f2543Smrg  ScrnInfoPtr pScrn,
127706f2543Smrg  XvMCSubpicturePtr subpicture
128706f2543Smrg);
129706f2543Smrg
130706f2543Smrg
131706f2543Smrgtypedef struct {
13266a34d92Schristos  const char *name;
133706f2543Smrg  int num_surfaces;
134706f2543Smrg  XF86MCSurfaceInfoPtr *surfaces;
135706f2543Smrg  int num_subpictures;
136706f2543Smrg  XF86ImagePtr *subpictures;
137706f2543Smrg  xf86XvMCCreateContextProcPtr 		CreateContext;
138706f2543Smrg  xf86XvMCDestroyContextProcPtr		DestroyContext;
139706f2543Smrg  xf86XvMCCreateSurfaceProcPtr 		CreateSurface;
140706f2543Smrg  xf86XvMCDestroySurfaceProcPtr		DestroySurface;
141706f2543Smrg  xf86XvMCCreateSubpictureProcPtr	CreateSubpicture;
142706f2543Smrg  xf86XvMCDestroySubpictureProcPtr	DestroySubpicture;
143706f2543Smrg} XF86MCAdaptorRec, *XF86MCAdaptorPtr;
144706f2543Smrg
145706f2543Smrg/*
146706f2543Smrg   xf86XvMCScreenInit
147706f2543Smrg
148706f2543Smrg   Unlike Xv, the adaptor data is not copied from this structure.
149706f2543Smrg   This structure's data is used so it must stick around for the
150706f2543Smrg   life of the server.  Note that it's an array of pointers not
151706f2543Smrg   an array of structures.
152706f2543Smrg*/
153706f2543Smrg
154706f2543Smrgextern _X_EXPORT Bool xf86XvMCScreenInit(
155706f2543Smrg  ScreenPtr pScreen,
156706f2543Smrg  int num_adaptors,
157706f2543Smrg  XF86MCAdaptorPtr *adaptors
158706f2543Smrg);
159706f2543Smrg
160706f2543Smrgextern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void);
161706f2543Smrgextern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
162706f2543Smrg
163706f2543Smrgtypedef int (*XvMCScreenInitProcPtr)(ScreenPtr, int, XvMCAdaptorPtr);
164706f2543Smrgextern _X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc;
165706f2543Smrg
166706f2543Smrg#endif /* _XF86XVMC_H */
167