105b261ecSmrg
205b261ecSmrg/*
305b261ecSmrg * Copyright (c) 2001 by The XFree86 Project, Inc.
405b261ecSmrg *
505b261ecSmrg * Permission is hereby granted, free of charge, to any person obtaining a
605b261ecSmrg * copy of this software and associated documentation files (the "Software"),
705b261ecSmrg * to deal in the Software without restriction, including without limitation
805b261ecSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
905b261ecSmrg * and/or sell copies of the Software, and to permit persons to whom the
1005b261ecSmrg * Software is furnished to do so, subject to the following conditions:
1105b261ecSmrg *
1205b261ecSmrg * The above copyright notice and this permission notice shall be included in
1305b261ecSmrg * all copies or substantial portions of the Software.
1405b261ecSmrg *
1505b261ecSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1605b261ecSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1705b261ecSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1805b261ecSmrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1905b261ecSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2005b261ecSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2105b261ecSmrg * OTHER DEALINGS IN THE SOFTWARE.
2205b261ecSmrg *
2305b261ecSmrg * Except as contained in this notice, the name of the copyright holder(s)
2405b261ecSmrg * and author(s) shall not be used in advertising or otherwise to promote
2505b261ecSmrg * the sale, use or other dealings in this Software without prior written
2605b261ecSmrg * authorization from the copyright holder(s) and author(s).
2705b261ecSmrg */
2805b261ecSmrg
2905b261ecSmrg#ifndef _XF86XVMC_H
3005b261ecSmrg#define _XF86XVMC_H
3105b261ecSmrg
3205b261ecSmrg#include "xvmcext.h"
3305b261ecSmrg#include "xf86xv.h"
3405b261ecSmrg
3505b261ecSmrgtypedef struct {
3635c4bbdfSmrg    int num_xvimages;
3735c4bbdfSmrg    int *xvimage_ids;           /* reference the subpictures in the XF86MCAdaptorRec */
3835c4bbdfSmrg} XF86MCImageIDList;
3905b261ecSmrg
4005b261ecSmrgtypedef struct {
4135c4bbdfSmrg    int surface_type_id;        /* Driver generated.  Must be unique on the port */
4235c4bbdfSmrg    int chroma_format;
4335c4bbdfSmrg    int color_description;      /* no longer used */
4435c4bbdfSmrg    unsigned short max_width;
4535c4bbdfSmrg    unsigned short max_height;
4635c4bbdfSmrg    unsigned short subpicture_max_width;
4735c4bbdfSmrg    unsigned short subpicture_max_height;
4835c4bbdfSmrg    int mc_type;
4935c4bbdfSmrg    int flags;
5035c4bbdfSmrg    XF86MCImageIDList *compatible_subpictures;  /* can be null, if none */
5105b261ecSmrg} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr;
5205b261ecSmrg
5305b261ecSmrg/*
5435c4bbdfSmrg   xf86XvMCCreateContextProc
5505b261ecSmrg
5605b261ecSmrg   DIX will fill everything out in the context except the driver_priv.
5705b261ecSmrg   The port_priv holds the private data specified for the port when
5805b261ecSmrg   Xv was initialized by the driver.
5905b261ecSmrg   The driver may store whatever it wants in driver_priv and edit
6005b261ecSmrg   the width, height and flags.  If the driver wants to return something
6105b261ecSmrg   to the client it can allocate space in priv and specify the number
6205b261ecSmrg   of 32 bit words in num_priv.  This must be dynamically allocated
6305b261ecSmrg   space because DIX will free it after it passes it to the client.
6405b261ecSmrg*/
6505b261ecSmrg
6635c4bbdfSmrgtypedef int (*xf86XvMCCreateContextProcPtr) (ScrnInfoPtr pScrn,
6735c4bbdfSmrg                                             XvMCContextPtr context,
6835c4bbdfSmrg                                             int *num_priv, CARD32 **priv);
6905b261ecSmrg
7035c4bbdfSmrgtypedef void (*xf86XvMCDestroyContextProcPtr) (ScrnInfoPtr pScrn,
7135c4bbdfSmrg                                               XvMCContextPtr context);
7205b261ecSmrg
7305b261ecSmrg/*
7435c4bbdfSmrg   xf86XvMCCreateSurfaceProc
7505b261ecSmrg
7605b261ecSmrg   DIX will fill everything out in the surface except the driver_priv.
7705b261ecSmrg   The driver may store whatever it wants in driver_priv.  The driver
7805b261ecSmrg   may pass data back to the client in the same manner as the
7905b261ecSmrg   xf86XvMCCreateContextProc.
8005b261ecSmrg*/
8105b261ecSmrg
8235c4bbdfSmrgtypedef int (*xf86XvMCCreateSurfaceProcPtr) (ScrnInfoPtr pScrn,
8335c4bbdfSmrg                                             XvMCSurfacePtr surface,
8435c4bbdfSmrg                                             int *num_priv, CARD32 **priv);
8505b261ecSmrg
8635c4bbdfSmrgtypedef void (*xf86XvMCDestroySurfaceProcPtr) (ScrnInfoPtr pScrn,
8735c4bbdfSmrg                                               XvMCSurfacePtr surface);
8805b261ecSmrg
8905b261ecSmrg/*
9035c4bbdfSmrg   xf86XvMCCreateSubpictureProc
9105b261ecSmrg
9205b261ecSmrg   DIX will fill everything out in the subpicture except the driver_priv,
9305b261ecSmrg   num_palette_entries, entry_bytes and component_order.  The driver may
9405b261ecSmrg   store whatever it wants in driver_priv and edit the width and height.
9505b261ecSmrg   If it is a paletted subpicture the driver needs to fill out the
9605b261ecSmrg   num_palette_entries, entry_bytes and component_order.  These are
9705b261ecSmrg   not communicated to the client until the time the surface is
9805b261ecSmrg   created.
9905b261ecSmrg
10005b261ecSmrg   The driver may pass data back to the client in the same manner as the
10105b261ecSmrg   xf86XvMCCreateContextProc.
10205b261ecSmrg*/
10305b261ecSmrg
10435c4bbdfSmrgtypedef int (*xf86XvMCCreateSubpictureProcPtr) (ScrnInfoPtr pScrn,
10535c4bbdfSmrg                                                XvMCSubpicturePtr subpicture,
10635c4bbdfSmrg                                                int *num_priv, CARD32 **priv);
10705b261ecSmrg
10835c4bbdfSmrgtypedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn,
10935c4bbdfSmrg                                                  XvMCSubpicturePtr subpicture);
11005b261ecSmrg
11105b261ecSmrgtypedef struct {
11235c4bbdfSmrg    const char *name;
11335c4bbdfSmrg    int num_surfaces;
11435c4bbdfSmrg    XF86MCSurfaceInfoPtr *surfaces;
11535c4bbdfSmrg    int num_subpictures;
11635c4bbdfSmrg    XF86ImagePtr *subpictures;
11735c4bbdfSmrg    xf86XvMCCreateContextProcPtr CreateContext;
11835c4bbdfSmrg    xf86XvMCDestroyContextProcPtr DestroyContext;
11935c4bbdfSmrg    xf86XvMCCreateSurfaceProcPtr CreateSurface;
12035c4bbdfSmrg    xf86XvMCDestroySurfaceProcPtr DestroySurface;
12135c4bbdfSmrg    xf86XvMCCreateSubpictureProcPtr CreateSubpicture;
12235c4bbdfSmrg    xf86XvMCDestroySubpictureProcPtr DestroySubpicture;
12305b261ecSmrg} XF86MCAdaptorRec, *XF86MCAdaptorPtr;
12405b261ecSmrg
12535c4bbdfSmrg/*
12635c4bbdfSmrg   xf86XvMCScreenInit
12705b261ecSmrg
12805b261ecSmrg   Unlike Xv, the adaptor data is not copied from this structure.
12905b261ecSmrg   This structure's data is used so it must stick around for the
13005b261ecSmrg   life of the server.  Note that it's an array of pointers not
13105b261ecSmrg   an array of structures.
13205b261ecSmrg*/
13305b261ecSmrg
13435c4bbdfSmrgextern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen,
13535c4bbdfSmrg                                         int num_adaptors,
13635c4bbdfSmrg                                         XF86MCAdaptorPtr * adaptors);
13705b261ecSmrg
13835c4bbdfSmrgextern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void);
1396747b715Smrgextern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
1406747b715Smrg
14135c4bbdfSmrg#endif                          /* _XF86XVMC_H */
142