Merge i915_set_draw_region() and i915 meta_draw_region() into new i915_state_draw_region().

This commit is contained in:
Brian Paul 2006-03-19 16:50:59 +00:00
parent ec36d5b537
commit 9194782fdc
3 changed files with 36 additions and 61 deletions

View file

@ -266,6 +266,12 @@ do { \
*/
extern void i915InitVtbl( struct i915_context *i915 );
extern void
i915_state_draw_region(struct intel_context *intel,
struct i915_hw_state *state,
struct intel_region *color_region,
struct intel_region *depth_region);
#define SZ_TO_HW(sz) ((sz-2)&0x3)

View file

@ -431,60 +431,13 @@ static GLboolean meta_tex_rect_source( struct intel_context *intel,
/**
* Set the color and depth drawing region for meta ops.
* XXX Lots of code duplication here with i915_set_draw_region.
*/
static void meta_draw_region( struct intel_context *intel,
struct intel_region *color_region,
struct intel_region *depth_region )
{
struct i915_context *i915 = i915_context(&intel->ctx);
GLuint color_format;
GLuint depth_format = DEPTH_FRMT_16_FIXED;
intel_region_release(intel, &i915->meta.draw_region);
intel_region_reference(&i915->meta.draw_region, color_region);
intel_region_release(intel, &i915->meta.depth_region);
intel_region_reference(&i915->meta.depth_region, depth_region);
if (color_region) {
i915->meta.Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
i915->meta.Buffer[I915_DESTREG_CBUFADDR1] =
(BUF_3D_ID_COLOR_BACK |
BUF_3D_PITCH(color_region->pitch * color_region->cpp) |
BUF_3D_USE_FENCE);
}
if (depth_region) {
i915->meta.Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
i915->meta.Buffer[I915_DESTREG_DBUFADDR1] =
(BUF_3D_ID_DEPTH |
BUF_3D_PITCH(depth_region->pitch * depth_region->cpp) |
BUF_3D_USE_FENCE);
}
/* XXX: 555 support?
*/
if (color_region->cpp == 2)
color_format = DV_PF_565;
else
color_format = DV_PF_8888;
if (depth_region && depth_region->cpp == 4)
depth_format = DEPTH_FRMT_24_FIXED_8_OTHER;
else
depth_format = DEPTH_FRMT_16_FIXED;
i915->meta.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
DSTORG_VERT_BIAS(0x8) | /* .5 */
color_format |
LOD_PRECLAMP_OGL |
TEX_DEFAULT_COLOR_OGL |
depth_format);
i915->meta.emitted &= ~I915_UPLOAD_BUFFERS;
i915_state_draw_region(intel, &i915->meta, color_region, depth_region);
}

View file

@ -346,34 +346,38 @@ static void i915_destroy_context( struct intel_context *intel )
* Set the drawing regions for the color and depth/stencil buffers.
* This involves setting the pitch, cpp and buffer ID/location.
* Also set pixel format for color and Z rendering
* XXX Lots of code duplication with i915 meta_draw_region().
* Used for setting both regular and meta state.
*/
static void i915_set_draw_region( struct intel_context *intel,
struct intel_region *color_region,
struct intel_region *depth_region)
void
i915_state_draw_region(struct intel_context *intel,
struct i915_hw_state *state,
struct intel_region *color_region,
struct intel_region *depth_region)
{
struct i915_context *i915 = i915_context(&intel->ctx);
GLuint value;
intel_region_release(intel, &i915->state.draw_region);
intel_region_release(intel, &i915->state.depth_region);
intel_region_reference(&i915->state.draw_region, color_region);
intel_region_reference(&i915->state.depth_region, depth_region);
ASSERT(state == &i915->state || state == &i915->meta);
intel_region_release(intel, &state->draw_region);
intel_region_release(intel, &state->depth_region);
intel_region_reference(&state->draw_region, color_region);
intel_region_reference(&state->depth_region, depth_region);
/*
* Set stride/cpp values
*/
if (color_region) {
i915->state.Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
i915->state.Buffer[I915_DESTREG_CBUFADDR1] =
state->Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
state->Buffer[I915_DESTREG_CBUFADDR1] =
(BUF_3D_ID_COLOR_BACK |
BUF_3D_PITCH(color_region->pitch * color_region->cpp) |
BUF_3D_USE_FENCE);
}
if (depth_region) {
i915->state.Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
i915->state.Buffer[I915_DESTREG_DBUFADDR1] =
state->Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
state->Buffer[I915_DESTREG_DBUFADDR1] =
(BUF_3D_ID_DEPTH |
BUF_3D_PITCH(depth_region->pitch * depth_region->cpp) |
BUF_3D_USE_FENCE);
@ -398,11 +402,23 @@ static void i915_set_draw_region( struct intel_context *intel,
else {
value |= DEPTH_FRMT_16_FIXED;
}
i915->state.Buffer[I915_DESTREG_DV1] = value;
state->Buffer[I915_DESTREG_DV1] = value;
I915_STATECHANGE( i915, I915_UPLOAD_BUFFERS );
}
static void
i915_set_draw_region(struct intel_context *intel,
struct intel_region *color_region,
struct intel_region *depth_region)
{
struct i915_context *i915 = i915_context(&intel->ctx);
i915_state_draw_region(intel, &i915->state, color_region, depth_region);
}
static void i915_lost_hardware( struct intel_context *intel )
{
struct i915_context *i915 = i915_context(&intel->ctx);