Patch by Euan Kirkhope:

Sync overlay with x.org


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20277 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-03-01 09:41:37 +00:00
parent df647a5c3d
commit 0caeca2af7
2 changed files with 70 additions and 37 deletions
+1 -1
View File
@@ -8,4 +8,4 @@
*/ */
// current version // current version
#define RADEON_DRIVER_VERSION "Version: 5.1.4.5" #define RADEON_DRIVER_VERSION "Version: 5.1.4.9"
+69 -36
View File
@@ -102,6 +102,14 @@ void Radeon_InitOverlay(
Radeon_OUTPLLP( regs, si->asic, RADEON_VCLK_ECP_CNTL, Radeon_OUTPLLP( regs, si->asic, RADEON_VCLK_ECP_CNTL,
ecp_div << RADEON_ECP_DIV_SHIFT, ~RADEON_ECP_DIV_MASK ); ecp_div << RADEON_ECP_DIV_SHIFT, ~RADEON_ECP_DIV_MASK );
// Force the overlay clock on for integrated chips
if ((si->asic == rt_rs100) ||
(si->asic == rt_rs200) ||
(si->asic == rt_rs300)) {
Radeon_OUTPLL( regs, si->asic, RADEON_VCLK_ECP_CNTL,
(Radeon_INPLL( regs, si->asic, RADEON_VCLK_ECP_CNTL) | (1<<18)));
}
si->active_overlay.crtc_idx = si->pending_overlay.crtc_idx; si->active_overlay.crtc_idx = si->pending_overlay.crtc_idx;
// invalidate active colour space // invalidate active colour space
@@ -442,6 +450,7 @@ static space_params space_params_table[16] = {
// get appropriate scaling/filter parameters // get appropriate scaling/filter parameters
static hscale_factor *getHScaleFactor( static hscale_factor *getHScaleFactor(
accelerator_info *ai,
space_params *params, space_params *params,
uint32 src_left, uint32 src_right, uint32 *h_inc ) uint32 src_left, uint32 src_right, uint32 *h_inc )
{ {
@@ -450,64 +459,67 @@ static hscale_factor *getHScaleFactor(
uint i; uint i;
uint num_factors; uint num_factors;
hscale_factor *factors; hscale_factor *factors;
SHOW_FLOW0( 3, "" ); SHOW_FLOW0( 3, "" );
// check whether fifo is large enough to feed vertical 4-tap-filter // check whether fifo is large enough to feed vertical 4-tap-filter
words_per_p1_line = words_per_p1_line =
ceilShiftDiv( (src_right - 1) << params->bpp_shift, 4 ) - ceilShiftDiv( (src_right - 1) << params->bpp_shift, 4 ) -
((src_left << params->bpp_shift) >> 4) + 1; ((src_left << params->bpp_shift) >> 4) + 1;
words_per_p23_line = words_per_p23_line =
ceilShiftDiv( (src_right - 1) << params->bpuv_shift, 4 ) - ceilShiftDiv( (src_right - 1) << params->bpuv_shift, 4 ) -
((src_left << params->bpuv_shift) >> 4) + 1; ((src_left << params->bpuv_shift) >> 4) + 1;
// overlay buffer for one line; this value is probably
// higher on newer Radeons (or smaller on older Radeons?)
max_words_per_line = 96;
switch( params->num_planes ) { // overlay scaler line length differs for different revisions
case 3: // this needs to be maintained by hand
p1_4tap_allowed = words_per_p1_line < max_words_per_line / 2; if (ai->si->asic == rt_r200 || ai->si->asic >= rt_r300)
p23_4tap_allowed = words_per_p23_line < max_words_per_line / 4; max_words_per_line = 1920 / 16;
break; else
case 2: max_words_per_line = 1536 / 16;
p1_4tap_allowed = words_per_p1_line < max_words_per_line / 2;
p23_4tap_allowed = words_per_p23_line < max_words_per_line / 2; switch (params->num_planes) {
break; case 3:
case 1: p1_4tap_allowed = words_per_p1_line < max_words_per_line / 2;
default: p23_4tap_allowed = words_per_p23_line < max_words_per_line / 4;
p1_4tap_allowed = p23_4tap_allowed = words_per_p1_line < max_words_per_line; break;
break; case 2:
p1_4tap_allowed = words_per_p1_line < max_words_per_line / 2;
p23_4tap_allowed = words_per_p23_line < max_words_per_line / 2;
break;
case 1:
default:
p1_4tap_allowed = p23_4tap_allowed = words_per_p1_line < max_words_per_line;
break;
} }
SHOW_FLOW( 3, "p1_4tap_allowed=%d, p23_4t_allowed=%d", SHOW_FLOW( 3, "p1_4tap_allowed=%d, p23_4t_allowed=%d",
(int)p1_4tap_allowed, (int)p23_4tap_allowed ); (int)p1_4tap_allowed, (int)p23_4tap_allowed );
// search for proper scaling/filter entry // search for proper scaling/filter entry
factors = params->factors; factors = params->factors;
num_factors = params->num_factors; num_factors = params->num_factors;
if( factors == NULL || num_factors == 0 ) if (factors == NULL || num_factors == 0)
return NULL; return NULL;
for( i = 0; i < num_factors; ++i, ++factors ) { for (i = 0; i < num_factors; ++i, ++factors) {
if( *h_inc <= factors->max_scale && if (*h_inc <= factors->max_scale
(factors->p1_step_by > 0 || p1_4tap_allowed) && && (factors->p1_step_by > 0 || p1_4tap_allowed)
(factors->p23_step_by > 0 || p23_4tap_allowed)) && (factors->p23_step_by > 0 || p23_4tap_allowed))
break; break;
} }
if( i == num_factors ) { if (i == num_factors) {
// overlay is asked to be scaled down more than allowed, // overlay is asked to be scaled down more than allowed,
// so use least scaling factor supported // so use least scaling factor supported
--factors; --factors;
*h_inc = factors->max_scale; *h_inc = factors->max_scale;
} }
SHOW_FLOW( 3, "group_size=%d, p1_step_by=%d, p23_step_by=%d", SHOW_FLOW( 3, "group_size=%d, p1_step_by=%d, p23_step_by=%d",
factors->group_size, factors->p1_step_by, factors->p23_step_by ); factors->group_size, factors->p1_step_by, factors->p23_step_by );
return factors; return factors;
} }
@@ -542,6 +554,8 @@ static status_t Radeon_ShowOverlay(
uint32 p1_x_start, p1_x_end; uint32 p1_x_start, p1_x_end;
uint32 p23_x_start, p23_x_end; uint32 p23_x_start, p23_x_end;
uint scale_ctrl;
/*uint32 buffer[20*2]; /*uint32 buffer[20*2];
uint idx = 0;*/ uint idx = 0;*/
@@ -646,7 +660,7 @@ static status_t Radeon_ShowOverlay(
// choose proper scaler // choose proper scaler
{ {
factors = getHScaleFactor( params, src_left >> 16, src_right >> 16, &h_inc ); factors = getHScaleFactor( ai, params, src_left >> 16, src_right >> 16, &h_inc );
if( factors == NULL ) if( factors == NULL )
return B_ERROR; return B_ERROR;
@@ -871,12 +885,31 @@ static status_t Radeon_ShowOverlay(
OUTREG( regs, RADEON_OV0_P23_V_ACCUM_INIT, p23_v_accum_init ); OUTREG( regs, RADEON_OV0_P23_V_ACCUM_INIT, p23_v_accum_init );
OUTREG( regs, RADEON_OV0_TEST, node->test_reg ); OUTREG( regs, RADEON_OV0_TEST, node->test_reg );
OUTREG( regs, RADEON_OV0_SCALE_CNTL,
RADEON_SCALER_ENABLE | scale_ctrl = RADEON_SCALER_ENABLE |
RADEON_SCALER_DOUBLE_BUFFER | RADEON_SCALER_DOUBLE_BUFFER |
(node->ati_space << 8) | (node->ati_space << 8) |
/*RADEON_SCALER_ADAPTIVE_DEINT |*/ RADEON_SCALER_ADAPTIVE_DEINT |
(crtc->crtc_idx == 0 ? 0 : RADEON_SCALER_CRTC_SEL )); RADEON_SCALER_BURST_PER_PLANE |
(crtc->crtc_idx == 0 ? 0 : RADEON_SCALER_CRTC_SEL );
switch (node->ati_space << 8) {
case RADEON_SCALER_SOURCE_15BPP: // RGB15
case RADEON_SCALER_SOURCE_16BPP:
case RADEON_SCALER_SOURCE_32BPP:
OUTREG( regs, RADEON_OV0_SCALE_CNTL, scale_ctrl |
RADEON_SCALER_LIN_TRANS_BYPASS);
break;
case RADEON_SCALER_SOURCE_VYUY422: // VYUY422
case RADEON_SCALER_SOURCE_YVYU422: // YVYU422
OUTREG( regs, RADEON_OV0_SCALE_CNTL, scale_ctrl);
break;
default:
SHOW_FLOW(4, "What overlay format is this??? %d", node->ati_space);
OUTREG( regs, RADEON_OV0_SCALE_CNTL, scale_ctrl |
(( ai->si->asic >= rt_r200) ? R200_SCALER_TEMPORAL_DEINT : 0));
}
si->overlay_mgr.auto_flip_reg ^= RADEON_OV0_SOFT_EOF_TOGGLE; si->overlay_mgr.auto_flip_reg ^= RADEON_OV0_SOFT_EOF_TOGGLE;