From: Christian König Date: Sat, 7 May 2011 12:11:40 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' into pipe-video X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=213b9004a6ee033a16af3dcd187aa68b56c39858;p=mesa.git Merge remote-tracking branch 'origin/master' into pipe-video Conflicts: src/gallium/drivers/r600/r600_state.c --- 213b9004a6ee033a16af3dcd187aa68b56c39858 diff --cc src/gallium/drivers/r600/r600_state.c index 8646b9f4905,3f979cf170f..b9084c953ee --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@@ -780,17 -769,36 +774,36 @@@ static void r600_cb(struct r600_pipe_co S_0280A0_NUMBER_TYPE(ntype) | S_0280A0_ENDIAN(endian); - color_info_mask = 0xFFFFFFFF & ~S_0280A0_BLEND_CLAMP(1); - - /* on R600 this can't be set if BLEND_CLAMP isn't set, - if BLEND_FLOAT32 is set of > 11 bits in a UNORM or SNORM */ - if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS && desc->channel[i].size < 12) { - //TODO: Seems to work on RV710, but i have no idea what to do between R600-RV710 - if (rctx->family < CHIP_RV710) { - color_info |= S_0280A0_BLEND_CLAMP(1); - color_info_mask |= S_0280A0_BLEND_CLAMP(1); - } - color_info |= S_0280A0_SOURCE_FORMAT(V_0280A0_EXPORT_NORM); + /* EXPORT_NORM is an optimzation that can be enabled for better + * performance in certain cases + */ + if (rctx->family < CHIP_RV770) { + /* EXPORT_NORM can be enabled if: + * - 11-bit or smaller UNORM/SNORM/SRGB + * - BLEND_CLAMP is enabled + * - BLEND_FLOAT32 is disabled + */ ++ // TODO get BLEND_CLAMP state from rasterizer state + if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS && + (desc->channel[i].size < 12 && + desc->channel[i].type != UTIL_FORMAT_TYPE_FLOAT && + ntype != V_0280A0_NUMBER_UINT && + ntype != V_0280A0_NUMBER_SINT) && + G_0280A0_BLEND_CLAMP(color_info) && + !G_0280A0_BLEND_FLOAT32(color_info)) + color_info |= S_0280A0_SOURCE_FORMAT(V_0280A0_EXPORT_NORM); + } else { + /* EXPORT_NORM can be enabled if: + * - 11-bit or smaller UNORM/SNORM/SRGB + * - 16-bit or smaller FLOAT + */ + if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS && + ((desc->channel[i].size < 12 && + desc->channel[i].type != UTIL_FORMAT_TYPE_FLOAT && + ntype != V_0280A0_NUMBER_UINT && ntype != V_0280A0_NUMBER_SINT) || + (desc->channel[i].size < 17 && + desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT))) + color_info |= S_0280A0_SOURCE_FORMAT(V_0280A0_EXPORT_NORM); } r600_pipe_state_add_reg(rstate, @@@ -798,7 -806,7 +811,7 @@@ (offset + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]); r600_pipe_state_add_reg(rstate, R_0280A0_CB_COLOR0_INFO + cb * 4, - color_info, color_info_mask, NULL); - color_info, 0xFFFFFFFF, bo[0]); ++ color_info, ~S_0280A0_BLEND_CLAMP(1), NULL); r600_pipe_state_add_reg(rstate, R_028060_CB_COLOR0_SIZE + cb * 4, S_028060_PITCH_TILE_MAX(pitch) | diff --cc src/gallium/winsys/r600/drm/r600_hw_context.c index 935ac07802e,0514bbeaba3..34ea2a6bacb --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@@ -1124,17 -1145,16 +1145,18 @@@ void r600_context_block_emit_dirty(stru if (block->pm4_bo_index[j]) { /* find relocation */ id = block->pm4_bo_index[j]; - r600_context_bo_reloc(ctx, - &block->pm4[block->reloc[id].bo_pm4_index], - block->reloc[id].bo); - r600_context_bo_flush(ctx, - block->reloc[id].flush_flags, - block->reloc[id].flush_mask, - block->reloc[id].bo); + if (block->reloc[id].bo) { + r600_context_bo_reloc(ctx, + &block->pm4[block->reloc[id].bo_pm4_index], + block->reloc[id].bo); + r600_context_bo_flush(ctx, + block->reloc[id].flush_flags, + block->reloc[id].flush_mask, + block->reloc[id].bo); + } } } + ctx->flags &= ~R600_CONTEXT_CHECK_EVENT_FLUSH; memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4); ctx->pm4_cdwords += block->pm4_ndwords;