1/**************************************************************************
2
3   Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
4   Copyright (c) 2002-2012 Apple Computer, Inc.
5   All Rights Reserved.
6
7   Permission is hereby granted, free of charge, to any person obtaining a
8   copy of this software and associated documentation files (the
9   "Software"), to deal in the Software without restriction, including
10   without limitation the rights to use, copy, modify, merge, publish,
11   distribute, sub license, and/or sell copies of the Software, and to
12   permit persons to whom the Software is furnished to do so, subject to
13   the following conditions:
14
15   The above copyright notice and this permission notice (including the
16   next paragraph) shall be included in all copies or substantial portions
17   of the Software.
18
19   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22   IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23   ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27**************************************************************************/
28
29/*
30 * Authors:
31 *   Jens Owen <jens@precisioninsight.com>
32 *   Jeremy Huddleston <jeremyhu@apple.com>
33 */
34
35/* Prototypes for AppleDRI functions */
36
37#ifndef _DRI_H_
38#define _DRI_H_
39
40#include <X11/Xdefs.h>
41#include "scrnintstr.h"
42#define _APPLEDRI_SERVER_
43#include "appledri.h"
44#include <Xplugin.h>
45
46typedef void (*ClipNotifyPtr)(WindowPtr, int, int);
47
48/*
49 * These functions can be wrapped by the DRI.  Each of these have
50 * generic default funcs (initialized in DRICreateInfoRec) and can be
51 * overridden by the driver in its [driver]DRIScreenInit function.
52 */
53typedef struct {
54    CopyWindowProcPtr CopyWindow;
55    ClipNotifyProcPtr ClipNotify;
56} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
57
58typedef struct {
59    xp_surface_id id;
60    int kind;
61} DRISurfaceNotifyArg;
62
63extern Bool
64DRIScreenInit(ScreenPtr pScreen);
65
66extern Bool
67DRIFinishScreenInit(ScreenPtr pScreen);
68
69extern void
70DRICloseScreen(ScreenPtr pScreen);
71
72extern Bool
73DRIExtensionInit(void);
74
75extern void
76DRIReset(void);
77
78extern Bool
79DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable);
80
81extern Bool
82DRIAuthConnection(ScreenPtr pScreen, unsigned int magic);
83
84extern Bool DRICreateSurface(ScreenPtr pScreen,
85                             Drawable id,
86                             DrawablePtr pDrawable,
87                             xp_client_id client_id,
88                             xp_surface_id * surface_id,
89                             unsigned int key[2],
90                             void (*notify)(void *arg, void *data),
91                             void *notify_data);
92
93extern Bool
94DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
95                  void (*notify)(void *arg,
96                                 void *data), void *notify_data);
97
98extern Bool
99DRIDrawablePrivDelete(void *pResource, XID id);
100
101extern DRIWrappedFuncsRec *
102DRIGetWrappedFuncs(ScreenPtr pScreen);
103
104extern void
105DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
106
107extern void
108DRIClipNotify(WindowPtr pWin, int dx, int dy);
109
110extern void
111DRISurfaceNotify(xp_surface_id id, int kind);
112
113extern void
114DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion);
115
116extern Bool
117DRICreatePixmap(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
118                char *path,
119                size_t pathmax);
120
121extern Bool
122DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height, int *pitch,
123                 int *bpp,
124                 void **ptr);
125
126extern void
127DRIDestroyPixmap(DrawablePtr pDrawable);
128
129#endif
130