aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap/omapfb_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap/omapfb_main.c')
-rw-r--r--drivers/video/omap/omapfb_main.c52
1 files changed, 38 insertions, 14 deletions
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index 8862233d57b..db05f7e316e 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -67,6 +67,7 @@ static struct caps_table_struct ctrl_caps[] = {
67 { OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE, "pixel double window" }, 67 { OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE, "pixel double window" },
68 { OMAPFB_CAPS_WINDOW_SCALE, "scale window" }, 68 { OMAPFB_CAPS_WINDOW_SCALE, "scale window" },
69 { OMAPFB_CAPS_WINDOW_OVERLAY, "overlay window" }, 69 { OMAPFB_CAPS_WINDOW_OVERLAY, "overlay window" },
70 { OMAPFB_CAPS_WINDOW_ROTATE, "rotate window" },
70 { OMAPFB_CAPS_SET_BACKLIGHT, "backlight setting" }, 71 { OMAPFB_CAPS_SET_BACKLIGHT, "backlight setting" },
71}; 72};
72 73
@@ -215,6 +216,15 @@ static int ctrl_change_mode(struct fb_info *fbi)
215 offset, var->xres_virtual, 216 offset, var->xres_virtual,
216 plane->info.pos_x, plane->info.pos_y, 217 plane->info.pos_x, plane->info.pos_y,
217 var->xres, var->yres, plane->color_mode); 218 var->xres, var->yres, plane->color_mode);
219 if (r < 0)
220 return r;
221
222 if (fbdev->ctrl->set_rotate != NULL) {
223 r = fbdev->ctrl->set_rotate(var->rotate);
224 if (r < 0)
225 return r;
226 }
227
218 if (fbdev->ctrl->set_scale != NULL) 228 if (fbdev->ctrl->set_scale != NULL)
219 r = fbdev->ctrl->set_scale(plane->idx, 229 r = fbdev->ctrl->set_scale(plane->idx,
220 var->xres, var->yres, 230 var->xres, var->yres,
@@ -600,7 +610,7 @@ static void omapfb_rotate(struct fb_info *fbi, int rotate)
600 struct omapfb_device *fbdev = plane->fbdev; 610 struct omapfb_device *fbdev = plane->fbdev;
601 611
602 omapfb_rqueue_lock(fbdev); 612 omapfb_rqueue_lock(fbdev);
603 if (cpu_is_omap15xx() && rotate != fbi->var.rotate) { 613 if (rotate != fbi->var.rotate) {
604 struct fb_var_screeninfo *new_var = &fbdev->new_var; 614 struct fb_var_screeninfo *new_var = &fbdev->new_var;
605 615
606 memcpy(new_var, &fbi->var, sizeof(*new_var)); 616 memcpy(new_var, &fbi->var, sizeof(*new_var));
@@ -707,28 +717,42 @@ int omapfb_update_window_async(struct fb_info *fbi,
707 void (*callback)(void *), 717 void (*callback)(void *),
708 void *callback_data) 718 void *callback_data)
709{ 719{
720 int xres, yres;
710 struct omapfb_plane_struct *plane = fbi->par; 721 struct omapfb_plane_struct *plane = fbi->par;
711 struct omapfb_device *fbdev = plane->fbdev; 722 struct omapfb_device *fbdev = plane->fbdev;
712 struct fb_var_screeninfo *var; 723 struct fb_var_screeninfo *var = &fbi->var;
724
725 switch (var->rotate) {
726 case 0:
727 case 180:
728 xres = fbdev->panel->x_res;
729 yres = fbdev->panel->y_res;
730 break;
731 case 90:
732 case 270:
733 xres = fbdev->panel->y_res;
734 yres = fbdev->panel->x_res;
735 break;
736 default:
737 return -EINVAL;
738 }
713 739
714 var = &fbi->var; 740 if (win->x >= xres || win->y >= yres ||
715 if (win->x >= var->xres || win->y >= var->yres || 741 win->out_x > xres || win->out_y > yres)
716 win->out_x > var->xres || win->out_y >= var->yres)
717 return -EINVAL; 742 return -EINVAL;
718 743
719 if (!fbdev->ctrl->update_window || 744 if (!fbdev->ctrl->update_window ||
720 fbdev->ctrl->get_update_mode() != OMAPFB_MANUAL_UPDATE) 745 fbdev->ctrl->get_update_mode() != OMAPFB_MANUAL_UPDATE)
721 return -ENODEV; 746 return -ENODEV;
722 747
723 if (win->x + win->width >= var->xres) 748 if (win->x + win->width > xres)
724 win->width = var->xres - win->x; 749 win->width = xres - win->x;
725 if (win->y + win->height >= var->yres) 750 if (win->y + win->height > yres)
726 win->height = var->yres - win->y; 751 win->height = yres - win->y;
727 /* The out sizes should be cropped to the LCD size */ 752 if (win->out_x + win->out_width > xres)
728 if (win->out_x + win->out_width > fbdev->panel->x_res) 753 win->out_width = xres - win->out_x;
729 win->out_width = fbdev->panel->x_res - win->out_x; 754 if (win->out_y + win->out_height > yres)
730 if (win->out_y + win->out_height > fbdev->panel->y_res) 755 win->out_height = yres - win->out_y;
731 win->out_height = fbdev->panel->y_res - win->out_y;
732 if (!win->width || !win->height || !win->out_width || !win->out_height) 756 if (!win->width || !win->height || !win->out_width || !win->out_height)
733 return 0; 757 return 0;
734 758