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

« back to all changes in this revision

Viewing changes to src/glx/apple/glxreply.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
 * (C) Copyright Apple Inc. 2008
 
3
 * (C) Copyright IBM Corporation 2004, 2005
 
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 "Software"),
 
8
 * to deal in the Software without restriction, including without limitation
 
9
 * the rights to use, copy, modify, merge, publish, distribute, sub license,
 
10
 * and/or sell copies of the Software, and to permit persons to whom the
 
11
 * Software is furnished to do so, subject to the following conditions:
 
12
 * 
 
13
 * The above copyright notice and this permission notice (including the next
 
14
 * paragraph) shall be included in all copies or substantial portions of the
 
15
 * Software.
 
16
 * 
 
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
18
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
 
20
 * IBM,
 
21
 * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
22
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 
23
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
24
 * SOFTWARE.
 
25
 */
 
26
 
 
27
#include <GL/gl.h>
 
28
#include "glxclient.h"
 
29
#include <GL/glxproto.h>
 
30
 
 
31
CARD32
 
32
__glXReadReply(Display * dpy, size_t size, void *dest,
 
33
               GLboolean reply_is_always_array)
 
34
{
 
35
   xGLXSingleReply reply;
 
36
 
 
37
   (void) _XReply(dpy, (xReply *) & reply, 0, False);
 
38
   if (size != 0) {
 
39
      if ((reply.length > 0) || reply_is_always_array) {
 
40
         const GLint bytes = (reply_is_always_array)
 
41
            ? (4 * reply.length) : (reply.size * size);
 
42
         const GLint extra = 4 - (bytes & 3);
 
43
 
 
44
         _XRead(dpy, dest, bytes);
 
45
         if (extra < 4) {
 
46
            _XEatData(dpy, extra);
 
47
         }
 
48
      }
 
49
      else {
 
50
         (void) memcpy(dest, &(reply.pad3), size);
 
51
      }
 
52
   }
 
53
 
 
54
   return reply.retval;
 
55
}
 
56
 
 
57
void
 
58
__glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim,
 
59
                    GLint width, GLint height, GLint depth, GLenum format,
 
60
                    GLenum type, void *dest, GLboolean dimensions_in_reply)
 
61
{
 
62
   xGLXSingleReply reply;
 
63
   GLint size;
 
64
 
 
65
   (void) _XReply(dpy, (xReply *) & reply, 0, False);
 
66
 
 
67
   if (dimensions_in_reply) {
 
68
      width = reply.pad3;
 
69
      height = reply.pad4;
 
70
      depth = reply.pad5;
 
71
 
 
72
      if ((height == 0) || (max_dim < 2)) {
 
73
         height = 1;
 
74
      }
 
75
      if ((depth == 0) || (max_dim < 3)) {
 
76
         depth = 1;
 
77
      }
 
78
   }
 
79
 
 
80
   size = reply.length * 4;
 
81
   if (size != 0) {
 
82
      void *buf = Xmalloc(size);
 
83
 
 
84
      if (buf == NULL) {
 
85
         _XEatData(dpy, size);
 
86
         __glXSetError(gc, GL_OUT_OF_MEMORY);
 
87
      }
 
88
      else {
 
89
         const GLint extra = 4 - (size & 3);
 
90
 
 
91
         _XRead(dpy, buf, size);
 
92
         if (extra < 4) {
 
93
            _XEatData(dpy, extra);
 
94
         }
 
95
 
 
96
         __glEmptyImage(gc, 3, width, height, depth, format, type, buf, dest);
 
97
         Xfree(buf);
 
98
      }
 
99
   }
 
100
}
 
101
 
 
102
#if 0
 
103
GLubyte *
 
104
__glXSetupSingleRequest(struct glx_context * gc, GLint sop, GLint cmdlen)
 
105
{
 
106
   xGLXSingleReq *req;
 
107
   Display *const dpy = gc->currentDpy;
 
108
 
 
109
   (void) __glXFlushRenderBuffer(gc, gc->pc);
 
110
   LockDisplay(dpy);
 
111
   GetReqExtra(GLXSingle, cmdlen, req);
 
112
   req->reqType = gc->majorOpcode;
 
113
   req->contextTag = gc->currentContextTag;
 
114
   req->glxCode = sop;
 
115
   return (GLubyte *) (req) + sz_xGLXSingleReq;
 
116
}
 
117
#endif
 
118
 
 
119
GLubyte *
 
120
__glXSetupVendorRequest(struct glx_context * gc, GLint code, GLint vop,
 
121
                        GLint cmdlen)
 
122
{
 
123
   xGLXVendorPrivateReq *req;
 
124
   Display *const dpy = gc->currentDpy;
 
125
 
 
126
   (void) __glXFlushRenderBuffer(gc, gc->pc);
 
127
   LockDisplay(dpy);
 
128
   GetReqExtra(GLXVendorPrivate, cmdlen, req);
 
129
   req->reqType = gc->majorOpcode;
 
130
   req->glxCode = code;
 
131
   req->vendorCode = vop;
 
132
   req->contextTag = gc->currentContextTag;
 
133
   return (GLubyte *) (req) + sz_xGLXVendorPrivateReq;
 
134
}