~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i965/brw_vtbl.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2011-08-04 16:25:08 UTC
  • mfrom: (1.2.37 upstream)
  • Revision ID: james.westby@ubuntu.com-20110804162508-kujg82moxerjg1kk
Tags: 7.11-0ubuntu1
* Fake merge from Debian experimental, updating previous changelog entries.
  New upstream release fixes infrequent X crash (LP: #800778).
  Remaining Ubuntu changes:
 - debian/control
    + Drop lesstif-dev from Build-Depends; it's in Universe.
    + Comment out GLw libs since it depends on lesstif-dev.
    + Drop i686 swx11 libgl package.
    + Add libdrm-dev to mesa-common-dev Depends.
    + Drop libwayland-dev from Build-Depends; it's in Universe.
    + Update Breaks for Ubuntu versions
    + Enable llvm on armel as well as i386 and amd64
  - debian/rules
    + Use --disable-glw for swx11 targets too.
    + Don't enable motif for swx11 targets.
    + Use lzma compression for binary debs to save CD space.
    + Drop unloved mach64 driver.
    + Use --enable-shared-dricore to claw back CD space.
    + Enable llvmpipe software rasteriser.
    + Enable llvm on armel as well as i386 and amd64
  - debian/patches
    + 100_no_abi_tag.patch
    + 101_ubuntu_hidden_glname.patch
    + 103_savage-expose_fbmodes_with_nonzero_alpha.patch
  - rules, libgl1-mesa-{glx,dev,swx11,swx11-dev}.install.in,
    libgl1-mesa-{glx,swx11}.{postinst,prerm}.in, libgl1-mesa-dev.links.in:
    Install libGL.so* in /usr/lib/mesa to allow things to work with
    alternatives.
  - debian/not-installed:
    + Drop i686 files; we don't build 686-optimised packages in the first
      place.
  - debian/gbp.conf
    + Point at Ubuntu branch to make git-buildpackage less narky.
  - 113_fix_tls.diff: Fix crashes in unrelated code due to TLS usage.
  - debian/patches/111_export_searchdirs_in_dripc.diff:
    + Add drisearchdirs variable to dri.pc so the Xserver can pick up the
      alternate DRI driver dirs.
  - debian/patches/115_llvm_dynamic_linking.diff
    + Dynamically link DRI drivers to libllvm.  Saves ~6MiB per DRI driver.
  - debian/patches/116_use_shared_galliumcore.diff:
  - debian/libgl1-mesa-dri.install.in:
    + Link gallium DRI drivers against shared gallium routines to save CD
      space.
* debian/rules:
* debian/libgl1-mesa-dri-experimental.install.{i386,amd64}.in
  - Explicitly install i915g only when it has been built, matching what is
    done with r300g.
* debian/rules:
* debian/control:
* debian/libegl1-mesa{,-dev}.install.in:
* debian/libegl1-mesa.symbols:
  - Enable the Wayland EGL backend.
* debian/rules:
* debian/libegl1-mesa.{postinst,prerm,install}.in:
* debian/libegl1-mesa-dev.{install,links}.in:
* debian/libgles{1,2}-mesa.install.in:
* debian/libgles{1,2}-mesa-dev.links.in:
* debian/libopenvg1-mesa{,-dev}.install.in:
* debian/libopenvg1-mesa-dev.links.in:
  - Use alternatives for libEGL to match the handling of libGL.
    libEGL (and associated GL|ES and OpenVG libraries) now live in
    /usr/lib/$MULTIARCH/mesa-egl.  (LP: #812639)
* debian/patches/118_fix_24bpp_software_rendering.diff:
  - Cherry pick upstream patch from master fixing graphical corruption when
    using a 24bpp framebuffer and software rendering. (LP: #810339)
* debian/rules:
* debian/clean:
  - Generate xmlpool pot file and clean up other po files for
    pkgbinarymangler's benefit (LP: #410264).
* debian/patches/119_r600g_gnome_shell_rendering_fix.diff:
  - Cherry pick upstream commit fixing rendering corruption in gnome-shell
    (and therefore likely Unity as well).

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include "main/imports.h"
36
36
#include "main/macros.h"
37
37
#include "main/colormac.h"
 
38
#include "main/renderbuffer.h"
 
39
#include "main/framebuffer.h"
38
40
 
39
41
#include "intel_batchbuffer.h" 
40
42
#include "intel_regions.h" 
 
43
#include "intel_fbo.h"
41
44
 
42
45
#include "brw_context.h"
43
46
#include "brw_defines.h"
76
79
   free(brw->curbe.next_buf);
77
80
}
78
81
 
79
 
 
80
82
/**
81
 
 * called from intelDrawBuffer()
 
83
 * Update the hardware state for drawing into a window or framebuffer object.
 
84
 *
 
85
 * Called by glDrawBuffer, glBindFramebufferEXT, MakeCurrent, and other
 
86
 * places within the driver.
 
87
 *
 
88
 * Basically, this needs to be called any time the current framebuffer
 
89
 * changes, the renderbuffers change, or we need to draw into different
 
90
 * color buffers.
82
91
 */
83
 
static void brw_set_draw_region( struct intel_context *intel, 
84
 
                                 struct intel_region *color_regions[],
85
 
                                 struct intel_region *depth_region,
86
 
                                 GLuint num_color_regions)
 
92
static void
 
93
brw_update_draw_buffer(struct intel_context *intel)
87
94
{
 
95
   struct gl_context *ctx = &intel->ctx;
 
96
   struct gl_framebuffer *fb = ctx->DrawBuffer;
 
97
   struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
 
98
   bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
 
99
 
 
100
   if (!fb) {
 
101
      /* this can happen during the initial context initialization */
 
102
      return;
 
103
   }
 
104
 
 
105
   /*
 
106
    * If intel_context is using separate stencil, but the depth attachment
 
107
    * (gl_framebuffer.Attachment[BUFFER_DEPTH]) has a packed depth/stencil
 
108
    * format, then we must install the real depth buffer at fb->_DepthBuffer
 
109
    * and set fb->_DepthBuffer->Wrapped before calling _mesa_update_framebuffer.
 
110
    * Otherwise, _mesa_update_framebuffer will create and install a swras
 
111
    * depth wrapper instead.
 
112
    *
 
113
    * Ditto for stencil.
 
114
    */
 
115
   irbDepth = intel_get_renderbuffer(fb, BUFFER_DEPTH);
 
116
   if (irbDepth && irbDepth->Base.Format == MESA_FORMAT_X8_Z24) {
 
117
      _mesa_reference_renderbuffer(&fb->_DepthBuffer, &irbDepth->Base);
 
118
      irbDepth->Base.Wrapped = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
 
119
   }
 
120
 
 
121
   irbStencil = intel_get_renderbuffer(fb, BUFFER_STENCIL);
 
122
   if (irbStencil && irbStencil->Base.Format == MESA_FORMAT_S8) {
 
123
      _mesa_reference_renderbuffer(&fb->_StencilBuffer, &irbStencil->Base);
 
124
      irbStencil->Base.Wrapped = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
 
125
   }
 
126
 
 
127
   /* Do this here, not core Mesa, since this function is called from
 
128
    * many places within the driver.
 
129
    */
 
130
   if (ctx->NewState & _NEW_BUFFERS) {
 
131
      /* this updates the DrawBuffer->_NumColorDrawBuffers fields, etc */
 
132
      _mesa_update_framebuffer(ctx);
 
133
      /* this updates the DrawBuffer's Width/Height if it's a FBO */
 
134
      _mesa_update_draw_buffer_bounds(ctx);
 
135
   }
 
136
 
 
137
   if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
 
138
      /* this may occur when we're called by glBindFrameBuffer() during
 
139
       * the process of someone setting up renderbuffers, etc.
 
140
       */
 
141
      /*_mesa_debug(ctx, "DrawBuffer: incomplete user FBO\n");*/
 
142
      return;
 
143
   }
 
144
 
 
145
   /* Check some stencil invariants.  These should probably be in
 
146
    * emit_depthbuffer().
 
147
    */
 
148
   if (irbStencil && irbStencil->region) {
 
149
      if (!intel->has_separate_stencil)
 
150
         assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24);
 
151
      if (fb_has_hiz || intel->must_use_separate_stencil)
 
152
         assert(irbStencil->Base.Format == MESA_FORMAT_S8);
 
153
      if (irbStencil->Base.Format == MESA_FORMAT_S8)
 
154
         assert(intel->has_separate_stencil);
 
155
   }
 
156
 
 
157
   /* Mesa's Stencil._Enabled field is updated when
 
158
    * _NEW_BUFFERS | _NEW_STENCIL, but i965 code assumes that the value
 
159
    * only changes with _NEW_STENCIL (which seems sensible).  So flag it
 
160
    * here since this is the _NEW_BUFFERS path.
 
161
    */
 
162
   intel->NewGLState |= (_NEW_DEPTH | _NEW_STENCIL);
 
163
 
 
164
   /* The driver uses this in places that need to look up
 
165
    * renderbuffers' buffer objects.
 
166
    */
 
167
   intel->NewGLState |= _NEW_BUFFERS;
 
168
 
 
169
   /* update viewport/scissor since it depends on window size */
 
170
   intel->NewGLState |= _NEW_VIEWPORT | _NEW_SCISSOR;
 
171
 
 
172
   /* Update culling direction which changes depending on the
 
173
    * orientation of the buffer:
 
174
    */
 
175
   intel->NewGLState |= _NEW_POLYGON;
88
176
}
89
177
 
90
 
 
91
178
/**
92
179
 * called from intel_batchbuffer_flush and children before sending a
93
180
 * batchbuffer off.
124
211
   intel->batch.need_workaround_flush = true;
125
212
 
126
213
   brw->vb.nr_current_buffers = 0;
 
214
   brw->ib.type = -1;
127
215
 
128
216
   /* Mark that the current program cache BO has been used by the GPU.
129
217
    * It will be reallocated if we need to put new programs in for the
160
248
   brw->intel.vtbl.new_batch = brw_new_batch;
161
249
   brw->intel.vtbl.finish_batch = brw_finish_batch;
162
250
   brw->intel.vtbl.destroy = brw_destroy_context;
163
 
   brw->intel.vtbl.set_draw_region = brw_set_draw_region;
 
251
   brw->intel.vtbl.update_draw_buffer = brw_update_draw_buffer;
164
252
   brw->intel.vtbl.debug_batch = brw_debug_batch;
165
253
   brw->intel.vtbl.render_target_supported = brw_render_target_supported;
166
254
   brw->intel.vtbl.is_hiz_depth_format = brw_is_hiz_depth_format;