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

« back to all changes in this revision

Viewing changes to src/gallium/drivers/i915/i915_context.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:
28
28
#include "i915_context.h"
29
29
#include "i915_state.h"
30
30
#include "i915_screen.h"
 
31
#include "i915_surface.h"
31
32
#include "i915_batch.h"
 
33
#include "i915_resource.h"
32
34
 
33
35
#include "draw/draw_context.h"
34
36
#include "pipe/p_defines.h"
43
45
 
44
46
 
45
47
static void
46
 
i915_draw_range_elements(struct pipe_context *pipe,
47
 
                         struct pipe_buffer *indexBuffer,
48
 
                         unsigned indexSize,
49
 
                         unsigned min_index,
50
 
                         unsigned max_index,
51
 
                         unsigned prim, unsigned start, unsigned count)
 
48
i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
52
49
{
53
50
   struct i915_context *i915 = i915_context(pipe);
54
51
   struct draw_context *draw = i915->draw;
 
52
   void *mapped_indices = NULL;
55
53
   unsigned i;
56
54
 
57
55
   if (i915->dirty)
61
59
    * Map vertex buffers
62
60
    */
63
61
   for (i = 0; i < i915->num_vertex_buffers; i++) {
64
 
      void *buf = pipe_buffer_map(pipe->screen, i915->vertex_buffer[i].buffer,
65
 
                                  PIPE_BUFFER_USAGE_CPU_READ);
 
62
      void *buf = i915_buffer(i915->vertex_buffer[i].buffer)->data;
66
63
      draw_set_mapped_vertex_buffer(draw, i, buf);
67
64
   }
68
65
 
69
66
   /*
70
67
    * Map index buffer, if present
71
68
    */
72
 
   if (indexBuffer) {
73
 
      void *mapped_indexes = pipe_buffer_map(pipe->screen, indexBuffer,
74
 
                                             PIPE_BUFFER_USAGE_CPU_READ);
75
 
      draw_set_mapped_element_buffer_range(draw, indexSize,
76
 
                                           min_index,
77
 
                                           max_index,
78
 
                                           mapped_indexes);
79
 
   } else {
80
 
      draw_set_mapped_element_buffer(draw, 0, NULL);
81
 
   }
82
 
 
 
69
   if (info->indexed && i915->index_buffer.buffer)
 
70
      mapped_indices = i915_buffer(i915->index_buffer.buffer)->data;
 
71
   draw_set_mapped_index_buffer(draw, mapped_indices);
83
72
 
84
73
   draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
85
74
                                   i915->current.constants[PIPE_SHADER_VERTEX],
89
78
   /*
90
79
    * Do the drawing
91
80
    */
92
 
   draw_arrays(i915->draw, prim, start, count);
 
81
   draw_vbo(i915->draw, info);
93
82
 
94
83
   /*
95
84
    * unmap vertex/index buffers
96
85
    */
97
86
   for (i = 0; i < i915->num_vertex_buffers; i++) {
98
 
      pipe_buffer_unmap(pipe->screen, i915->vertex_buffer[i].buffer);
99
87
      draw_set_mapped_vertex_buffer(draw, i, NULL);
100
88
   }
101
89
 
102
 
   if (indexBuffer) {
103
 
      pipe_buffer_unmap(pipe->screen, indexBuffer);
104
 
      draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL);
105
 
   }
106
 
}
107
 
 
108
 
static void
109
 
i915_draw_elements(struct pipe_context *pipe,
110
 
                   struct pipe_buffer *indexBuffer,
111
 
                   unsigned indexSize,
112
 
                   unsigned prim, unsigned start, unsigned count)
113
 
{
114
 
   i915_draw_range_elements(pipe, indexBuffer,
115
 
                            indexSize,
116
 
                            0, 0xffffffff,
117
 
                            prim, start, count);
118
 
}
119
 
 
120
 
static void
121
 
i915_draw_arrays(struct pipe_context *pipe,
122
 
                 unsigned prim, unsigned start, unsigned count)
123
 
{
124
 
   i915_draw_elements(pipe, NULL, 0, prim, start, count);
125
 
}
126
 
 
127
 
 
128
 
/*
129
 
 * Is referenced functions
130
 
 */
131
 
 
132
 
 
133
 
static unsigned int
134
 
i915_is_texture_referenced(struct pipe_context *pipe,
135
 
                           struct pipe_texture *texture,
136
 
                           unsigned face, unsigned level)
137
 
{
138
 
   /**
139
 
    * FIXME: Return the corrent result. We can't alays return referenced
140
 
    *        since it causes a double flush within the vbo module.
141
 
    */
142
 
#if 0
143
 
   return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
144
 
#else
145
 
   return 0;
146
 
#endif
147
 
}
148
 
 
149
 
static unsigned int
150
 
i915_is_buffer_referenced(struct pipe_context *pipe,
151
 
                          struct pipe_buffer *buf)
152
 
{
153
 
   /*
154
 
    * Since we never expose hardware buffers to the state tracker
155
 
    * they can never be referenced, so this isn't a lie
156
 
    */
157
 
   return 0;
 
90
   if (mapped_indices)
 
91
      draw_set_mapped_index_buffer(draw, NULL);
158
92
}
159
93
 
160
94
 
200
134
 
201
135
   i915->base.clear = i915_clear;
202
136
 
203
 
   i915->base.draw_arrays = i915_draw_arrays;
204
 
   i915->base.draw_elements = i915_draw_elements;
205
 
   i915->base.draw_range_elements = i915_draw_range_elements;
206
 
 
207
 
   i915->base.is_texture_referenced = i915_is_texture_referenced;
208
 
   i915->base.is_buffer_referenced = i915_is_buffer_referenced;
 
137
   i915->base.draw_vbo = i915_draw_vbo;
209
138
 
210
139
   /*
211
140
    * Create drawing context and plug our rendering stage into it.
221
150
   i915_init_surface_functions(i915);
222
151
   i915_init_state_functions(i915);
223
152
   i915_init_flush_functions(i915);
 
153
   i915_init_resource_functions(i915);
224
154
 
225
155
   draw_install_aaline_stage(i915->draw, &i915->base);
226
156
   draw_install_aapoint_stage(i915->draw, &i915->base);