~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/gallium/targets/libgl-xlib/xlib.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
 * 
 
3
 * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
 
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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 
17
 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
 
18
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
 
19
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
 
20
 * USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
 *
 
22
 * The above copyright notice and this permission notice (including the
 
23
 * next paragraph) shall be included in all copies or substantial portions
 
24
 * of the Software.
 
25
 * 
 
26
 * 
 
27
 **************************************************************************/
 
28
 
 
29
/*
 
30
 * Authors:
 
31
 *   Keith Whitwell
 
32
 */
 
33
#include "pipe/p_compiler.h"
 
34
#include "util/u_debug.h"
 
35
#include "target-helpers/wrap_screen.h"
 
36
#include "state_tracker/xlib_sw_winsys.h"
 
37
#include "xm_public.h"
 
38
 
 
39
#include "state_tracker/st_api.h"
 
40
#include "state_tracker/st_gl_api.h"
 
41
 
 
42
/* piggy back on this libGL for OpenGL support in EGL */
 
43
struct st_api *
 
44
st_api_create_OpenGL()
 
45
{
 
46
   return st_gl_api_create();
 
47
}
 
48
 
 
49
 
 
50
/* Helper function to choose and instantiate one of the software rasterizers:
 
51
 * cell, llvmpipe, softpipe.
 
52
 *
 
53
 * This function could be shared, but currently causes headaches for
 
54
 * the build systems, particularly scons if we try.  Long term, want
 
55
 * to avoid having global #defines for things like GALLIUM_LLVMPIPE,
 
56
 * GALLIUM_CELL, etc.  Scons already eliminates those #defines, so
 
57
 * things that are painful for it now are likely to be painful for
 
58
 * other build systems in the future.
 
59
 *
 
60
 * Copies (full or partial):
 
61
 *    targets/libgl-xlib
 
62
 *    targets/graw-xlib
 
63
 *    targets/dri-swrast
 
64
 *    winsys/sw/drm
 
65
 *    drivers/sw
 
66
 *
 
67
 */
 
68
 
 
69
#ifdef GALLIUM_SOFTPIPE
 
70
#include "softpipe/sp_public.h"
 
71
#endif
 
72
 
 
73
#ifdef GALLIUM_LLVMPIPE
 
74
#include "llvmpipe/lp_public.h"
 
75
#endif
 
76
 
 
77
#ifdef GALLIUM_CELL
 
78
#include "cell/ppu/cell_public.h"
 
79
#endif
 
80
 
 
81
#ifdef GALLIUM_GALAHAD
 
82
#include "galahad/glhd_public.h"
 
83
#endif
 
84
 
 
85
static struct pipe_screen *
 
86
swrast_create_screen(struct sw_winsys *winsys)
 
87
{
 
88
   const char *default_driver;
 
89
   const char *driver;
 
90
   struct pipe_screen *screen = NULL;
 
91
 
 
92
#if defined(GALLIUM_CELL)
 
93
   default_driver = "cell";
 
94
#elif defined(GALLIUM_LLVMPIPE)
 
95
   default_driver = "llvmpipe";
 
96
#elif defined(GALLIUM_SOFTPIPE)
 
97
   default_driver = "softpipe";
 
98
#else
 
99
   default_driver = "";
 
100
#endif
 
101
 
 
102
   driver = debug_get_option("GALLIUM_DRIVER", default_driver);
 
103
 
 
104
#if defined(GALLIUM_CELL)
 
105
   if (screen == NULL && strcmp(driver, "cell") == 0)
 
106
      screen = cell_create_screen( winsys );
 
107
#endif
 
108
 
 
109
#if defined(GALLIUM_LLVMPIPE)
 
110
   if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
 
111
      screen = llvmpipe_create_screen( winsys );
 
112
#endif
 
113
 
 
114
#if defined(GALLIUM_SOFTPIPE)
 
115
   if (screen == NULL)
 
116
      screen = softpipe_create_screen( winsys );
 
117
#endif
 
118
 
 
119
#if defined(GALLIUM_GALAHAD)
 
120
   if (screen) {
 
121
      struct pipe_screen *galahad_screen = galahad_screen_create(screen);
 
122
      if (galahad_screen)
 
123
         screen = galahad_screen;
 
124
   }
 
125
#endif
 
126
 
 
127
   return screen;
 
128
}
 
129
 
 
130
/* Helper function to build a subset of a driver stack consisting of
 
131
 * one of the software rasterizers (cell, llvmpipe, softpipe) and the
 
132
 * xlib winsys.
 
133
 */
 
134
static struct pipe_screen *
 
135
swrast_xlib_create_screen( Display *display )
 
136
{
 
137
   struct sw_winsys *winsys;
 
138
   struct pipe_screen *screen = NULL;
 
139
 
 
140
   /* Create the underlying winsys, which performs presents to Xlib
 
141
    * drawables:
 
142
    */
 
143
   winsys = xlib_create_sw_winsys( display );
 
144
   if (winsys == NULL)
 
145
      return NULL;
 
146
 
 
147
   /* Create a software rasterizer on top of that winsys:
 
148
    */
 
149
   screen = swrast_create_screen( winsys );
 
150
   if (screen == NULL)
 
151
      goto fail;
 
152
 
 
153
   /* Inject any wrapping layers we want to here:
 
154
    */
 
155
   return gallium_wrap_screen( screen );
 
156
 
 
157
fail:
 
158
   if (winsys)
 
159
      winsys->destroy( winsys );
 
160
 
 
161
   return NULL;
 
162
}
 
163
 
 
164
static struct xm_driver xlib_driver = 
 
165
{
 
166
   .create_pipe_screen = swrast_xlib_create_screen,
 
167
   .create_st_api = st_gl_api_create,
 
168
};
 
169
 
 
170
 
 
171
/* Build the rendering stack.
 
172
 */
 
173
static void _init( void ) __attribute__((constructor));
 
174
static void _init( void )
 
175
{
 
176
   /* Initialize the xlib libgl code, pass in the winsys:
 
177
    */
 
178
   xmesa_set_driver( &xlib_driver );
 
179
}
 
180
 
 
181
 
 
182
/***********************************************************************
 
183
 *
 
184
 * Butt-ugly hack to convince the linker not to throw away public GL
 
185
 * symbols (they are all referenced from getprocaddress, I guess).
 
186
 */
 
187
extern void (*linker_foo(const unsigned char *procName))();
 
188
extern void (*glXGetProcAddress(const unsigned char *procName))();
 
189
 
 
190
extern void (*linker_foo(const unsigned char *procName))()
 
191
{
 
192
   return glXGetProcAddress(procName);
 
193
}
 
194
 
 
195
 
 
196
/**
 
197
 * When GLX_INDIRECT_RENDERING is defined, some symbols are missing in
 
198
 * libglapi.a.  We need to define them here.
 
199
 */
 
200
#ifdef GLX_INDIRECT_RENDERING
 
201
 
 
202
#define GL_GLEXT_PROTOTYPES
 
203
#include "GL/gl.h"
 
204
#include "glapi/glapi.h"
 
205
#include "glapi/glapitable.h"
 
206
#include "glapi/glapidispatch.h"
 
207
 
 
208
#if defined(USE_MGL_NAMESPACE)
 
209
#define NAME(func)  mgl##func
 
210
#else
 
211
#define NAME(func)  gl##func
 
212
#endif
 
213
 
 
214
#define DISPATCH(FUNC, ARGS, MESSAGE)           \
 
215
   CALL_ ## FUNC(GET_DISPATCH(), ARGS);
 
216
 
 
217
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE)    \
 
218
   return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
 
219
 
 
220
/* skip normal ones */
 
221
#define _GLAPI_SKIP_NORMAL_ENTRY_POINTS
 
222
#include "glapi/glapitemp.h"
 
223
 
 
224
#endif /* GLX_INDIRECT_RENDERING */