Merge branch '7.8'
authorBrian Paul <brianp@vmware.com>
Thu, 25 Mar 2010 22:12:01 +0000 (16:12 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 25 Mar 2010 22:12:01 +0000 (16:12 -0600)
1  2 
src/mesa/drivers/dri/r300/r300_cmdbuf.c

index e2dbb1dbf400aab51613dbfdfb3df691f1ec61e6,788dc2f16e9f2c7bbfb70de6692cfe0b2f18e2f8..c40802aec6e72e6476669628dffe1d78b776c362
@@@ -77,12 -77,29 +77,29 @@@ static int check_vpu(GLcontext *ctx, st
        cnt = vpu_count(atom->cmd);
  
        if (r300->radeon.radeonScreen->kernel_mm) {
-               extra = 5;
+               extra = 3;
        }
  
        return cnt ? (cnt * 4) + extra : 0;
  }
  
+ static int check_vpp(GLcontext *ctx, struct radeon_state_atom *atom)
+ {
+     r300ContextPtr r300 = R300_CONTEXT(ctx);
+     int cnt;
+     int extra = 1;
+     if (r300->radeon.radeonScreen->kernel_mm) {
+         cnt = r300->selected_vp->code.constants.Count * 4;
+         extra = 3;
+     } else {
+         cnt = vpu_count(atom->cmd);
+         extra = 1;
+     }
+     return cnt ? (cnt * 4) + extra : 0;
+ }
  void r300_emit_vpu(struct r300_context *r300,
                     uint32_t *data,
                     unsigned len,
@@@ -101,15 -118,26 +118,26 @@@ static void emit_vpu_state(GLcontext *c
  {
      r300ContextPtr r300 = R300_CONTEXT(ctx);
      drm_r300_cmd_header_t cmd;
-     uint32_t addr, ndw;
+     uint32_t addr;
  
      cmd.u = atom->cmd[0];
      addr = (cmd.vpu.adrhi << 8) | cmd.vpu.adrlo;
-     ndw = atom->check(ctx, atom);
  
      r300_emit_vpu(r300, &atom->cmd[1], vpu_count(atom->cmd) * 4, addr);
  }
  
+ static void emit_vpp_state(GLcontext *ctx, struct radeon_state_atom * atom)
+ {
+     r300ContextPtr r300 = R300_CONTEXT(ctx);
+     drm_r300_cmd_header_t cmd;
+     uint32_t addr;
+     cmd.u = atom->cmd[0];
+     addr = (cmd.vpu.adrhi << 8) | cmd.vpu.adrlo;
+     r300_emit_vpu(r300, &atom->cmd[1], r300->selected_vp->code.constants.Count * 4, addr);
+ }
  void r500_emit_fp(struct r300_context *r300,
                    uint32_t *data,
                    unsigned len,
@@@ -332,37 -360,36 +360,37 @@@ void r300_emit_cb_setup(struct r300_con
      assert(offset % 32 == 0);
  
      switch (format) {
 -        case MESA_FORMAT_RGB565:
 -            assert(_mesa_little_endian());
 -            cbpitch |= R300_COLOR_FORMAT_RGB565;
 +        case MESA_FORMAT_SL8:
 +        case MESA_FORMAT_A8:
 +        case MESA_FORMAT_L8:
 +        case MESA_FORMAT_I8:
 +            cbpitch |= R300_COLOR_FORMAT_I8;
              break;
 +        case MESA_FORMAT_RGB565:
          case MESA_FORMAT_RGB565_REV:
 -            assert(!_mesa_little_endian());
              cbpitch |= R300_COLOR_FORMAT_RGB565;
              break;
          case MESA_FORMAT_ARGB4444:
 -            assert(_mesa_little_endian());
 -            cbpitch |= R300_COLOR_FORMAT_ARGB4444;
 -            break;
          case MESA_FORMAT_ARGB4444_REV:
 -            assert(!_mesa_little_endian());
              cbpitch |= R300_COLOR_FORMAT_ARGB4444;
              break;
 +        case MESA_FORMAT_RGBA5551:
          case MESA_FORMAT_ARGB1555:
 -            assert(_mesa_little_endian());
 -            cbpitch |= R300_COLOR_FORMAT_ARGB1555;
 -            break;
          case MESA_FORMAT_ARGB1555_REV:
 -            assert(!_mesa_little_endian());
              cbpitch |= R300_COLOR_FORMAT_ARGB1555;
              break;
 +        case MESA_FORMAT_RGBA8888:
 +        case MESA_FORMAT_RGBA8888_REV:
 +        case MESA_FORMAT_XRGB8888:
 +        case MESA_FORMAT_ARGB8888:
 +        case MESA_FORMAT_XRGB8888_REV:
 +        case MESA_FORMAT_ARGB8888_REV:
 +        case MESA_FORMAT_SRGBA8:
 +        case MESA_FORMAT_SARGB8:
 +            cbpitch |= R300_COLOR_FORMAT_ARGB8888;
 +            break;
          default:
 -            if (cpp == 4) {
 -                cbpitch |= R300_COLOR_FORMAT_ARGB8888;
 -            } else {
 -                _mesa_problem(r300->radeon.glCtx, "unexpected format in emit_cb_offset()");;
 -            }
 +            _mesa_problem(r300->radeon.glCtx, "unexpected format in emit_cb_offset()");
              break;
      }
  
@@@ -785,11 -812,11 +813,11 @@@ void r300InitCmdBuf(r300ContextPtr r300
                        r300->hw.vpi.emit = emit_vpu_state;
  
                if (is_r500) {
-                       ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0);
+                       ALLOC_STATE(vpp, vpp, R300_VPP_CMDSIZE, 0);
                        r300->hw.vpp.cmd[0] =
                                cmdvpu(r300->radeon.radeonScreen, R500_PVS_CONST_START, 0);
                        if (r300->radeon.radeonScreen->kernel_mm)
-                               r300->hw.vpp.emit = emit_vpu_state;
+                               r300->hw.vpp.emit = emit_vpp_state;
  
                        ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0);
                        r300->hw.vps.cmd[0] =
                                        r300->hw.vpucp[i].emit = emit_vpu_state;
                        }
                } else {
-                       ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0);
+                       ALLOC_STATE(vpp, vpp, R300_VPP_CMDSIZE, 0);
                        r300->hw.vpp.cmd[0] =
                                cmdvpu(r300->radeon.radeonScreen, R300_PVS_CONST_START, 0);
                        if (r300->radeon.radeonScreen->kernel_mm)
-                               r300->hw.vpp.emit = emit_vpu_state;
+                               r300->hw.vpp.emit = emit_vpp_state;
  
                        ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0);
                        r300->hw.vps.cmd[0] =