Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / gallium / winsys / drm / intel / dri / intel_screen.h
1 /**************************************************************************
2 *
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef _INTEL_SCREEN_H_
29 #define _INTEL_SCREEN_H_
30
31 #include "dri_util.h"
32 #include "i830_common.h"
33 #include "xmlconfig.h"
34 #include "ws_dri_bufpool.h"
35
36 #include "pipe/p_compiler.h"
37
38 #include "intel_be_device.h"
39
40 struct intel_screen
41 {
42 struct intel_be_device base;
43
44 struct {
45 drm_handle_t handle;
46
47 /* We create a static dri buffer for the frontbuffer.
48 */
49 struct _DriBufferObject *buffer;
50 struct pipe_surface *surface;
51 struct pipe_texture *texture;
52
53 char *map; /* memory map */
54 int offset; /* from start of video mem, in bytes */
55 int pitch; /* row stride, in bytes */
56 int width;
57 int height;
58 int size;
59 int cpp; /* for front and back buffers */
60 } front;
61
62 int deviceID;
63 int drmMinor;
64
65 drmI830Sarea *sarea;
66
67 /**
68 * Configuration cache with default values for all contexts
69 */
70 driOptionCache optionCache;
71
72 boolean havePools;
73
74 /**
75 * Temporary(?) context to use for SwapBuffers or other situations in
76 * which we need a rendering context, but none is currently bound.
77 */
78 struct intel_context *dummyContext;
79
80 /*
81 * New stuff form the i915tex integration
82 */
83 unsigned batch_id;
84
85
86 struct pipe_winsys *winsys;
87 };
88
89
90
91 /** cast wrapper */
92 static INLINE struct intel_screen *
93 intel_screen(__DRIscreenPrivate *sPriv)
94 {
95 return (struct intel_screen *) sPriv->private;
96 }
97
98
99 extern void
100 intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea);
101
102
103 extern void intelDestroyContext(__DRIcontextPrivate * driContextPriv);
104
105 extern boolean intelUnbindContext(__DRIcontextPrivate * driContextPriv);
106
107 extern boolean
108 intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
109 __DRIdrawablePrivate * driDrawPriv,
110 __DRIdrawablePrivate * driReadPriv);
111
112
113 extern boolean
114 intelCreatePools(__DRIscreenPrivate *sPriv);
115
116 extern boolean
117 intelCreateContext(const __GLcontextModes * visual,
118 __DRIcontextPrivate * driContextPriv,
119 void *sharedContextPrivate);
120
121
122 #endif