diff options
author | Archit Taneja <archit@ti.com> | 2011-09-14 01:40:10 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-09-30 09:17:24 -0400 |
commit | a4273b7cca6fe7ee3807229ba256adb6cfaba0c3 (patch) | |
tree | bdc5072fb8083f0e0738531f4350d5336de0a1e2 /drivers/video | |
parent | dc891fab115380d9dfddcd252df45a941ff9cb4e (diff) |
OMAPDSS: DISPC: Reduce the number of arguments in dispc_ovl_setup()
dispc_ovl_setup() currently takes a large number of overlay arguments, most of
these are members of the overlay_info struct. Replace these arguments by
passing a overlay_info pointer instead.
In configure_overlay(), we create an overlay_info struct called new_oi, this is
a copy of the overlay cache's overlay_info member. Update the new_oi parameters
which could have been possibly changed in configure_overlay(). Pass its pointer
pointer to dispc_ovl_setup().
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 125 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 14 | ||||
-rw-r--r-- | drivers/video/omap2/dss/manager.c | 28 |
3 files changed, 72 insertions, 95 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 38d6595bb916..f01a26df4af5 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -1674,17 +1674,8 @@ static unsigned long calc_fclk(enum omap_channel channel, u16 width, | |||
1674 | return dispc_mgr_pclk_rate(channel) * vf * hf; | 1674 | return dispc_mgr_pclk_rate(channel) * vf * hf; |
1675 | } | 1675 | } |
1676 | 1676 | ||
1677 | int dispc_ovl_setup(enum omap_plane plane, | 1677 | int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, |
1678 | u32 paddr, u16 screen_width, | 1678 | bool ilace, enum omap_channel channel) |
1679 | u16 pos_x, u16 pos_y, | ||
1680 | u16 width, u16 height, | ||
1681 | u16 out_width, u16 out_height, | ||
1682 | enum omap_color_mode color_mode, | ||
1683 | bool ilace, | ||
1684 | enum omap_dss_rotation_type rotation_type, | ||
1685 | u8 rotation, bool mirror, | ||
1686 | u8 global_alpha, u8 pre_mult_alpha, | ||
1687 | enum omap_channel channel, u32 puv_addr) | ||
1688 | { | 1679 | { |
1689 | const int maxdownscale = cpu_is_omap34xx() ? 4 : 2; | 1680 | const int maxdownscale = cpu_is_omap34xx() ? 4 : 2; |
1690 | bool five_taps = 0; | 1681 | bool five_taps = 0; |
@@ -1693,79 +1684,78 @@ int dispc_ovl_setup(enum omap_plane plane, | |||
1693 | unsigned offset0, offset1; | 1684 | unsigned offset0, offset1; |
1694 | s32 row_inc; | 1685 | s32 row_inc; |
1695 | s32 pix_inc; | 1686 | s32 pix_inc; |
1696 | u16 frame_height = height; | 1687 | u16 frame_height = oi->height; |
1697 | unsigned int field_offset = 0; | 1688 | unsigned int field_offset = 0; |
1698 | 1689 | ||
1699 | DSSDBG("dispc_ovl_setup %d, pa %x, sw %d, %d,%d, %dx%d -> " | 1690 | DSSDBG("dispc_ovl_setup %d, pa %x, pa_uv %x, sw %d, %d,%d, %dx%d -> " |
1700 | "%dx%d, ilace %d, cmode %x, rot %d, mir %d chan %d\n", | 1691 | "%dx%d, cmode %x, rot %d, mir %d, ilace %d chan %d\n", |
1701 | plane, paddr, screen_width, pos_x, pos_y, | 1692 | plane, oi->paddr, oi->p_uv_addr, oi->screen_width, oi->pos_x, |
1702 | width, height, | 1693 | oi->pos_y, oi->width, oi->height, oi->out_width, oi->out_height, |
1703 | out_width, out_height, | 1694 | oi->color_mode, oi->rotation, oi->mirror, ilace, channel); |
1704 | ilace, color_mode, | ||
1705 | rotation, mirror, channel); | ||
1706 | 1695 | ||
1707 | if (paddr == 0) | 1696 | if (oi->paddr == 0) |
1708 | return -EINVAL; | 1697 | return -EINVAL; |
1709 | 1698 | ||
1710 | if (ilace && height == out_height) | 1699 | if (ilace && oi->height == oi->out_height) |
1711 | fieldmode = 1; | 1700 | fieldmode = 1; |
1712 | 1701 | ||
1713 | if (ilace) { | 1702 | if (ilace) { |
1714 | if (fieldmode) | 1703 | if (fieldmode) |
1715 | height /= 2; | 1704 | oi->height /= 2; |
1716 | pos_y /= 2; | 1705 | oi->pos_y /= 2; |
1717 | out_height /= 2; | 1706 | oi->out_height /= 2; |
1718 | 1707 | ||
1719 | DSSDBG("adjusting for ilace: height %d, pos_y %d, " | 1708 | DSSDBG("adjusting for ilace: height %d, pos_y %d, " |
1720 | "out_height %d\n", | 1709 | "out_height %d\n", |
1721 | height, pos_y, out_height); | 1710 | oi->height, oi->pos_y, oi->out_height); |
1722 | } | 1711 | } |
1723 | 1712 | ||
1724 | if (!dss_feat_color_mode_supported(plane, color_mode)) | 1713 | if (!dss_feat_color_mode_supported(plane, oi->color_mode)) |
1725 | return -EINVAL; | 1714 | return -EINVAL; |
1726 | 1715 | ||
1727 | if (plane == OMAP_DSS_GFX) { | 1716 | if (plane == OMAP_DSS_GFX) { |
1728 | if (width != out_width || height != out_height) | 1717 | if (oi->width != oi->out_width || oi->height != oi->out_height) |
1729 | return -EINVAL; | 1718 | return -EINVAL; |
1730 | } else { | 1719 | } else { |
1731 | /* video plane */ | 1720 | /* video plane */ |
1732 | 1721 | ||
1733 | unsigned long fclk = 0; | 1722 | unsigned long fclk = 0; |
1734 | 1723 | ||
1735 | if (out_width < width / maxdownscale || | 1724 | if (oi->out_width < oi->width / maxdownscale || |
1736 | out_width > width * 8) | 1725 | oi->out_width > oi->width * 8) |
1737 | return -EINVAL; | 1726 | return -EINVAL; |
1738 | 1727 | ||
1739 | if (out_height < height / maxdownscale || | 1728 | if (oi->out_height < oi->height / maxdownscale || |
1740 | out_height > height * 8) | 1729 | oi->out_height > oi->height * 8) |
1741 | return -EINVAL; | 1730 | return -EINVAL; |
1742 | 1731 | ||
1743 | if (color_mode == OMAP_DSS_COLOR_YUV2 || | 1732 | if (oi->color_mode == OMAP_DSS_COLOR_YUV2 || |
1744 | color_mode == OMAP_DSS_COLOR_UYVY || | 1733 | oi->color_mode == OMAP_DSS_COLOR_UYVY || |
1745 | color_mode == OMAP_DSS_COLOR_NV12) | 1734 | oi->color_mode == OMAP_DSS_COLOR_NV12) |
1746 | cconv = 1; | 1735 | cconv = 1; |
1747 | 1736 | ||
1748 | /* Must use 5-tap filter? */ | 1737 | /* Must use 5-tap filter? */ |
1749 | five_taps = height > out_height * 2; | 1738 | five_taps = oi->height > oi->out_height * 2; |
1750 | 1739 | ||
1751 | if (!five_taps) { | 1740 | if (!five_taps) { |
1752 | fclk = calc_fclk(channel, width, height, out_width, | 1741 | fclk = calc_fclk(channel, oi->width, oi->height, |
1753 | out_height); | 1742 | oi->out_width, oi->out_height); |
1754 | 1743 | ||
1755 | /* Try 5-tap filter if 3-tap fclk is too high */ | 1744 | /* Try 5-tap filter if 3-tap fclk is too high */ |
1756 | if (cpu_is_omap34xx() && height > out_height && | 1745 | if (cpu_is_omap34xx() && oi->height > oi->out_height && |
1757 | fclk > dispc_fclk_rate()) | 1746 | fclk > dispc_fclk_rate()) |
1758 | five_taps = true; | 1747 | five_taps = true; |
1759 | } | 1748 | } |
1760 | 1749 | ||
1761 | if (width > (2048 >> five_taps)) { | 1750 | if (oi->width > (2048 >> five_taps)) { |
1762 | DSSERR("failed to set up scaling, fclk too low\n"); | 1751 | DSSERR("failed to set up scaling, fclk too low\n"); |
1763 | return -EINVAL; | 1752 | return -EINVAL; |
1764 | } | 1753 | } |
1765 | 1754 | ||
1766 | if (five_taps) | 1755 | if (five_taps) |
1767 | fclk = calc_fclk_five_taps(channel, width, height, | 1756 | fclk = calc_fclk_five_taps(channel, oi->width, |
1768 | out_width, out_height, color_mode); | 1757 | oi->height, oi->out_width, |
1758 | oi->out_height, oi->color_mode); | ||
1769 | 1759 | ||
1770 | DSSDBG("required fclk rate = %lu Hz\n", fclk); | 1760 | DSSDBG("required fclk rate = %lu Hz\n", fclk); |
1771 | DSSDBG("current fclk rate = %lu Hz\n", dispc_fclk_rate()); | 1761 | DSSDBG("current fclk rate = %lu Hz\n", dispc_fclk_rate()); |
@@ -1787,64 +1777,65 @@ int dispc_ovl_setup(enum omap_plane plane, | |||
1787 | * so the integer part must be added to the base address of the | 1777 | * so the integer part must be added to the base address of the |
1788 | * bottom field. | 1778 | * bottom field. |
1789 | */ | 1779 | */ |
1790 | if (!height || height == out_height) | 1780 | if (!oi->height || oi->height == oi->out_height) |
1791 | field_offset = 0; | 1781 | field_offset = 0; |
1792 | else | 1782 | else |
1793 | field_offset = height / out_height / 2; | 1783 | field_offset = oi->height / oi->out_height / 2; |
1794 | } | 1784 | } |
1795 | 1785 | ||
1796 | /* Fields are independent but interleaved in memory. */ | 1786 | /* Fields are independent but interleaved in memory. */ |
1797 | if (fieldmode) | 1787 | if (fieldmode) |
1798 | field_offset = 1; | 1788 | field_offset = 1; |
1799 | 1789 | ||
1800 | if (rotation_type == OMAP_DSS_ROT_DMA) | 1790 | if (oi->rotation_type == OMAP_DSS_ROT_DMA) |
1801 | calc_dma_rotation_offset(rotation, mirror, | 1791 | calc_dma_rotation_offset(oi->rotation, oi->mirror, |
1802 | screen_width, width, frame_height, color_mode, | 1792 | oi->screen_width, oi->width, frame_height, |
1803 | fieldmode, field_offset, | 1793 | oi->color_mode, fieldmode, field_offset, |
1804 | &offset0, &offset1, &row_inc, &pix_inc); | 1794 | &offset0, &offset1, &row_inc, &pix_inc); |
1805 | else | 1795 | else |
1806 | calc_vrfb_rotation_offset(rotation, mirror, | 1796 | calc_vrfb_rotation_offset(oi->rotation, oi->mirror, |
1807 | screen_width, width, frame_height, color_mode, | 1797 | oi->screen_width, oi->width, frame_height, |
1808 | fieldmode, field_offset, | 1798 | oi->color_mode, fieldmode, field_offset, |
1809 | &offset0, &offset1, &row_inc, &pix_inc); | 1799 | &offset0, &offset1, &row_inc, &pix_inc); |
1810 | 1800 | ||
1811 | DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n", | 1801 | DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n", |
1812 | offset0, offset1, row_inc, pix_inc); | 1802 | offset0, offset1, row_inc, pix_inc); |
1813 | 1803 | ||
1814 | dispc_ovl_set_color_mode(plane, color_mode); | 1804 | dispc_ovl_set_color_mode(plane, oi->color_mode); |
1815 | 1805 | ||
1816 | dispc_ovl_set_ba0(plane, paddr + offset0); | 1806 | dispc_ovl_set_ba0(plane, oi->paddr + offset0); |
1817 | dispc_ovl_set_ba1(plane, paddr + offset1); | 1807 | dispc_ovl_set_ba1(plane, oi->paddr + offset1); |
1818 | 1808 | ||
1819 | if (OMAP_DSS_COLOR_NV12 == color_mode) { | 1809 | if (OMAP_DSS_COLOR_NV12 == oi->color_mode) { |
1820 | dispc_ovl_set_ba0_uv(plane, puv_addr + offset0); | 1810 | dispc_ovl_set_ba0_uv(plane, oi->p_uv_addr + offset0); |
1821 | dispc_ovl_set_ba1_uv(plane, puv_addr + offset1); | 1811 | dispc_ovl_set_ba1_uv(plane, oi->p_uv_addr + offset1); |
1822 | } | 1812 | } |
1823 | 1813 | ||
1824 | 1814 | ||
1825 | dispc_ovl_set_row_inc(plane, row_inc); | 1815 | dispc_ovl_set_row_inc(plane, row_inc); |
1826 | dispc_ovl_set_pix_inc(plane, pix_inc); | 1816 | dispc_ovl_set_pix_inc(plane, pix_inc); |
1827 | 1817 | ||
1828 | DSSDBG("%d,%d %dx%d -> %dx%d\n", pos_x, pos_y, width, height, | 1818 | DSSDBG("%d,%d %dx%d -> %dx%d\n", oi->pos_x, oi->pos_y, oi->width, |
1829 | out_width, out_height); | 1819 | oi->height, oi->out_width, oi->out_height); |
1830 | 1820 | ||
1831 | dispc_ovl_set_pos(plane, pos_x, pos_y); | 1821 | dispc_ovl_set_pos(plane, oi->pos_x, oi->pos_y); |
1832 | 1822 | ||
1833 | dispc_ovl_set_pic_size(plane, width, height); | 1823 | dispc_ovl_set_pic_size(plane, oi->width, oi->height); |
1834 | 1824 | ||
1835 | if (plane != OMAP_DSS_GFX) { | 1825 | if (plane != OMAP_DSS_GFX) { |
1836 | dispc_ovl_set_scaling(plane, width, height, | 1826 | dispc_ovl_set_scaling(plane, oi->width, oi->height, |
1837 | out_width, out_height, | 1827 | oi->out_width, oi->out_height, |
1838 | ilace, five_taps, fieldmode, | 1828 | ilace, five_taps, fieldmode, |
1839 | color_mode, rotation); | 1829 | oi->color_mode, oi->rotation); |
1840 | dispc_ovl_set_vid_size(plane, out_width, out_height); | 1830 | dispc_ovl_set_vid_size(plane, oi->out_width, oi->out_height); |
1841 | dispc_ovl_set_vid_color_conv(plane, cconv); | 1831 | dispc_ovl_set_vid_color_conv(plane, cconv); |
1842 | } | 1832 | } |
1843 | 1833 | ||
1844 | dispc_ovl_set_rotation_attrs(plane, rotation, mirror, color_mode); | 1834 | dispc_ovl_set_rotation_attrs(plane, oi->rotation, oi->mirror, |
1835 | oi->color_mode); | ||
1845 | 1836 | ||
1846 | dispc_ovl_set_pre_mult_alpha(plane, pre_mult_alpha); | 1837 | dispc_ovl_set_pre_mult_alpha(plane, oi->pre_mult_alpha); |
1847 | dispc_ovl_setup_global_alpha(plane, global_alpha); | 1838 | dispc_ovl_setup_global_alpha(plane, oi->global_alpha); |
1848 | 1839 | ||
1849 | dispc_ovl_set_channel_out(plane, channel); | 1840 | dispc_ovl_set_channel_out(plane, channel); |
1850 | 1841 | ||
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index f58c302b730d..bcc9c4e83cc4 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -402,18 +402,8 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate, | |||
402 | u32 dispc_ovl_get_fifo_size(enum omap_plane plane); | 402 | u32 dispc_ovl_get_fifo_size(enum omap_plane plane); |
403 | void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high); | 403 | void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high); |
404 | u32 dispc_ovl_get_burst_size(enum omap_plane plane); | 404 | u32 dispc_ovl_get_burst_size(enum omap_plane plane); |
405 | int dispc_ovl_setup(enum omap_plane plane, | 405 | int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, |
406 | u32 paddr, u16 screen_width, | 406 | bool ilace, enum omap_channel channel); |
407 | u16 pos_x, u16 pos_y, | ||
408 | u16 width, u16 height, | ||
409 | u16 out_width, u16 out_height, | ||
410 | enum omap_color_mode color_mode, | ||
411 | bool ilace, | ||
412 | enum omap_dss_rotation_type rotation_type, | ||
413 | u8 rotation, bool mirror, | ||
414 | u8 global_alpha, u8 pre_mult_alpha, | ||
415 | enum omap_channel channel, | ||
416 | u32 puv_addr); | ||
417 | int dispc_ovl_enable(enum omap_plane plane, bool enable); | 407 | int dispc_ovl_enable(enum omap_plane plane, bool enable); |
418 | void dispc_ovl_enable_replication(enum omap_plane plane, bool enable); | 408 | void dispc_ovl_enable_replication(enum omap_plane plane, bool enable); |
419 | 409 | ||
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 5d28ef6fa78d..f1c334c275e2 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c | |||
@@ -809,7 +809,7 @@ static int configure_overlay(enum omap_plane plane) | |||
809 | { | 809 | { |
810 | struct overlay_cache_data *c; | 810 | struct overlay_cache_data *c; |
811 | struct manager_cache_data *mc; | 811 | struct manager_cache_data *mc; |
812 | struct omap_overlay_info *oi; | 812 | struct omap_overlay_info *oi, new_oi; |
813 | struct omap_overlay_manager_info *mi; | 813 | struct omap_overlay_manager_info *mi; |
814 | u16 outw, outh; | 814 | u16 outw, outh; |
815 | u16 x, y, w, h; | 815 | u16 x, y, w, h; |
@@ -929,22 +929,18 @@ static int configure_overlay(enum omap_plane plane) | |||
929 | } | 929 | } |
930 | } | 930 | } |
931 | 931 | ||
932 | r = dispc_ovl_setup(plane, | 932 | new_oi = *oi; |
933 | paddr, | 933 | |
934 | oi->screen_width, | 934 | /* update new_oi members which could have been possibly updated */ |
935 | x, y, | 935 | new_oi.pos_x = x; |
936 | w, h, | 936 | new_oi.pos_y = y; |
937 | outw, outh, | 937 | new_oi.width = w; |
938 | oi->color_mode, | 938 | new_oi.height = h; |
939 | c->ilace, | 939 | new_oi.out_width = outw; |
940 | oi->rotation_type, | 940 | new_oi.out_height = outh; |
941 | oi->rotation, | 941 | new_oi.paddr = paddr; |
942 | oi->mirror, | ||
943 | oi->global_alpha, | ||
944 | oi->pre_mult_alpha, | ||
945 | c->channel, | ||
946 | oi->p_uv_addr); | ||
947 | 942 | ||
943 | r = dispc_ovl_setup(plane, &new_oi, c->ilace, c->channel); | ||
948 | if (r) { | 944 | if (r) { |
949 | /* this shouldn't happen */ | 945 | /* this shouldn't happen */ |
950 | DSSERR("dispc_ovl_setup failed for ovl %d\n", plane); | 946 | DSSERR("dispc_ovl_setup failed for ovl %d\n", plane); |