OMAP4: DSS2: VIDEO3 pipeline support
PATCH v3 4/10 OMAP4: DSS2: VIDEO3 pipeline support
Add support for VIDEO3 pipeline on OMAP4:
- Add VIDEO3 pipeline information in dss_features and omapdss.h
- Add VIDEO3 pipeline register coefficients in dispc.h
- Create a new overlay structure corresponding to VIDEO3.
- Make changes in dispc.c for VIDEO3
--- drivers/video/omap2/dss/dispc.c | 17 ++++++++-- drivers/video/omap2/dss/dispc.h | 57 ++++++++++++++++++++++++++++++++ drivers/video/omap2/dss/dss_features.c | 18 +++++++++- drivers/video/omap2/dss/dss_features.h | 2 +- drivers/video/omap2/dss/overlay.c | 5 +++ include/video/omapdss.h | 5 ++- 6 files changed, 97 insertions(+), 7 deletions(-)
drivers/video/omap2/dss/dispc.c +14 -3
@@ -738,7 +738,7 @@ static void dispc_ovl_set_pre_mult_alpha(enum omap_plane plane, bool enable)static void dispc_ovl_setup_global_alpha (enum omap_plane plane,u8 global_alpha) { -static const unsigned shifts[] = {0 ,8 ,16 , }; +static const unsigned shifts[] = {0 ,8 ,16 ,24 , };int shift;struct omap_overlay *ovl =omap_dss_get_overlay (plane);
@@ -853,6 +853,7 @@ static void dispc_ovl_set_channel_out(enum omap_plane plane,break ;case OMAP_DSS_VIDEO1 :case OMAP_DSS_VIDEO2 : +case OMAP_DSS_VIDEO3 : shift =16 ;break ;default :
@@ -890,7 +891,7 @@ static void dispc_ovl_set_channel_out(enum omap_plane plane,static void dispc_ovl_set_burst_size (enum omap_plane plane,enum omap_burst_size burst_size) { -static const unsigned shifts[] = {6 ,14 ,14 , }; +static const unsigned shifts[] = {6 ,14 ,14 ,14 , };int shift; shift = shifts[plane];
@@ -975,7 +976,7 @@ static void dispc_ovl_set_vid_color_conv(enum omap_plane plane, bool enable)static void dispc_ovl_enable_replication (enum omap_plane plane,bool enable) { -static const unsigned shifts[] = {5 ,10 ,10 }; +static const unsigned shifts[] = {5 ,10 ,10 ,10 };int shift; shift = shifts[plane];
@@ -2518,6 +2519,10 @@ void dispc_dump_irqs(struct seq_file *s)PIS (VID1_END_WIN );PIS (VID2_FIFO_UNDERFLOW );PIS (VID2_END_WIN ); +if (dss_feat_get_num_ovls () >3 ) { +PIS (VID3_FIFO_UNDERFLOW ); +PIS (VID3_END_WIN ); + }PIS (SYNC_LOST );PIS (SYNC_LOST_DIGIT );PIS (WAKEUP );
@@ -2543,6 +2548,7 @@ void dispc_dump_regs(struct seq_file *s) [OMAP_DSS_GFX] = "GFX", [OMAP_DSS_VIDEO1] = "VID1", [OMAP_DSS_VIDEO2] = "VID2", + [OMAP_DSS_VIDEO3] = "VID3", };const char **p_names;
@@ -2945,6 +2951,8 @@ static void print_irq_status(u32 status)PIS (OCP_ERR );PIS (VID1_FIFO_UNDERFLOW );PIS (VID2_FIFO_UNDERFLOW ); +if (dss_feat_get_num_ovls () >3 ) +PIS (VID3_FIFO_UNDERFLOW );PIS (SYNC_LOST );PIS (SYNC_LOST_DIGIT );if (dss_has_feature (FEAT_MGR_LCD2 ))
@@ -3042,6 +3050,7 @@ static void dispc_error_worker(struct work_struct *work)DISPC_IRQ_GFX_FIFO_UNDERFLOW ,DISPC_IRQ_VID1_FIFO_UNDERFLOW ,DISPC_IRQ_VID2_FIFO_UNDERFLOW , + DISPC_IRQ_VID3_FIFO_UNDERFLOW, }; static const unsigned sync_lost_bits[] = {
@@ -3217,6 +3226,8 @@ static void _omap_dispc_initialize_irq(void) dispc.irq_error_mask =DISPC_IRQ_MASK_ERROR ;if (dss_has_feature (FEAT_MGR_LCD2 )) dispc.irq_error_mask |=DISPC_IRQ_SYNC_LOST2 ; +if (dss_feat_get_num_ovls () >3 ) + dispc.irq_error_mask |=DISPC_IRQ_VID3_FIFO_UNDERFLOW ;/* there's SYNC_LOST_DIGIT waiting after enabling the DSS, * so clear it */
drivers/video/omap2/dss/dispc.h +57 -0
237 lines not on this page · raw message
drivers/video/omap2/dss/dss_features.c +16 -2
@@ -210,6 +210,16 @@ static const enum omap_color_mode omap4_dss_supported_color_modes[] = {OMAP_DSS_COLOR_ARGB16 |OMAP_DSS_COLOR_XRGB16_1555 |OMAP_DSS_COLOR_ARGB32 |OMAP_DSS_COLOR_RGBX16 |OMAP_DSS_COLOR_RGBX32 , + +/* OMAP_DSS_VIDEO3 */ +OMAP_DSS_COLOR_RGB16 |OMAP_DSS_COLOR_RGB12U | +OMAP_DSS_COLOR_YUV2 |OMAP_DSS_COLOR_ARGB16_1555 | +OMAP_DSS_COLOR_RGBA32 |OMAP_DSS_COLOR_NV12 | +OMAP_DSS_COLOR_RGBA16 |OMAP_DSS_COLOR_RGB24U | +OMAP_DSS_COLOR_RGB24P |OMAP_DSS_COLOR_UYVY | +OMAP_DSS_COLOR_ARGB16 |OMAP_DSS_COLOR_XRGB16_1555 | +OMAP_DSS_COLOR_ARGB32 |OMAP_DSS_COLOR_RGBX16 | + OMAP_DSS_COLOR_RGBX32, }; static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
@@ -258,6 +268,10 @@ static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {/* OMAP_DSS_VIDEO2 */ OMAP_DSS_OVL_CAP_SCALE |OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |OMAP_DSS_OVL_CAP_ZORDER , + +/* OMAP_DSS_VIDEO3 */ +OMAP_DSS_OVL_CAP_SCALE |OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | + OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER, }; static const char * const omap2_dss_clk_source_names[] = {
@@ -398,7 +412,7 @@ static const struct omap_dss_features omap4430_es1_0_dss_features = { FEAT_ALPHA_FREE_ZORDER, .num_mgrs = 3, - .num_ovls = 3, + .num_ovls = 4, .supported_displays = omap4_dss_supported_displays, .supported_color_modes = omap4_dss_supported_color_modes, .overlay_caps = omap4_dss_overlay_caps,
@@ -422,7 +436,7 @@ static const struct omap_dss_features omap4_dss_features = { FEAT_PRELOAD | FEAT_FIR_COEF_V | FEAT_ALPHA_FREE_ZORDER, .num_mgrs = 3, - .num_ovls = 3, + .num_ovls = 4, .supported_displays = omap4_dss_supported_displays, .supported_color_modes = omap4_dss_supported_color_modes, .overlay_caps = omap4_dss_overlay_caps,
drivers/video/omap2/dss/dss_features.h +1 -1
@@ -25,7 +25,7 @@#endif #define MAX_DSS_MANAGERS 3 -#define MAX_DSS_OVERLAYS 3 +#define MAX_DSS_OVERLAYS 4#define MAX_DSS_LCD_MANAGERS 2#define MAX_NUM_DSI 2
drivers/video/omap2/dss/overlay.c +5 -0
@@ -615,6 +615,11 @@ void dss_init_overlays(struct platform_device *pdev) ovl->id =OMAP_DSS_VIDEO2 ; ovl->info.global_alpha =255 ;break ; +case 3 : + ovl->name ="vid3" ; + ovl->id =OMAP_DSS_VIDEO3 ; + ovl->info.global_alpha =255 ; +break ; } ovl->set_manager = &omap_dss_set_manager;
include/video/omapdss.h +4 -1
@@ -41,6 +41,8 @@#define DISPC_IRQ_WAKEUP (1 << 16)#define DISPC_IRQ_SYNC_LOST2 (1 << 17)#define DISPC_IRQ_VSYNC2 (1 << 18) +#define DISPC_IRQ_VID3_END_WIN (1 << 19) +#define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)#define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)#define DISPC_IRQ_FRAMEDONE2 (1 << 22)#define DISPC_IRQ_FRAMEDONEWB (1 << 23)
@@ -63,7 +65,8 @@ enum omap_display_type {enum omap_plane {OMAP_DSS_GFX =0 ,OMAP_DSS_VIDEO1 =1 , -OMAP_DSS_VIDEO2 =2 +OMAP_DSS_VIDEO2 =2 , +OMAP_DSS_VIDEO3 =3 , };enum omap_channel {
Signature · 1 line
1.7.1
PATCH v3 5/10 OMAP4: DSS2: zorder support for DSS overlays
Add zorder support on OMAP4, this feature allows deciding the visibility order of the overlays based on the zorder value provided as an overlay info parameter or a sysfs attribute of the overlay object.
Use the overlay cap OMAP_DSS_OVL_CAP_ZORDER to determine whether zorder is supported for the overlay or not. Use dss feature FEAT_ALPHA_FREE_ZORDER if the caps are not available.
Ensure that all overlays that are enabled and connected to the same manager have different zorders. Swapping zorders of 2 enabled overlays currently requires disabling one of the overlays.
--- drivers/video/omap2/dss/dispc.c | 24 ++++++++++++ drivers/video/omap2/dss/overlay.c | 72 +++++++++++++++++++++++++++++++++++++ include/video/omapdss.h | 1 + 3 files changed, 97 insertions(+), 0 deletions(-)
drivers/video/omap2/dss/dispc.c +24 -0
@@ -726,6 +726,27 @@ static void dispc_ovl_set_vid_size(enum omap_plane plane, int width, int height)dispc_write_reg (DISPC_OVL_SIZE (plane), val); } +static void dispc_ovl_set_zorder (enum omap_plane plane,u8 zorder) +{ +struct omap_overlay *ovl =omap_dss_get_overlay (plane); + +if ((ovl->caps &OMAP_DSS_OVL_CAP_ZORDER ) ==0 ) +return ; + +REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), zorder,27 ,26 ); +} + +static void dispc_ovl_enable_zorder_planes (void ) +{ +int i; + +if (!dss_has_feature (FEAT_ALPHA_FREE_ZORDER )) +return ; + +for (i =0 ; i <dss_feat_get_num_ovls (); i++) +REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (i),1 ,25 ,25 ); +} +static void dispc_ovl_set_pre_mult_alpha (enum omap_plane plane,bool enable) {struct omap_overlay *ovl =omap_dss_get_overlay (plane);
@@ -1840,6 +1861,7 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,dispc_ovl_set_rotation_attrs (plane, oi->rotation, oi->mirror, oi->color_mode); +dispc_ovl_set_zorder (plane, oi->zorder);dispc_ovl_set_pre_mult_alpha (plane, oi->pre_mult_alpha);dispc_ovl_setup_global_alpha (plane, oi->global_alpha);
@@ -3277,6 +3299,8 @@ static void _omap_dispc_initial_config(void)dispc_read_plane_fifo_sizes ();dispc_configure_burst_sizes (); + +dispc_ovl_enable_zorder_planes (); }/* DISPC HW IP initialisation */
drivers/video/omap2/dss/overlay.c +72 -0
123 lines not on this page · raw message
include/video/omapdss.h +1 -0
@@ -371,6 +371,7 @@ struct omap_overlay_info {u16 out_height;/* if 0, out_height == height */ u8 global_alpha;u8 pre_mult_alpha; +u8 zorder; };struct omap_overlay {
Signature · 1 line
1.7.1
PATCH v3 6/10 OMAP: DSS2: Create helper function dispc_mgr_is_lcd()
In reply to Archit TanejaCreate a helper function called dispc_mgr_is_lcd() which returns true if the manager is LCD or LCD2.
--- drivers/video/omap2/dss/dispc.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-)
drivers/video/omap2/dss/dispc.c +13 -9
@@ -420,13 +420,20 @@ void dispc_runtime_put(void)WARN_ON (r <0 ); } +static inline bool dispc_mgr_is_lcd (enum omap_channel channel) +{ +if (channel ==OMAP_DSS_CHANNEL_LCD || + channel ==OMAP_DSS_CHANNEL_LCD2 ) +return true; +else +return false; +}bool dispc_mgr_go_busy (enum omap_channel channel) {int bit; -if (channel ==OMAP_DSS_CHANNEL_LCD || - channel ==OMAP_DSS_CHANNEL_LCD2 ) +if (dispc_mgr_is_lcd (channel)) bit =5 ;/* GOLCD */ else bit =6 ;/* GODIGIT */
@@ -442,8 +449,7 @@ void dispc_mgr_go(enum omap_channel channel)int bit;bool enable_bit, go_bit; -if (channel ==OMAP_DSS_CHANNEL_LCD || - channel ==OMAP_DSS_CHANNEL_LCD2 ) +if (dispc_mgr_is_lcd (channel)) bit =0 ;/* LCDENABLE */ else bit =1 ;/* DIGITALENABLE */
@@ -457,8 +463,7 @@ void dispc_mgr_go(enum omap_channel channel)if (!enable_bit)return ; -if (channel ==OMAP_DSS_CHANNEL_LCD || - channel ==OMAP_DSS_CHANNEL_LCD2 ) +if (dispc_mgr_is_lcd (channel)) bit =5 ;/* GOLCD */ else bit =6 ;/* GODIGIT */
@@ -969,7 +974,7 @@ void dispc_mgr_set_cpr_coef(enum omap_channel channel, {u32 coef_r, coef_g, coef_b; -if (channel !=OMAP_DSS_CHANNEL_LCD && channel !=OMAP_DSS_CHANNEL_LCD2 ) +if (!dispc_mgr_is_lcd (channel))return ; coef_r = FLD_VAL(coefs->rr, 31, 22) | FLD_VAL(coefs->rg, 20, 11) |
@@ -2026,8 +2031,7 @@ bool dispc_mgr_is_enabled(enum omap_channel channel)void dispc_mgr_enable (enum omap_channel channel,bool enable) { -if (channel ==OMAP_DSS_CHANNEL_LCD || - channel ==OMAP_DSS_CHANNEL_LCD2 ) +if (dispc_mgr_is_lcd (channel))dispc_mgr_enable_lcd_out (channel, enable);else if (channel ==OMAP_DSS_CHANNEL_DIGIT )dispc_mgr_enable_digit_out (enable);
Signature · 1 line
1.7.1
PATCH 7/10 v3 OMAP2PLUS: DSS2: Get correct pixel clock for TV manager
In reply to Archit Tanejadispc_mgr_pclk_rate() is used to calculate minimum required functional clock for scaling in calc_fclk() and calc_fclk_five_taps(). This function returns the correct pixel clock for LCD and LCD2 managers, but not for TV manager. Extend this function so that it gets the correct pixel clock for TV manager.
This also prevents the crash we get when we try to scale overlays connected to TV manager. The current code leads to a BUG() being executed if we call dispc_mgr_pclk_rate() for the TV manager.
--- drivers/video/omap2/dss/dispc.c | 37 +++++++++++++++++++++++++++++-------- drivers/video/omap2/dss/dss.h | 12 ++++++++++++ drivers/video/omap2/dss/hdmi.c | 6 ++++++ drivers/video/omap2/dss/venc.c | 8 +++++--- 4 files changed, 52 insertions(+), 11 deletions(-)
drivers/video/omap2/dss/dispc.c +29 -8
@@ -429,6 +429,14 @@ static inline bool dispc_mgr_is_lcd(enum omap_channel channel)return false; } +static struct omap_dss_device *dispc_mgr_get_device (enum omap_channel channel) +{ +struct omap_overlay_manager *mgr = +omap_dss_get_overlay_manager (channel); + +return mgr ? mgr->device :NULL ; +} +bool dispc_mgr_go_busy (enum omap_channel channel) {int bit;
@@ -1643,7 +1651,6 @@ static unsigned long calc_fclk_five_taps(enum omap_channel channel, u16 width, enum omap_color_mode color_mode) {u32 fclk =0 ; -/* FIXME venc pclk? */ u64 tmp, pclk =dispc_mgr_pclk_rate (channel);if (height > out_height) {
@@ -1700,7 +1707,6 @@ static unsigned long calc_fclk(enum omap_channel channel, u16 width,else vf =1 ; -/* FIXME venc pclk? */ return dispc_mgr_pclk_rate (channel) * vf * hf; }
@@ -2437,17 +2443,32 @@ unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)unsigned long dispc_mgr_pclk_rate (enum omap_channel channel) { -int pcd;unsigned long r; -u32 l; - l =dispc_read_reg (DISPC_DIVISORo (channel)); +if (dispc_mgr_is_lcd (channel)) { +int pcd; +u32 l; - pcd =FLD_GET (l,7 ,0 ); + l =dispc_read_reg (DISPC_DIVISORo (channel)); - r =dispc_mgr_lclk_rate (channel); + pcd =FLD_GET (l,7 ,0 ); -return r / pcd; + r =dispc_mgr_lclk_rate (channel); + +return r / pcd; + }else { +struct omap_dss_device *dssdev = +dispc_mgr_get_device (channel); + +switch (dssdev->type) { +case OMAP_DISPLAY_TYPE_VENC : +return venc_get_pixel_clock (); +case OMAP_DISPLAY_TYPE_HDMI : +return hdmi_get_pixel_clock (); +default : +BUG (); + } + } }void dispc_dump_clocks (struct seq_file *s)
drivers/video/omap2/dss/dss.h +12 -0
@@ -450,6 +450,7 @@ int venc_init_platform_driver(void);void venc_uninit_platform_driver (void );void venc_dump_regs (struct seq_file *s);int venc_init_display (struct omap_dss_device *display); +unsigned long venc_get_pixel_clock (void );#else static inline int venc_init_platform_driver (void ) {
@@ -458,6 +459,11 @@ static inline int venc_init_platform_driver(void)static inline void venc_uninit_platform_driver (void ) { } +static inline unsigned long venc_get_pixel_clock (void ) +{ +WARN ("%s: VENC not compiled in, returning pclk as 0\n" , __func__); +return 0 ; +}#endif /* HDMI */
@@ -465,6 +471,7 @@ static inline void venc_uninit_platform_driver(void)int hdmi_init_platform_driver (void );void hdmi_uninit_platform_driver (void );int hdmi_init_display (struct omap_dss_device *dssdev); +unsigned long hdmi_get_pixel_clock (void );#else static inline int hdmi_init_display (struct omap_dss_device *dssdev) {
@@ -477,6 +484,11 @@ static inline int hdmi_init_platform_driver(void)static inline void hdmi_uninit_platform_driver (void ) { } +static inline unsigned long hdmi_get_pixel_clock (void ) +{ +WARN ("%s: HDMI not compiled in, returning pclk as 0\n" , __func__); +return 0 ; +}#endif int omapdss_hdmi_display_enable (struct omap_dss_device *dssdev);void omapdss_hdmi_display_disable (struct omap_dss_device *dssdev);
drivers/video/omap2/dss/hdmi.c +6 -0
@@ -266,6 +266,12 @@ static void update_hdmi_timings(struct hdmi_config *cfg, cfg->timings.hsync_pol = cea_vesa_timings[code].hsync_pol; } +unsigned long hdmi_get_pixel_clock (void ) +{ +/* HDMI Pixel Clock in Mhz */ +return hdmi.ip_data.cfg.timings.timings.pixel_clock *10000 ; +} +static void hdmi_compute_pll (struct omap_dss_device *dssdev,int phy,struct hdmi_pll_info *pi) {
drivers/video/omap2/dss/venc.c +5 -3
@@ -463,9 +463,11 @@ static void venc_power_off(struct omap_dss_device *dssdev)regulator_disable (venc.vdda_dac_reg); } - - - +unsigned long venc_get_pixel_clock (void ) +{ +/* VENC Pixel Clock in Mhz */ +return 13500000 ; +}/* driver */ static int venc_panel_probe (struct omap_dss_device *dssdev)
Signature · 1 line
1.7.1
PATCH 8/10 OMAP2PLUS: DSS2: DISPC: Remove hardcoded use of PPL in five tap clock calculation
In reply to Archit TanejaThe function calc_fclk_five_taps() uses a fixed value of pixels per line which is used in calculations to get the minimum fclk needed for scaling with five taps to work.
Remove this by providing the width of the panel connected to the manager.
--- drivers/video/omap2/dss/dispc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/video/omap2/dss/dispc.c +2 -2
@@ -1654,8 +1654,8 @@ static unsigned long calc_fclk_five_taps(enum omap_channel channel, u16 width,u64 tmp, pclk =dispc_mgr_pclk_rate (channel);if (height > out_height) { -/* FIXME get real display PPL */ -unsigned int ppl =800 ; +struct omap_dss_device *dssdev =dispc_mgr_get_device (channel); +unsigned int ppl = dssdev->panel.timings.x_res; tmp = pclk * height * out_width;do_div (tmp,2 * out_height * ppl);
Signature · 1 line
1.7.1
PATCH 9/10 OMAP2PLUS: DSS2: Clean up DISPC scaling related clock and five tap calculations
In reply to Archit TanejaMove DISPC scaling related code from dispc_ovl_setup() to a new function dispc_ovl_calc_scaling(). Use overlay caps to check if the overlay can scale or not. No functional changes are made.
--- drivers/video/omap2/dss/dispc.c | 131 ++++++++++++++++++++++----------------- 1 files changed, 73 insertions(+), 58 deletions(-)
drivers/video/omap2/dss/dispc.c +73 -58
@@ -1710,14 +1710,74 @@ static unsigned long calc_fclk(enum omap_channel channel, u16 width,return dispc_mgr_pclk_rate (channel) * vf * hf; } +static int dispc_ovl_calc_scaling (enum omap_plane plane, +enum omap_channel channel,u16 width,u16 height, +u16 out_width,u16 out_height, +enum omap_color_mode color_mode,bool *five_taps) +{ +struct omap_overlay *ovl =omap_dss_get_overlay (plane); +const int maxdownscale =cpu_is_omap34xx () ?4 :2 ; +unsigned long fclk =0 ; + +if ((ovl->caps &OMAP_DSS_OVL_CAP_SCALE ) ==0 ) { +if (width != out_width || height != out_height) +return -EINVAL ; +else +return 0 ; + } + +if (out_width < width / maxdownscale || + out_width > width *8 ) +return -EINVAL ; + +if (out_height < height / maxdownscale || + out_height > height *8 ) +return -EINVAL ; + +/* Must use 5-tap filter? */ + *five_taps = height > out_height *2 ; + +if (!*five_taps) { + fclk =calc_fclk (channel, width, height, out_width, + out_height); + +/* Try 5-tap filter if 3-tap fclk is too high */ +if (cpu_is_omap34xx () && height > out_height && + fclk >dispc_fclk_rate ()) + *five_taps = true; + } + +if (width > (2048 >> *five_taps)) { +DSSERR ("failed to set up scaling, fclk too low\n" ); +return -EINVAL ; + } + +if (*five_taps) + fclk =calc_fclk_five_taps (channel, width, height, + out_width, out_height, color_mode); + +DSSDBG ("required fclk rate = %lu Hz\n" , fclk); +DSSDBG ("current fclk rate = %lu Hz\n" ,dispc_fclk_rate ()); + +if (!fclk || fclk >dispc_fclk_rate ()) { +DSSERR ("failed to set up scaling, " +"required fclk rate = %lu Hz, " +"current fclk rate = %lu Hz\n" , + fclk,dispc_fclk_rate ()); +return -EINVAL ; + } + +return 0 ; +} +int dispc_ovl_setup (enum omap_plane plane,struct omap_overlay_info *oi,bool ilace,enum omap_channel channel,bool replication,u32 fifo_low,u32 fifo_high) { -const int maxdownscale =cpu_is_omap34xx () ?4 :2 ; -bool five_taps =0 ; +struct omap_overlay *ovl =omap_dss_get_overlay (plane); +bool five_taps;bool fieldmode =0 ; -int cconv =0 ; +int r, cconv =0 ;unsigned offset0, offset1;s32 row_inc;s32 pix_inc;
@@ -1751,61 +1811,16 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,if (!dss_feat_color_mode_supported (plane, oi->color_mode))return -EINVAL ; -if (plane ==OMAP_DSS_GFX ) { -if (oi->width != oi->out_width || oi->height != oi->out_height) -return -EINVAL ; - }else { -/* video plane */ - -unsigned long fclk =0 ; - -if (oi->out_width < oi->width / maxdownscale || - oi->out_width > oi->width *8 ) -return -EINVAL ; - -if (oi->out_height < oi->height / maxdownscale || - oi->out_height > oi->height *8 ) -return -EINVAL ; - -if (oi->color_mode ==OMAP_DSS_COLOR_YUV2 || - oi->color_mode ==OMAP_DSS_COLOR_UYVY || - oi->color_mode ==OMAP_DSS_COLOR_NV12 ) - cconv =1 ; - -/* Must use 5-tap filter? */ - five_taps = oi->height > oi->out_height *2 ; - -if (!five_taps) { - fclk =calc_fclk (channel, oi->width, oi->height, - oi->out_width, oi->out_height); - -/* Try 5-tap filter if 3-tap fclk is too high */ -if (cpu_is_omap34xx () && oi->height > oi->out_height && - fclk >dispc_fclk_rate ()) - five_taps = true; - } - -if (oi->width > (2048 >> five_taps)) { -DSSERR ("failed to set up scaling, fclk too low\n" ); -return -EINVAL ; - } - -if (five_taps) - fclk =calc_fclk_five_taps (channel, oi->width, - oi->height, oi->out_width, - oi->out_height, oi->color_mode); - -DSSDBG ("required fclk rate = %lu Hz\n" , fclk); -DSSDBG ("current fclk rate = %lu Hz\n" ,dispc_fclk_rate ()); + r =dispc_ovl_calc_scaling (plane, channel, oi->width, oi->height, + oi->out_width, oi->out_height, oi->color_mode, + &five_taps); +if (r) +return r; -if (!fclk || fclk >dispc_fclk_rate ()) { -DSSERR ("failed to set up scaling, " -"required fclk rate = %lu Hz, " -"current fclk rate = %lu Hz\n" , - fclk,dispc_fclk_rate ()); -return -EINVAL ; - } - } +if (oi->color_mode ==OMAP_DSS_COLOR_YUV2 || + oi->color_mode ==OMAP_DSS_COLOR_UYVY || + oi->color_mode ==OMAP_DSS_COLOR_NV12 ) + cconv =1 ;if (ilace && !fieldmode) {/*
@@ -1860,7 +1875,7 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,dispc_ovl_set_pic_size (plane, oi->width, oi->height); -if (plane !=OMAP_DSS_GFX ) { +if (ovl->caps &OMAP_DSS_OVL_CAP_SCALE ) { dispc_ovl_set_scaling(plane, oi->width, oi->height, oi->out_width, oi->out_height, ilace, five_taps, fieldmode,
Signature · 1 line
1.7.1
PATCH 10/10 OMAP2PLUS: DSS2: FEATURES: Create a range param to get max downscaling
In reply to Archit TanejaCreate a dss_range_param member called FEAT_PARAM_DOWNSCALE to get the maximum downscaling possible on the current platform. Use this in dispc_ovl_calc_scaling().
--- drivers/video/omap2/dss/dispc.c | 2 +- drivers/video/omap2/dss/dss_features.c | 3 +++ drivers/video/omap2/dss/dss_features.h | 1 + 3 files changed, 5 insertions(+), 1 deletions(-)
drivers/video/omap2/dss/dispc.c +1 -1
@@ -1716,7 +1716,7 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane, enum omap_color_mode color_mode, bool *five_taps) { struct omap_overlay *ovl = omap_dss_get_overlay(plane); -const int maxdownscale =cpu_is_omap34xx () ?4 :2 ; +const int maxdownscale =dss_feat_get_param_max (FEAT_PARAM_DOWNSCALE );unsigned long fclk =0 ;if ((ovl->caps &OMAP_DSS_OVL_CAP_SCALE ) ==0 ) {
drivers/video/omap2/dss/dss_features.c +3 -0
@@ -303,6 +303,7 @@ static const struct dss_param_range omap2_dss_param_range[] = { [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 }, [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 }, [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 }, + [FEAT_PARAM_DOWNSCALE] = { 1, 2 }, };static const struct dss_param_range omap3_dss_param_range[] = {
@@ -314,6 +315,7 @@ static const struct dss_param_range omap3_dss_param_range[] = { [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 }, [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 }, [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1}, + [FEAT_PARAM_DOWNSCALE] = { 1, 4 }, };static const struct dss_param_range omap4_dss_param_range[] = {
@@ -325,6 +327,7 @@ static const struct dss_param_range omap4_dss_param_range[] = { [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 }, [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 }, [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 }, + [FEAT_PARAM_DOWNSCALE] = { 1, 4 }, };/* OMAP2 DSS Features */
drivers/video/omap2/dss/dss_features.h +1 -0
@@ -85,6 +85,7 @@ enum dss_range_param {FEAT_PARAM_DSIPLL_REGM_DSI ,FEAT_PARAM_DSIPLL_FINT ,FEAT_PARAM_DSIPLL_LPDIV , + FEAT_PARAM_DOWNSCALE, };/* DSS Feature Functions */
Signature · 1 line
1.7.1