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

« back to all changes in this revision

Viewing changes to src/gallium/winsys/i915/sw/i915_sw_buffer.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
#include "i915_sw_winsys.h"
 
3
#include "util/u_memory.h"
 
4
 
 
5
static struct i915_winsys_buffer *
 
6
i915_sw_buffer_create(struct i915_winsys *iws,
 
7
                      unsigned size, unsigned alignment,
 
8
                      enum i915_winsys_buffer_type type)
 
9
{
 
10
   struct i915_sw_buffer *buf = CALLOC_STRUCT(i915_sw_buffer);
 
11
   char *name;
 
12
 
 
13
   if (!buf)
 
14
      return NULL;
 
15
 
 
16
   if (type == I915_NEW_TEXTURE) {
 
17
      name = "gallium3d_texture";
 
18
   } else if (type == I915_NEW_VERTEX) {
 
19
      name = "gallium3d_vertex";
 
20
   } else if (type == I915_NEW_SCANOUT) {
 
21
      name = "gallium3d_scanout";
 
22
   } else {
 
23
      assert(0);
 
24
      name = "gallium3d_unknown";
 
25
   }
 
26
 
 
27
   buf->magic = 0xDEAD1337;
 
28
   buf->name = name;
 
29
   buf->type = type;
 
30
   buf->ptr = CALLOC(size, 1);
 
31
 
 
32
   if (!buf->ptr)
 
33
      goto err;
 
34
 
 
35
   return (struct i915_winsys_buffer *)buf;
 
36
 
 
37
err:
 
38
   assert(0);
 
39
   FREE(buf);
 
40
   return NULL;
 
41
}
 
42
 
 
43
static int
 
44
i915_sw_buffer_set_fence_reg(struct i915_winsys *iws,
 
45
                               struct i915_winsys_buffer *buffer,
 
46
                               unsigned stride,
 
47
                               enum i915_winsys_buffer_tile tile)
 
48
{
 
49
   struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
 
50
 
 
51
   if (tile != I915_TILE_NONE) {
 
52
      assert(buf->map_count == 0);
 
53
   }
 
54
 
 
55
   buf->tile = tile;
 
56
 
 
57
   return 0;
 
58
}
 
59
 
 
60
static void *
 
61
i915_sw_buffer_map(struct i915_winsys *iws,
 
62
                   struct i915_winsys_buffer *buffer,
 
63
                   boolean write)
 
64
{
 
65
   struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
 
66
 
 
67
   buf->map_count += 1;
 
68
   return buf->ptr;
 
69
}
 
70
 
 
71
static void
 
72
i915_sw_buffer_unmap(struct i915_winsys *iws,
 
73
                     struct i915_winsys_buffer *buffer)
 
74
{
 
75
   struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
 
76
 
 
77
   buf->map_count -= 1;
 
78
}
 
79
 
 
80
static int
 
81
i915_sw_buffer_write(struct i915_winsys *iws,
 
82
                     struct i915_winsys_buffer *buffer,
 
83
                     size_t offset,
 
84
                     size_t size,
 
85
                     const void *data)
 
86
{
 
87
   struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
 
88
 
 
89
   memcpy(buf->ptr + offset, data, size);
 
90
   return 0;
 
91
}
 
92
 
 
93
static void
 
94
i915_sw_buffer_destroy(struct i915_winsys *iws,
 
95
                       struct i915_winsys_buffer *buffer)
 
96
{
 
97
   struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
 
98
 
 
99
#ifdef DEBUG
 
100
   buf->magic = 0;
 
101
#endif
 
102
 
 
103
   FREE(buf->ptr);
 
104
   FREE(buf);
 
105
}
 
106
 
 
107
void
 
108
i915_sw_winsys_init_buffer_functions(struct i915_sw_winsys *isws)
 
109
{
 
110
   isws->base.buffer_create = i915_sw_buffer_create;
 
111
   isws->base.buffer_set_fence_reg = i915_sw_buffer_set_fence_reg;
 
112
   isws->base.buffer_map = i915_sw_buffer_map;
 
113
   isws->base.buffer_unmap = i915_sw_buffer_unmap;
 
114
   isws->base.buffer_write = i915_sw_buffer_write;
 
115
   isws->base.buffer_destroy = i915_sw_buffer_destroy;
 
116
}