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

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/util/u_surfaces.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 2010 Luca Barbieri
 
4
 *
 
5
 * Permission is hereby granted, free of charge, to any person obtaining
 
6
 * a 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, sublicense, 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
 
15
 * portions of the Software.
 
16
 *
 
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
18
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
20
 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
 
21
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 
22
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 
23
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
24
 *
 
25
 **************************************************************************/
 
26
 
 
27
#include "u_surfaces.h"
 
28
#include "util/u_hash_table.h"
 
29
#include "util/u_inlines.h"
 
30
#include "util/u_memory.h"
 
31
 
 
32
struct pipe_surface *
 
33
util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags)
 
34
{
 
35
   struct pipe_surface *ps;
 
36
 
 
37
   if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
 
38
   {    /* or 2D array */
 
39
      if(!us->u.hash)
 
40
         us->u.hash = cso_hash_create();
 
41
 
 
42
      ps = cso_hash_iter_data(cso_hash_find(us->u.hash, ((zslice + face) << 8) | level));
 
43
   }
 
44
   else
 
45
   {
 
46
      if(!us->u.array)
 
47
         us->u.array = CALLOC(pt->last_level + 1, sizeof(struct pipe_surface *));
 
48
      ps = us->u.array[level];
 
49
   }
 
50
 
 
51
   if(ps)
 
52
   {
 
53
      p_atomic_inc(&ps->reference.count);
 
54
      return ps;
 
55
   }
 
56
 
 
57
   ps = (struct pipe_surface *)CALLOC(1, surface_struct_size);
 
58
   if(!ps)
 
59
      return NULL;
 
60
 
 
61
   pipe_surface_init(ps, pt, face, level, zslice, flags);
 
62
   ps->offset = ~0;
 
63
 
 
64
   if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
 
65
      cso_hash_insert(us->u.hash, ((zslice + face) << 8) | level, ps);
 
66
   else
 
67
      us->u.array[level] = ps;
 
68
 
 
69
   return ps;
 
70
}
 
71
 
 
72
void
 
73
util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps)
 
74
{
 
75
   struct pipe_resource *pt = ps->texture;
 
76
   if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
 
77
   {    /* or 2D array */
 
78
      cso_hash_erase(us->u.hash, cso_hash_find(us->u.hash, ((ps->zslice + ps->face) << 8) | ps->level));
 
79
   }
 
80
   else
 
81
      us->u.array[ps->level] = 0;
 
82
}
 
83
 
 
84
void
 
85
util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *))
 
86
{
 
87
   if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
 
88
   {    /* or 2D array */
 
89
      if(us->u.hash)
 
90
      {
 
91
         struct cso_hash_iter iter;
 
92
         iter = cso_hash_first_node(us->u.hash);
 
93
         while (!cso_hash_iter_is_null(iter)) {
 
94
            destroy_surface(cso_hash_iter_data(iter));
 
95
            iter = cso_hash_iter_next(iter);
 
96
         }
 
97
 
 
98
         cso_hash_delete(us->u.hash);
 
99
         us->u.hash = NULL;
 
100
      }
 
101
   }
 
102
   else
 
103
   {
 
104
      if(us->u.array)
 
105
      {
 
106
         unsigned i;
 
107
         for(i = 0; i <= pt->last_level; ++i)
 
108
         {
 
109
            struct pipe_surface *ps = us->u.array[i];
 
110
            if(ps)
 
111
               destroy_surface(ps);
 
112
         }
 
113
         FREE(us->u.array);
 
114
         us->u.array = NULL;
 
115
      }
 
116
   }
 
117
}