Skip to content

Commit 65e006f

Browse files
chandrabhanu-mahapatratomba
authored andcommitted
OMAPDSS: DISPC: Support rotation through TILER
TILER is a block in OMAP4's DMM which lets DSS fetch frames in a rotated manner. Physical memory can be mapped to a portion of OMAP's system address space called TILER address space. The TILER address space is split into 8 views. Each view represents a rotated or mirrored form of the mapped physical memory. When a DISPC overlay's base address is programmed to one of these views, the TILER fetches the pixels according to the orientation of the view. A view is further split into 4 containers, each container holds elements of a particular size. Rotation can be achieved at the granularity of elements in the container. For more information on TILER, refer to the Memory Subsytem section in OMAP4 TRM. Rotation type TILER has been added which is used to exploit the capabilities of these 8 views for performing various rotations. When fetching from addresses mapped to TILER space, the DISPC DMA can fetch pixels in either 1D or 2D bursts. The fetch depends on which TILER container we are accessing. Accessing 8, 16 and 32 bit sized containers requires 2D bursts, and page mode sized containers require 1D bursts. The DSS2 user is expected to provide the Tiler address of the view that it is interested in. This is passed to the paddr and p_uv_addr parameters in omap_overlay_info. It is also expected to provide the stride value based on the view's orientation and container type, this should be passed to the screen_width parameter of omap_overlay_info. In calc_tiler_rotation_offset screen_width is used to calculate the required row_inc for DISPC. x_predecim and y_predecim are also used to calculate row_inc and pix_inc thereby adding predecimation support for TILER. Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent 3cb6a1b commit 65e006f

5 files changed

Lines changed: 87 additions & 3 deletions

File tree

‎drivers/video/omap2/dss/dispc.c‎

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,18 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane,
785785
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1);
786786
}
787787

788+
static void dispc_ovl_configure_burst_type(enum omap_plane plane,
789+
enum omap_dss_rotation_type rotation_type)
790+
{
791+
if (dss_has_feature(FEAT_BURST_2D) == 0)
792+
return;
793+
794+
if (rotation_type == OMAP_DSS_ROT_TILER)
795+
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), 1, 29, 29);
796+
else
797+
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), 0, 29, 29);
798+
}
799+
788800
void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel channel)
789801
{
790802
int shift;
@@ -1731,6 +1743,45 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
17311743
}
17321744
}
17331745

1746+
static void calc_tiler_rotation_offset(u16 screen_width, u16 width,
1747+
enum omap_color_mode color_mode, bool fieldmode,
1748+
unsigned int field_offset, unsigned *offset0, unsigned *offset1,
1749+
s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim)
1750+
{
1751+
u8 ps;
1752+
1753+
switch (color_mode) {
1754+
case OMAP_DSS_COLOR_CLUT1:
1755+
case OMAP_DSS_COLOR_CLUT2:
1756+
case OMAP_DSS_COLOR_CLUT4:
1757+
case OMAP_DSS_COLOR_CLUT8:
1758+
BUG();
1759+
return;
1760+
default:
1761+
ps = color_mode_to_bpp(color_mode) / 8;
1762+
break;
1763+
}
1764+
1765+
DSSDBG("scrw %d, width %d\n", screen_width, width);
1766+
1767+
/*
1768+
* field 0 = even field = bottom field
1769+
* field 1 = odd field = top field
1770+
*/
1771+
*offset1 = 0;
1772+
if (field_offset)
1773+
*offset0 = *offset1 + field_offset * screen_width * ps;
1774+
else
1775+
*offset0 = *offset1;
1776+
*row_inc = pixinc(1 + (y_predecim * screen_width - width * x_predecim) +
1777+
(fieldmode ? screen_width : 0), ps);
1778+
if (color_mode == OMAP_DSS_COLOR_YUV2 ||
1779+
color_mode == OMAP_DSS_COLOR_UYVY)
1780+
*pix_inc = pixinc(x_predecim, 2 * ps);
1781+
else
1782+
*pix_inc = pixinc(x_predecim, ps);
1783+
}
1784+
17341785
/*
17351786
* This function is used to avoid synclosts in OMAP3, because of some
17361787
* undocumented horizontal position and timing related limitations.
@@ -2122,7 +2173,12 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
21222173
row_inc = 0;
21232174
pix_inc = 0;
21242175

2125-
if (oi->rotation_type == OMAP_DSS_ROT_DMA)
2176+
if (oi->rotation_type == OMAP_DSS_ROT_TILER)
2177+
calc_tiler_rotation_offset(oi->screen_width, in_width,
2178+
oi->color_mode, fieldmode, field_offset,
2179+
&offset0, &offset1, &row_inc, &pix_inc,
2180+
x_predecim, y_predecim);
2181+
else if (oi->rotation_type == OMAP_DSS_ROT_DMA)
21262182
calc_dma_rotation_offset(oi->rotation, oi->mirror,
21272183
oi->screen_width, in_width, frame_height,
21282184
oi->color_mode, fieldmode, field_offset,
@@ -2140,6 +2196,8 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
21402196

21412197
dispc_ovl_set_color_mode(plane, oi->color_mode);
21422198

2199+
dispc_ovl_configure_burst_type(plane, oi->rotation_type);
2200+
21432201
dispc_ovl_set_ba0(plane, oi->paddr + offset0);
21442202
dispc_ovl_set_ba1(plane, oi->paddr + offset1);
21452203

‎drivers/video/omap2/dss/dss_features.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ struct omap_dss_features {
5252
const char * const *clksrc_names;
5353
const struct dss_param_range *dss_params;
5454

55+
const enum omap_dss_rotation_type supported_rotation_types;
56+
5557
const u32 buffer_size_unit;
5658
const u32 burst_size_unit;
5759
};
@@ -405,6 +407,7 @@ static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
405407
FEAT_FIR_COEF_V,
406408
FEAT_ALPHA_FREE_ZORDER,
407409
FEAT_FIFO_MERGE,
410+
FEAT_BURST_2D,
408411
};
409412

410413
static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
@@ -422,6 +425,7 @@ static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
422425
FEAT_FIR_COEF_V,
423426
FEAT_ALPHA_FREE_ZORDER,
424427
FEAT_FIFO_MERGE,
428+
FEAT_BURST_2D,
425429
};
426430

427431
static const enum dss_feat_id omap4_dss_feat_list[] = {
@@ -440,6 +444,7 @@ static const enum dss_feat_id omap4_dss_feat_list[] = {
440444
FEAT_FIR_COEF_V,
441445
FEAT_ALPHA_FREE_ZORDER,
442446
FEAT_FIFO_MERGE,
447+
FEAT_BURST_2D,
443448
};
444449

445450
/* OMAP2 DSS Features */
@@ -457,6 +462,7 @@ static const struct omap_dss_features omap2_dss_features = {
457462
.overlay_caps = omap2_dss_overlay_caps,
458463
.clksrc_names = omap2_dss_clk_source_names,
459464
.dss_params = omap2_dss_param_range,
465+
.supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
460466
.buffer_size_unit = 1,
461467
.burst_size_unit = 8,
462468
};
@@ -476,6 +482,7 @@ static const struct omap_dss_features omap3430_dss_features = {
476482
.overlay_caps = omap3430_dss_overlay_caps,
477483
.clksrc_names = omap3_dss_clk_source_names,
478484
.dss_params = omap3_dss_param_range,
485+
.supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
479486
.buffer_size_unit = 1,
480487
.burst_size_unit = 8,
481488
};
@@ -494,6 +501,7 @@ static const struct omap_dss_features omap3630_dss_features = {
494501
.overlay_caps = omap3630_dss_overlay_caps,
495502
.clksrc_names = omap3_dss_clk_source_names,
496503
.dss_params = omap3_dss_param_range,
504+
.supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
497505
.buffer_size_unit = 1,
498506
.burst_size_unit = 8,
499507
};
@@ -514,6 +522,7 @@ static const struct omap_dss_features omap4430_es1_0_dss_features = {
514522
.overlay_caps = omap4_dss_overlay_caps,
515523
.clksrc_names = omap4_dss_clk_source_names,
516524
.dss_params = omap4_dss_param_range,
525+
.supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
517526
.buffer_size_unit = 16,
518527
.burst_size_unit = 16,
519528
};
@@ -533,6 +542,7 @@ static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
533542
.overlay_caps = omap4_dss_overlay_caps,
534543
.clksrc_names = omap4_dss_clk_source_names,
535544
.dss_params = omap4_dss_param_range,
545+
.supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
536546
.buffer_size_unit = 16,
537547
.burst_size_unit = 16,
538548
};
@@ -552,6 +562,7 @@ static const struct omap_dss_features omap4_dss_features = {
552562
.overlay_caps = omap4_dss_overlay_caps,
553563
.clksrc_names = omap4_dss_clk_source_names,
554564
.dss_params = omap4_dss_param_range,
565+
.supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
555566
.buffer_size_unit = 16,
556567
.burst_size_unit = 16,
557568
};
@@ -672,6 +683,11 @@ void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
672683
*end = omap_current_dss_features->reg_fields[id].end;
673684
}
674685

686+
bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
687+
{
688+
return omap_current_dss_features->supported_rotation_types & rot_type;
689+
}
690+
675691
void dss_features_init(void)
676692
{
677693
if (cpu_is_omap24xx())

‎drivers/video/omap2/dss/dss_features.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ enum dss_feat_id {
6262
FEAT_FIFO_MERGE,
6363
/* An unknown HW bug causing the normal FIFO thresholds not to work */
6464
FEAT_OMAP3_DSI_FIFO_BUG,
65+
FEAT_BURST_2D,
6566
};
6667

6768
/* DSS register field id */
@@ -110,6 +111,8 @@ const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id);
110111
u32 dss_feat_get_buffer_size_unit(void); /* in bytes */
111112
u32 dss_feat_get_burst_size_unit(void); /* in bytes */
112113

114+
bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type);
115+
113116
bool dss_has_feature(enum dss_feat_id id);
114117
void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
115118
void dss_features_init(void);

‎drivers/video/omap2/dss/overlay.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,12 @@ int dss_ovl_simple_check(struct omap_overlay *ovl,
628628
return -EINVAL;
629629
}
630630

631+
if (dss_feat_rotation_type_supported(info->rotation_type) == 0) {
632+
DSSERR("check_overlay: rotation type %d not supported\n",
633+
info->rotation_type);
634+
return -EINVAL;
635+
}
636+
631637
return 0;
632638
}
633639

‎include/video/omapdss.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ enum omap_dss_overlay_managers {
175175
};
176176

177177
enum omap_dss_rotation_type {
178-
OMAP_DSS_ROT_DMA = 0,
179-
OMAP_DSS_ROT_VRFB = 1,
178+
OMAP_DSS_ROT_DMA = 1 << 0,
179+
OMAP_DSS_ROT_VRFB = 1 << 1,
180+
OMAP_DSS_ROT_TILER = 1 << 2,
180181
};
181182

182183
/* clockwise rotation angle */

0 commit comments

Comments
 (0)