summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/fb.c')
-rw-r--r--drivers/video/tegra/fb.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c
index cc26c5977a20..eae17b5dbc28 100644
--- a/drivers/video/tegra/fb.c
+++ b/drivers/video/tegra/fb.c
@@ -354,12 +354,16 @@ static int tegra_fb_set_windowattr(struct tegra_fb_info *tegra_fb,
struct tegra_dc_win *win,
const struct tegra_fb_flip_win *flip_win)
{
+ int xres, yres;
if (flip_win->handle == NULL) {
win->flags = 0;
win->cur_handle = NULL;
return 0;
}
+ xres = tegra_fb->info->var.xres;
+ yres = tegra_fb->info->var.yres;
+
win->flags = TEGRA_WIN_FLAG_ENABLED;
if (flip_win->attr.blend == TEGRA_FB_WIN_BLEND_PREMULT)
win->flags |= TEGRA_WIN_FLAG_BLEND_PREMULT;
@@ -374,6 +378,15 @@ static int tegra_fb_set_windowattr(struct tegra_fb_info *tegra_fb,
win->out_y = flip_win->attr.out_y;
win->out_w = flip_win->attr.out_w;
win->out_h = flip_win->attr.out_h;
+
+ if (((win->out_x + win->out_w) > xres) && (win->out_x < xres)) {
+ win->out_w = xres - win->out_x;
+ }
+
+ if (((win->out_y + win->out_h) > yres) && (win->out_y < yres)) {
+ win->out_h = yres - win->out_y;
+ }
+
win->z = flip_win->attr.z;
win->cur_handle = flip_win->handle;