brw_sf.c \
brw_sf_emit.c \
brw_sf_state.c \
- brw_state.c \
brw_state_batch.c \
brw_state_cache.c \
brw_state_dump.c \
#include "main/macros.h"
#include "intel_batchbuffer.h"
-void
-brw_update_cc_vp(struct brw_context *brw)
+static void
+prepare_cc_vp(struct brw_context *brw)
{
struct gl_context *ctx = &brw->intel.ctx;
- struct brw_cc_viewport ccv;
+ struct brw_cc_viewport *ccv;
- memset(&ccv, 0, sizeof(ccv));
+ ccv = brw_state_batch(brw, sizeof(*ccv), 32, &brw->cc.vp_offset);
/* _NEW_TRANSOFORM */
if (ctx->Transform.DepthClamp) {
/* _NEW_VIEWPORT */
- ccv.min_depth = MIN2(ctx->Viewport.Near, ctx->Viewport.Far);
- ccv.max_depth = MAX2(ctx->Viewport.Near, ctx->Viewport.Far);
+ ccv->min_depth = MIN2(ctx->Viewport.Near, ctx->Viewport.Far);
+ ccv->max_depth = MAX2(ctx->Viewport.Near, ctx->Viewport.Far);
} else {
- ccv.min_depth = 0.0;
- ccv.max_depth = 1.0;
+ ccv->min_depth = 0.0;
+ ccv->max_depth = 1.0;
}
- drm_intel_bo_unreference(brw->cc.vp_bo);
- brw->cc.vp_bo = brw_cache_data(&brw->cache, BRW_CC_VP, &ccv, sizeof(ccv));
+ brw->state.dirty.cache |= CACHE_NEW_CC_VP;
}
+const struct brw_tracked_state brw_cc_vp = {
+ .dirty = {
+ .mesa = _NEW_VIEWPORT | _NEW_TRANSFORM,
+ .brw = BRW_NEW_BATCH,
+ .cache = 0
+ },
+ .prepare = prepare_cc_vp
+};
+
/**
* Modify blend function to force destination alpha to 1.0
*
return function;
}
-static void prepare_cc_unit(struct brw_context *brw)
-{
- brw_add_validated_bo(brw, brw->cc.vp_bo);
-}
-
/**
* Creates the state cache entry for the given CC unit key.
*/
cc->cc5.statistics_enable = 1;
/* CACHE_NEW_CC_VP */
- cc->cc4.cc_viewport_state_offset = brw->cc.vp_bo->offset >> 5; /* reloc */
+ cc->cc4.cc_viewport_state_offset = (intel->batch.bo->offset +
+ brw->cc.vp_offset) >> 5; /* reloc */
brw->state.dirty.cache |= CACHE_NEW_CC_UNIT;
drm_intel_bo_emit_reloc(brw->intel.batch.bo,
(brw->cc.state_offset +
offsetof(struct brw_cc_unit_state, cc4)),
- brw->cc.vp_bo, 0,
+ intel->batch.bo, brw->cc.vp_offset,
I915_GEM_DOMAIN_INSTRUCTION, 0);
}
.brw = BRW_NEW_BATCH,
.cache = CACHE_NEW_CC_VP
},
- .prepare = prepare_cc_unit,
.emit = upload_cc_unit,
};
brwInitFragProgFuncs( functions );
brw_init_queryobj_functions(functions);
-
- functions->Enable = brw_enable;
- functions->DepthRange = brw_depth_range;
}
GLboolean brwCreateContext( int api,
brw_draw_init( brw );
- /* Now that most driver functions are hooked up, initialize some of the
- * immediate state.
- */
- brw_update_cc_vp(brw);
-
return GL_TRUE;
}
struct {
/* gen4 */
drm_intel_bo *prog_bo;
- drm_intel_bo *vp_bo;
/* gen6 */
drm_intel_bo *blend_state_bo;
drm_intel_bo *color_calc_state_bo;
uint32_t state_offset;
+ uint32_t vp_offset;
} cc;
struct {
*/
void brw_upload_urb_fence(struct brw_context *brw);
-/* brw_cc.c */
-void brw_update_cc_vp(struct brw_context *brw);
-
/* brw_curbe.c
*/
void brw_upload_cs_urb_state(struct brw_context *brw);
/* brw_disasm.c */
int brw_disasm (FILE *file, struct brw_instruction *inst, int gen);
-/* brw_state.c */
-void brw_enable(struct gl_context * ctx, GLenum cap, GLboolean state);
-void brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval);
-
/*======================================================================
* Inline conversion functions. These are better-typed than the
* macros used previously:
+++ /dev/null
-/*
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-#include "brw_context.h"
-
-void
-brw_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
-{
- struct brw_context *brw = brw_context(ctx);
-
- switch (cap) {
- case GL_DEPTH_CLAMP:
- brw_update_cc_vp(brw);
- break;
- }
-}
-
-void
-brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval)
-{
- struct brw_context *brw = brw_context(ctx);
-
- if (ctx->Transform.DepthClamp)
- brw_update_cc_vp(brw);
-}
};
extern const struct brw_tracked_state brw_blend_constant_color;
+extern const struct brw_tracked_state brw_cc_vp;
extern const struct brw_tracked_state brw_cc_unit;
extern const struct brw_tracked_state brw_check_fallback;
extern const struct brw_tracked_state brw_clip_prog;
static void dump_cc_viewport_state(struct brw_context *brw)
{
+ struct intel_context *intel = &brw->intel;
const char *name = "CC VP";
struct brw_cc_viewport *vp;
uint32_t vp_off;
- if (brw->cc.vp_bo == NULL)
- return;
-
- drm_intel_bo_map(brw->cc.vp_bo, GL_FALSE);
+ drm_intel_bo_map(intel->batch.bo, GL_FALSE);
- vp = brw->cc.vp_bo->virtual;
- vp_off = brw->cc.vp_bo->offset;
+ vp = intel->batch.bo->virtual + brw->cc.vp_offset;
+ vp_off = intel->batch.bo->offset + brw->cc.vp_offset;
state_out(name, vp, vp_off, 0, "min_depth = %f\n", vp->min_depth);
state_out(name, vp, vp_off, 1, "max_depth = %f\n", vp->max_depth);
- drm_intel_bo_unmap(brw->cc.vp_bo);
+ drm_intel_bo_unmap(intel->batch.bo);
}
static void dump_depth_stencil_state(struct brw_context *brw)
&brw_curbe_offsets,
&brw_recalculate_urb_fence,
+ &brw_cc_vp,
&brw_cc_unit,
&brw_vs_constants, /* Before vs_surfaces and constant_buffer */
/* Command packets: */
&brw_invarient_state,
+ &brw_cc_vp,
&gen6_viewport_state, /* must do after *_vp stages */
&gen6_urb,
dri_bo_release(&brw->wm.state_bo);
dri_bo_release(&brw->wm.const_bo);
dri_bo_release(&brw->cc.prog_bo);
- dri_bo_release(&brw->cc.vp_bo);
dri_bo_release(&brw->cc.blend_state_bo);
dri_bo_release(&brw->cc.depth_stencil_state_bo);
dri_bo_release(&brw->cc.color_calc_state_bo);
.prepare = prepare_sf_vp,
};
-static void prepare_viewport_state_pointers(struct brw_context *brw)
-{
- brw_add_validated_bo(brw, brw->cc.vp_bo);
-}
-
static void upload_viewport_state_pointers(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
brw->clip.vp_offset);
OUT_RELOC(intel->batch.bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
brw->sf.vp_offset);
- OUT_RELOC(brw->cc.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ OUT_RELOC(intel->batch.bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
+ brw->cc.vp_offset);
ADVANCE_BATCH();
}
CACHE_NEW_SF_VP |
CACHE_NEW_CC_VP)
},
- .prepare = prepare_viewport_state_pointers,
.emit = upload_viewport_state_pointers,
};