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

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i965/gen6_wm_state.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:
29
29
#include "brw_state.h"
30
30
#include "brw_defines.h"
31
31
#include "brw_util.h"
32
 
#include "shader/prog_parameter.h"
33
 
#include "shader/prog_statevars.h"
 
32
#include "program/prog_parameter.h"
 
33
#include "program/prog_statevars.h"
34
34
#include "intel_batchbuffer.h"
35
35
 
36
36
static void
 
37
prepare_wm_constants(struct brw_context *brw)
 
38
{
 
39
   struct intel_context *intel = &brw->intel;
 
40
   GLcontext *ctx = &intel->ctx;
 
41
   const struct brw_fragment_program *fp =
 
42
      brw_fragment_program_const(brw->fragment_program);
 
43
 
 
44
   drm_intel_bo_unreference(brw->wm.push_const_bo);
 
45
   brw->wm.push_const_bo = NULL;
 
46
 
 
47
   /* Updates the ParamaterValues[i] pointers for all parameters of the
 
48
    * basic type of PROGRAM_STATE_VAR.
 
49
    */
 
50
   /* XXX: Should this happen somewhere before to get our state flag set? */
 
51
   _mesa_load_state_parameters(ctx, fp->program.Base.Parameters);
 
52
 
 
53
   if (brw->wm.prog_data->nr_params != 0) {
 
54
      float *constants;
 
55
      unsigned int i;
 
56
 
 
57
      brw->wm.push_const_bo = drm_intel_bo_alloc(intel->bufmgr,
 
58
                                                 "WM constant_bo",
 
59
                                                 brw->wm.prog_data->nr_params *
 
60
                                                 sizeof(float),
 
61
                                                 4096);
 
62
      drm_intel_gem_bo_map_gtt(brw->wm.push_const_bo);
 
63
      constants = brw->wm.push_const_bo->virtual;
 
64
      for (i = 0; i < brw->wm.prog_data->nr_params; i++) {
 
65
         constants[i] = *brw->wm.prog_data->param[i];
 
66
      }
 
67
      drm_intel_gem_bo_unmap_gtt(brw->wm.push_const_bo);
 
68
   }
 
69
}
 
70
 
 
71
const struct brw_tracked_state gen6_wm_constants = {
 
72
   .dirty = {
 
73
      .mesa  = _NEW_PROGRAM_CONSTANTS,
 
74
      .brw   = 0,
 
75
      .cache = 0,
 
76
   },
 
77
   .prepare = prepare_wm_constants,
 
78
};
 
79
 
 
80
static void
37
81
upload_wm_state(struct brw_context *brw)
38
82
{
39
83
   struct intel_context *intel = &brw->intel;
40
84
   GLcontext *ctx = &intel->ctx;
41
85
   const struct brw_fragment_program *fp =
42
86
      brw_fragment_program_const(brw->fragment_program);
43
 
   unsigned int nr_params = fp->program.Base.Parameters->NumParameters;
44
 
   drm_intel_bo *constant_bo;
45
 
   int i;
46
87
   uint32_t dw2, dw4, dw5, dw6;
47
88
 
48
 
   if (fp->use_const_buffer || nr_params == 0) {
 
89
   if (fp->use_const_buffer || brw->wm.prog_data->nr_params == 0) {
49
90
      /* Disable the push constant buffers. */
50
91
      BEGIN_BATCH(5);
51
92
      OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 | (5 - 2));
55
96
      OUT_BATCH(0);
56
97
      ADVANCE_BATCH();
57
98
   } else {
58
 
      /* Updates the ParamaterValues[i] pointers for all parameters of the
59
 
       * basic type of PROGRAM_STATE_VAR.
60
 
       */
61
 
      _mesa_load_state_parameters(ctx, fp->program.Base.Parameters);
62
 
 
63
 
      constant_bo = drm_intel_bo_alloc(intel->bufmgr, "WM constant_bo",
64
 
                                       nr_params * 4 * sizeof(float),
65
 
                                       4096);
66
 
      drm_intel_gem_bo_map_gtt(constant_bo);
67
 
      for (i = 0; i < nr_params; i++) {
68
 
         memcpy((char *)constant_bo->virtual + i * 4 * sizeof(float),
69
 
                fp->program.Base.Parameters->ParameterValues[i],
70
 
                4 * sizeof(float));
71
 
      }
72
 
      drm_intel_gem_bo_unmap_gtt(constant_bo);
73
 
 
74
99
      BEGIN_BATCH(5);
75
100
      OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 |
76
101
                GEN6_CONSTANT_BUFFER_0_ENABLE |
77
102
                (5 - 2));
78
 
      OUT_RELOC(constant_bo,
 
103
      OUT_RELOC(brw->wm.push_const_bo,
79
104
                I915_GEM_DOMAIN_RENDER, 0, /* XXX: bad domain */
80
 
                ALIGN(nr_params, 2) / 2 - 1);
 
105
                ALIGN(brw->wm.prog_data->nr_params, 8) / 8 - 1);
81
106
      OUT_BATCH(0);
82
107
      OUT_BATCH(0);
83
108
      OUT_BATCH(0);
84
109
      ADVANCE_BATCH();
85
 
 
86
 
      drm_intel_bo_unreference(constant_bo);
87
110
   }
88
111
 
89
112
   intel_batchbuffer_emit_mi_flush(intel->batch);
98
121
 
99
122
   /* CACHE_NEW_SAMPLER */
100
123
   dw2 |= (ALIGN(brw->wm.sampler_count, 4) / 4) << GEN6_WM_SAMPLER_COUNT_SHIFT;
101
 
   dw4 |= (1 << GEN6_WM_DISPATCH_START_GRF_SHIFT_0);
 
124
   dw4 |= (brw->wm.prog_data->first_curbe_grf <<
 
125
           GEN6_WM_DISPATCH_START_GRF_SHIFT_0);
102
126
 
103
127
   dw5 |= (40 - 1) << GEN6_WM_MAX_THREADS_SHIFT;
104
128
   dw5 |= GEN6_WM_DISPATCH_ENABLE;