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

« back to all changes in this revision

Viewing changes to src/egl/main/eglsurface.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:
30
30
}
31
31
 
32
32
 
 
33
#ifdef EGL_MESA_screen_surface
 
34
static EGLint
 
35
_eglParseScreenSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
 
36
{
 
37
   EGLint i, err = EGL_SUCCESS;
 
38
 
 
39
   if (!attrib_list)
 
40
      return EGL_SUCCESS;
 
41
 
 
42
   for (i = 0; attrib_list[i] != EGL_NONE; i++) {
 
43
      EGLint attr = attrib_list[i++];
 
44
      EGLint val = attrib_list[i];
 
45
 
 
46
      switch (attr) {
 
47
      case EGL_WIDTH:
 
48
         if (val < 0) {
 
49
            err = EGL_BAD_PARAMETER;
 
50
            break;
 
51
         }
 
52
         surf->Width = val;
 
53
         break;
 
54
      case EGL_HEIGHT:
 
55
         if (val < 0) {
 
56
            err = EGL_BAD_PARAMETER;
 
57
            break;
 
58
         }
 
59
         surf->Height = val;
 
60
         break;
 
61
      default:
 
62
         err = EGL_BAD_ATTRIBUTE;
 
63
         break;
 
64
      }
 
65
 
 
66
      if (err != EGL_SUCCESS) {
 
67
         _eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr);
 
68
         break;
 
69
      }
 
70
   }
 
71
 
 
72
   return err;
 
73
}
 
74
#endif /* EGL_MESA_screen_surface */
 
75
 
 
76
 
33
77
/**
34
78
 * Parse the list of surface attributes and return the proper error code.
35
79
 */
36
80
static EGLint
37
81
_eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
38
82
{
 
83
   _EGLDisplay *dpy = surf->Resource.Display;
39
84
   EGLint type = surf->Type;
 
85
   EGLint texture_type = EGL_PBUFFER_BIT;
40
86
   EGLint i, err = EGL_SUCCESS;
41
87
 
42
88
   if (!attrib_list)
43
89
      return EGL_SUCCESS;
44
90
 
 
91
#ifdef EGL_MESA_screen_surface
 
92
   if (type == EGL_SCREEN_BIT_MESA)
 
93
      return _eglParseScreenSurfaceAttribList(surf, attrib_list);
 
94
#endif
 
95
 
 
96
   if (dpy->Extensions.NOK_texture_from_pixmap)
 
97
      texture_type |= EGL_PIXMAP_BIT;
 
98
 
45
99
   for (i = 0; attrib_list[i] != EGL_NONE; i++) {
46
100
      EGLint attr = attrib_list[i++];
47
101
      EGLint val = attrib_list[i];
48
102
 
49
103
      switch (attr) {
50
 
      /* common (except for screen surfaces) attributes */
 
104
      /* common attributes */
51
105
      case EGL_VG_COLORSPACE:
52
 
         if (type == EGL_SCREEN_BIT_MESA) {
53
 
            err = EGL_BAD_ATTRIBUTE;
54
 
            break;
55
 
         }
56
106
         switch (val) {
57
107
         case EGL_VG_COLORSPACE_sRGB:
58
108
         case EGL_VG_COLORSPACE_LINEAR:
66
116
         surf->VGColorspace = val;
67
117
         break;
68
118
      case EGL_VG_ALPHA_FORMAT:
69
 
         if (type == EGL_SCREEN_BIT_MESA) {
70
 
            err = EGL_BAD_ATTRIBUTE;
71
 
            break;
72
 
         }
73
119
         switch (val) {
74
120
         case EGL_VG_ALPHA_FORMAT_NONPRE:
75
121
         case EGL_VG_ALPHA_FORMAT_PRE:
96
142
         break;
97
143
      /* pbuffer surface attributes */
98
144
      case EGL_WIDTH:
99
 
         if (type != EGL_PBUFFER_BIT && type != EGL_SCREEN_BIT_MESA) {
 
145
         if (type != EGL_PBUFFER_BIT) {
100
146
            err = EGL_BAD_ATTRIBUTE;
101
147
            break;
102
148
         }
107
153
         surf->Width = val;
108
154
         break;
109
155
      case EGL_HEIGHT:
110
 
         if (type != EGL_PBUFFER_BIT && type != EGL_SCREEN_BIT_MESA) {
 
156
         if (type != EGL_PBUFFER_BIT) {
111
157
            err = EGL_BAD_ATTRIBUTE;
112
158
            break;
113
159
         }
124
170
         }
125
171
         surf->LargestPbuffer = !!val;
126
172
         break;
 
173
      /* for eglBindTexImage */
127
174
      case EGL_TEXTURE_FORMAT:
128
 
         if (type != EGL_PBUFFER_BIT) {
 
175
         if (!(type & texture_type)) {
129
176
            err = EGL_BAD_ATTRIBUTE;
130
177
            break;
131
178
         }
143
190
         surf->TextureFormat = val;
144
191
         break;
145
192
      case EGL_TEXTURE_TARGET:
146
 
         if (type != EGL_PBUFFER_BIT) {
 
193
         if (!(type & texture_type)) {
147
194
            err = EGL_BAD_ATTRIBUTE;
148
195
            break;
149
196
         }
160
207
         surf->TextureTarget = val;
161
208
         break;
162
209
      case EGL_MIPMAP_TEXTURE:
163
 
         if (type != EGL_PBUFFER_BIT) {
 
210
         if (!(type & texture_type)) {
164
211
            err = EGL_BAD_ATTRIBUTE;
165
212
            break;
166
213
         }
205
252
   case EGL_PBUFFER_BIT:
206
253
      func = "eglCreatePBufferSurface";
207
254
      break;
 
255
#ifdef EGL_MESA_screen_surface
208
256
   case EGL_SCREEN_BIT_MESA:
209
257
      func = "eglCreateScreenSurface";
210
258
      renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
211
259
      break;
 
260
#endif
212
261
   default:
213
262
      _eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
214
263
      return EGL_FALSE;
452
501
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
453
502
                 EGLint buffer)
454
503
{
 
504
   EGLint texture_type = EGL_PBUFFER_BIT;
 
505
 
455
506
   /* Just do basic error checking and return success/fail.
456
507
    * Drivers must implement the real stuff.
457
508
    */
458
509
 
459
 
   if (surface->Type != EGL_PBUFFER_BIT) {
 
510
   if (dpy->Extensions.NOK_texture_from_pixmap)
 
511
      texture_type |= EGL_PIXMAP_BIT;
 
512
 
 
513
   if (!(surface->Type & texture_type)) {
460
514
      _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
461
515
      return EGL_FALSE;
462
516
   }
466
520
      return EGL_FALSE;
467
521
   }
468
522
 
 
523
   if (surface->TextureTarget == EGL_NO_TEXTURE) {
 
524
      _eglError(EGL_BAD_MATCH, "eglBindTexImage");
 
525
      return EGL_FALSE;
 
526
   }
 
527
 
469
528
   if (buffer != EGL_BACK_BUFFER) {
470
529
      _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
471
530
      return EGL_FALSE;