diff options
author | Ville Syrjälä <ville.syrjala@nokia.com> | 2010-03-17 13:59:26 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-08-03 08:18:45 -0400 |
commit | 46d3524a1b9155dd9cd57ea28e00db08c7a95c1a (patch) | |
tree | 8faa1ee6da46a9d672b4fad28a58a5004d399cbc | |
parent | 8cab90fdb4c71f9a92c09c015aee42ff2149b317 (diff) |
OMAP: DSS2: OMAPFB: Refactor overlay address calculations
Split the overlay address calculations into their own function.
Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 4b4506da96da..2ac20d230ead 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -822,6 +822,40 @@ static unsigned calc_rotation_offset_vrfb(const struct fb_var_screeninfo *var, | |||
822 | return offset; | 822 | return offset; |
823 | } | 823 | } |
824 | 824 | ||
825 | static void omapfb_calc_addr(const struct omapfb_info *ofbi, | ||
826 | const struct fb_var_screeninfo *var, | ||
827 | const struct fb_fix_screeninfo *fix, | ||
828 | int rotation, u32 *paddr, void __iomem **vaddr) | ||
829 | { | ||
830 | u32 data_start_p; | ||
831 | void __iomem *data_start_v; | ||
832 | int offset; | ||
833 | |||
834 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { | ||
835 | data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation); | ||
836 | data_start_v = NULL; | ||
837 | } else { | ||
838 | data_start_p = omapfb_get_region_paddr(ofbi); | ||
839 | data_start_v = omapfb_get_region_vaddr(ofbi); | ||
840 | } | ||
841 | |||
842 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) | ||
843 | offset = calc_rotation_offset_vrfb(var, fix, rotation); | ||
844 | else | ||
845 | offset = calc_rotation_offset_dma(var, fix, rotation); | ||
846 | |||
847 | data_start_p += offset; | ||
848 | data_start_v += offset; | ||
849 | |||
850 | if (offset) | ||
851 | DBG("offset %d, %d = %d\n", | ||
852 | var->xoffset, var->yoffset, offset); | ||
853 | |||
854 | DBG("paddr %x, vaddr %p\n", data_start_p, data_start_v); | ||
855 | |||
856 | *paddr = data_start_p; | ||
857 | *vaddr = data_start_v; | ||
858 | } | ||
825 | 859 | ||
826 | /* setup overlay according to the fb */ | 860 | /* setup overlay according to the fb */ |
827 | static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl, | 861 | static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl, |
@@ -832,9 +866,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl, | |||
832 | struct fb_var_screeninfo *var = &fbi->var; | 866 | struct fb_var_screeninfo *var = &fbi->var; |
833 | struct fb_fix_screeninfo *fix = &fbi->fix; | 867 | struct fb_fix_screeninfo *fix = &fbi->fix; |
834 | enum omap_color_mode mode = 0; | 868 | enum omap_color_mode mode = 0; |
835 | int offset; | 869 | u32 data_start_p = 0; |
836 | u32 data_start_p; | 870 | void __iomem *data_start_v = NULL; |
837 | void __iomem *data_start_v; | ||
838 | struct omap_overlay_info info; | 871 | struct omap_overlay_info info; |
839 | int xres, yres; | 872 | int xres, yres; |
840 | int screen_width; | 873 | int screen_width; |
@@ -861,28 +894,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl, | |||
861 | yres = var->yres; | 894 | yres = var->yres; |
862 | } | 895 | } |
863 | 896 | ||
864 | 897 | omapfb_calc_addr(ofbi, var, fix, rotation, | |
865 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { | 898 | &data_start_p, &data_start_v); |
866 | data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation); | ||
867 | data_start_v = NULL; | ||
868 | } else { | ||
869 | data_start_p = omapfb_get_region_paddr(ofbi); | ||
870 | data_start_v = omapfb_get_region_vaddr(ofbi); | ||
871 | } | ||
872 | |||
873 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) | ||
874 | offset = calc_rotation_offset_vrfb(var, fix, rotation); | ||
875 | else | ||
876 | offset = calc_rotation_offset_dma(var, fix, rotation); | ||
877 | |||
878 | data_start_p += offset; | ||
879 | data_start_v += offset; | ||
880 | |||
881 | if (offset) | ||
882 | DBG("offset %d, %d = %d\n", | ||
883 | var->xoffset, var->yoffset, offset); | ||
884 | |||
885 | DBG("paddr %x, vaddr %p\n", data_start_p, data_start_v); | ||
886 | 899 | ||
887 | r = fb_mode_to_dss_mode(var, &mode); | 900 | r = fb_mode_to_dss_mode(var, &mode); |
888 | if (r) { | 901 | if (r) { |