OMAPDSS: DISPC: Writeback fixes
cover OMAPDSS: DISPC: Writeback fixes
Some issues were found in the DISPC driver when performing scaling with writeback pipeline. This series fixes those issues.
Reference tree:git://gitorious.org/~boddob/linux-omap-dss2/archit-dss2-clone.git 3.8/writeback_fixes_dispc
Archit Taneja (3):
OMAPDSS: DISPC: Fix calc_scaling_44xx() bugs for writeback pipeline
OMAPDSS: DISPC: Don't allow predecimation for writeback
OMAPDSS: DISPC: Use output width and height to calculate row/pix inc
for writeback
drivers/video/omap2/dss/dispc.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 OMAPDSS: DISPC: Fix calc_scaling_44xx() bugs for writeback pipeline
dispc_ovl_calc_scaling_44xx() doesn't work correctly for writeback. There are two issues with it:
- the function tries to calculate pixel clock for the input plane using dispc_plane_pclk_rate(), calling this with writeback as input plane results in a BUG(), this function shouldn't be called for writeback at all. Fix this by calculating pixel clock only when we are not in mem to mem mode.
- the maximum input_width is the product of the downscale ratio supported and the and the given output_width. This was calculated incorrectly by dividing output_width with maxdownscale. Fix this.
--- drivers/video/omap2/dss/dispc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/video/omap2/dss/dispc.c +6 -4
@@ -2264,14 +2264,16 @@ static int dispc_ovl_calc_scaling_44xx(enum omap_plane plane,u16 in_height =DIV_ROUND_UP (height, *decim_y);const int maxsinglelinewidth =dss_feat_get_param_max (FEAT_PARAM_LINEWIDTH ); -unsigned long pclk =dispc_plane_pclk_rate (plane);const int maxdownscale =dss_feat_get_param_max (FEAT_PARAM_DOWNSCALE ); -if (mem_to_mem) - in_width_max =DIV_ROUND_UP (out_width, maxdownscale); -else +if (mem_to_mem) { + in_width_max = out_width * maxdownscale; + }else { +unsigned long pclk =dispc_plane_pclk_rate (plane); + in_width_max =dispc_core_clk_rate () /DIV_ROUND_UP (pclk, out_width); + } *decim_x =DIV_ROUND_UP (width, in_width_max);
Signature · 1 line
1.7.9.5
PATCH 2/3 OMAPDSS: DISPC: Don't allow predecimation for writeback
In reply to Archit TanejaSince writeback writes to a buffer instead of reading from one, predecimation doesn't make sense for it. Configure the width and height predecimation limits to 1 if the plane is writeback.
--- drivers/video/omap2/dss/dispc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/video/omap2/dss/dispc.c +8 -3
@@ -2315,9 +2315,14 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane,if ((caps &OMAP_DSS_OVL_CAP_SCALE ) ==0 )return -EINVAL ; - *x_predecim = max_decim_limit; - *y_predecim = (rotation_type ==OMAP_DSS_ROT_TILER && -dss_has_feature (FEAT_BURST_2D )) ?2 : max_decim_limit; +if (plane ==OMAP_DSS_WB ) { + *x_predecim = *y_predecim =1 ; + }else { + *x_predecim = max_decim_limit; + *y_predecim = (rotation_type ==OMAP_DSS_ROT_TILER && +dss_has_feature (FEAT_BURST_2D )) ? +2 : max_decim_limit; + } if (color_mode == OMAP_DSS_COLOR_CLUT1 || color_mode == OMAP_DSS_COLOR_CLUT2 ||
Signature · 1 line
1.7.9.5
PATCH 3/3 OMAPDSS: DISPC: Use output width and height to calculate row/pix inc for writeback
In reply to Archit TanejaWhen calculating row and pixel increments for graphics and video pipes, we need to consider the dimensions of the input frame to know how to read from the buffer. Hence, we need to calculate these parameters from the input to the pipeline.
For writeback, the row and pixel increments need to be calculated based on the output of the writeback pipeline, i.e, the dimensions of the frame after scaling. Ensure that dispc driver uses values of out_width and out_height when calling calc_dma/calc_tiler_rotation_offset.
For graphics and video pipes, the original code passed the original height as frame_height to calc_dma_rotation_offset, and not the predecimated height. This is left as it is for now. We need to figure out why pre decimated height isn't needed.
--- drivers/video/omap2/dss/dispc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/video/omap2/dss/dispc.c +13 -5
@@ -2381,7 +2381,7 @@ static int dispc_ovl_setup_common(enum omap_plane plane,unsigned offset0, offset1;s32 row_inc;s32 pix_inc; -u16 frame_height = height; +u16 frame_width, frame_height;unsigned int field_offset =0 ;u16 in_height = height;u16 in_width = width;
@@ -2449,20 +2449,28 @@ static int dispc_ovl_setup_common(enum omap_plane plane, row_inc =0 ; pix_inc =0 ; +if (plane ==OMAP_DSS_WB ) { + frame_width = out_width; + frame_height = out_height; + }else { + frame_width = in_width; + frame_height = height; + } +if (rotation_type ==OMAP_DSS_ROT_TILER ) -calc_tiler_rotation_offset (screen_width, in_width, +calc_tiler_rotation_offset (screen_width, frame_width, color_mode, fieldmode, field_offset, &offset0, &offset1, &row_inc, &pix_inc, x_predecim, y_predecim);else if (rotation_type ==OMAP_DSS_ROT_DMA ) -calc_dma_rotation_offset (rotation, mirror, - screen_width, in_width, frame_height, +calc_dma_rotation_offset (rotation, mirror, screen_width, + frame_width, frame_height, color_mode, fieldmode, field_offset, &offset0, &offset1, &row_inc, &pix_inc, x_predecim, y_predecim);else calc_vrfb_rotation_offset (rotation, mirror, - screen_width, in_width, frame_height, + screen_width, frame_width, frame_height, color_mode, fieldmode, field_offset, &offset0, &offset1, &row_inc, &pix_inc, x_predecim, y_predecim);
Signature · 1 line
1.7.9.5
Quoted 6 lines · Archit Taneja
Some issues were found in the DISPC driver when performing scaling with writeback pipeline. This series fixes those issues.
Reference tree:
git://gitorious.org/~boddob/linux-omap-dss2/archit-dss2-clone.git3.8/writeback_fixes_dispc
Quoted 9 lines
Archit Taneja (3):
OMAPDSS: DISPC: Fixcalc_scaling_44xx()bugs for writeback pipeline
OMAPDSS: DISPC: Don't allow predecimation for writeback
OMAPDSS: DISPC: Use output width and height to calculate row/pix inc
for writebackdrivers/video/omap2/dss/dispc.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-)
Thanks, looks ok. I'll apply to omapdss tree.
Tomi