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

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/util/u_framebuffer.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 2009-2010 VMware, Inc.  All Rights Reserved.
 
4
 *
 
5
 * Permission is hereby granted, free of charge, to any person obtaining a
 
6
 * copy of this software and associated documentation files (the
 
7
 * "Software"), to deal in the Software without restriction, including
 
8
 * without limitation the rights to use, copy, modify, merge, publish,
 
9
 * distribute, sub license, and/or sell copies of the Software, and to
 
10
 * permit persons to whom the Software is furnished to do so, subject to
 
11
 * the following conditions:
 
12
 *
 
13
 * The above copyright notice and this permission notice (including the
 
14
 * next paragraph) shall be included in all copies or substantial portions
 
15
 * of the Software.
 
16
 *
 
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
18
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
 
20
 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
 
21
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 
22
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 
23
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
24
 *
 
25
 **************************************************************************/
 
26
 
 
27
/**
 
28
 * @file
 
29
 * Framebuffer utility functions.
 
30
 *  
 
31
 * @author Brian Paul
 
32
 */
 
33
 
 
34
 
 
35
#include "pipe/p_screen.h"
 
36
#include "pipe/p_state.h"
 
37
#include "pipe/p_defines.h"
 
38
#include "util/u_inlines.h"
 
39
 
 
40
#include "util/u_memory.h"
 
41
#include "util/u_framebuffer.h"
 
42
 
 
43
 
 
44
/**
 
45
 * Compare pipe_framebuffer_state objects.
 
46
 * \return TRUE if same, FALSE if different
 
47
 */
 
48
boolean
 
49
util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst,
 
50
                             const struct pipe_framebuffer_state *src)
 
51
{
 
52
   unsigned i;
 
53
 
 
54
   if (dst->width != src->width ||
 
55
       dst->height != src->height)
 
56
      return FALSE;
 
57
 
 
58
   for (i = 0; i < Elements(src->cbufs); i++) {
 
59
      if (dst->cbufs[i] != src->cbufs[i]) {
 
60
         return FALSE;
 
61
      }
 
62
   }
 
63
 
 
64
   if (dst->nr_cbufs != src->nr_cbufs) {
 
65
      return FALSE;
 
66
   }
 
67
 
 
68
   if (dst->zsbuf != src->zsbuf) {
 
69
      return FALSE;
 
70
   }
 
71
 
 
72
   return TRUE;
 
73
}
 
74
 
 
75
 
 
76
/**
 
77
 * Copy framebuffer state from src to dst, updating refcounts.
 
78
 */
 
79
void
 
80
util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
 
81
                            const struct pipe_framebuffer_state *src)
 
82
{
 
83
   unsigned i;
 
84
 
 
85
   dst->width = src->width;
 
86
   dst->height = src->height;
 
87
 
 
88
   for (i = 0; i < src->nr_cbufs; i++)
 
89
      pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
 
90
 
 
91
   for (i = src->nr_cbufs; i < dst->nr_cbufs; i++)
 
92
      pipe_surface_reference(&dst->cbufs[i], NULL);
 
93
 
 
94
   dst->nr_cbufs = src->nr_cbufs;
 
95
 
 
96
   pipe_surface_reference(&dst->zsbuf, src->zsbuf);
 
97
}
 
98
 
 
99
 
 
100
void
 
101
util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb)
 
102
{
 
103
   unsigned i;
 
104
 
 
105
   for (i = 0; i < fb->nr_cbufs; i++) {
 
106
      pipe_surface_reference(&fb->cbufs[i], NULL);
 
107
   }
 
108
 
 
109
   pipe_surface_reference(&fb->zsbuf, NULL);
 
110
 
 
111
   fb->width = fb->height = 0;
 
112
   fb->nr_cbufs = 0;
 
113
}
 
114
 
 
115
 
 
116
/* Where multiple sizes are allowed for framebuffer surfaces, find the
 
117
 * minimum width and height of all bound surfaces.
 
118
 */
 
119
boolean
 
120
util_framebuffer_min_size(const struct pipe_framebuffer_state *fb,
 
121
                          unsigned *width,
 
122
                          unsigned *height)
 
123
{
 
124
   unsigned w = ~0;
 
125
   unsigned h = ~0;
 
126
   unsigned i;
 
127
 
 
128
   for (i = 0; i < fb->nr_cbufs; i++) {
 
129
      w = MIN2(w, fb->cbufs[i]->width);
 
130
      h = MIN2(h, fb->cbufs[i]->height);
 
131
   }
 
132
 
 
133
   if (fb->zsbuf) {
 
134
      w = MIN2(w, fb->zsbuf->width);
 
135
      h = MIN2(h, fb->zsbuf->height);
 
136
   }
 
137
 
 
138
   if (w == ~0) {
 
139
      *width = 0;
 
140
      *height = 0;
 
141
      return FALSE;
 
142
   }
 
143
   else {
 
144
      *width = w;
 
145
      *height = h;
 
146
      return TRUE;
 
147
   }
 
148
}