ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
PATCH 1/1 ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
Hi Eric,
this one has been living in our kernel tree for quite some time now but it seems it hasn't been merged yet. It's needed to make the pxafb driver work with DirectFB applications properly.
Thanks,
Daniel
PATCH 1/1 ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
Any idea what to do with this one?
Daniel
Quoted 79 lines · Daniel Mack
Hi Eric,
this one has been living in our kernel tree for quite some time now but it seems it hasn't been merged yet. It's needed to make the pxafb driver work with DirectFB applications properly.
Thanks,
DanielFrom
42e8a4226777b6cc82988061c80167813f403ec8Mon Sep 17 00:00:00 2001
From: Sven Neumann <[email protected]>
Date: Wed, 6 May 2009 16:22:50 +0200
Subject: [PATCH] ARM: pxafb: Use the passedfb_var_screeninfostruct inpxafb_pan_display()
pxafb_pan_display()used to ignore thefb_var_screeninfoparameter. Now pass it tosetup_base_frame()instead of pulling default values out offb_info.Signed-off-by Sven Neumann <[email protected]>Signed-off-by Daniel Mack <[email protected]>Cc Eric Miao <[email protected]>--- drivers/video/pxafb.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)drivers/video/pxafb.c +7
-5@@ -80,7 +80,8 @@static int pxafb_activate_var (struct fb_var_screeninfo *var,struct pxafb_info *);static void set_ctrlr_state (struct pxafb_info *fbi,u_int state); -static void setup_base_frame (struct pxafb_info *fbi,int branch); +static void setup_base_frame (struct pxafb_info *fbi, +struct fb_var_screeninfo *var,int branch);static int setup_frame_dma (struct pxafb_info *fbi,int dma,int pal,unsigned long offset,size_t size);@@ -536,7 +537,7 @@ static int pxafb_pan_display(struct fb_var_screeninfo *var,if (fbi->state !=C_ENABLE )return 0 ; -setup_base_frame (fbi,1 ); +setup_base_frame (fbi, var,1 );if (fbi->lccr0 &LCCR0_SDS )lcd_writel (fbi,FBR1 , fbi->fdadr[dma +1 ] |0x1 );@@ -1052,9 +1053,10 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal,return 0 ; } -static void setup_base_frame (struct pxafb_info *fbi,int branch) +static void setup_base_frame (struct pxafb_info *fbi, +struct fb_var_screeninfo *var, +int branch) { -struct fb_var_screeninfo *var = &fbi->fb.var;struct fb_fix_screeninfo *fix = &fbi->fb.fix;int nbytes, dma, pal, bpp = var->bits_per_pixel;unsigned long offset;@@ -1332,7 +1334,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,#endif setup_parallel_timing (fbi, var); -setup_base_frame (fbi,0 ); +setup_base_frame (fbi, var,0 ); fbi->reg_lccr0 = fbi->lccr0 | (LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM |Signature · 7 lines
1.6.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/1 ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
I see no problem with this patch, applied to 'devel'.
Quoted 86 lines · Daniel Mack
Any idea what to do with this one?
Daniel
Quoted 79 lines · Daniel Mack
Hi Eric,
this one has been living in our kernel tree for quite some time now but it seems it hasn't been merged yet. It's needed to make the pxafb driver work with DirectFB applications properly.
Thanks,
DanielFrom
42e8a4226777b6cc82988061c80167813f403ec8Mon Sep 17 00:00:00 2001
From: Sven Neumann <[email protected]>
Date: Wed, 6 May 2009 16:22:50 +0200
Subject: [PATCH] ARM: pxafb: Use the passedfb_var_screeninfostruct inpxafb_pan_display()
pxafb_pan_display()used to ignore thefb_var_screeninfoparameter. Now pass it tosetup_base_frame()instead of pulling default values out offb_info.Signed-off-by Sven Neumann <[email protected]>Signed-off-by Daniel Mack <[email protected]>Cc Eric Miao <[email protected]>---
?drivers/video/pxafb.c | ? 12 +++++++-----
?1 files changed, 7 insertions(+), 5 deletions(-)drivers/video/pxafb.c +6
-4@@ -80,7 +80,8 @@ ?static int pxafb_activate_var(struct fb_var_screeninfo *var, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct pxafb_info *); ?static void set_ctrlr_state(struct pxafb_info *fbi, u_int state); -static void setup_base_frame (struct pxafb_info *fbi,int branch); +static void setup_base_frame (struct pxafb_info *fbi, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct fb_var_screeninfo *var, int branch); ?static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned long offset, size_t size);@@ -536,7 +537,7 @@ static int pxafb_pan_display(struct fb_var_screeninfo *var, ? ? ? if (fbi->state != C_ENABLE) ? ? ? ? ? ? ? return 0; - ? ? setup_base_frame(fbi, 1); + ? ? setup_base_frame(fbi, var, 1); ? ? ? if (fbi->lccr0 & LCCR0_SDS) ? ? ? ? ? ? ? lcd_writel(fbi, FBR1, fbi->fdadr[dma + 1] | 0x1);@@ -1052,9 +1053,10 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, ? ? ? return 0; ?} -static void setup_base_frame (struct pxafb_info *fbi,int branch) +static void setup_base_frame (struct pxafb_info *fbi, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct fb_var_screeninfo *var, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? int branch) ?{ - ? ? struct fb_var_screeninfo *var = &fbi->fb.var; ? ? ? struct fb_fix_screeninfo *fix = &fbi->fb.fix; ? ? ? int nbytes, dma, pal, bpp = var->bits_per_pixel; ? ? ? unsigned long offset;@@ -1332,7 +1334,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,?#endif
? ? ? ? ? ? ?setup_parallel_timing(fbi, var);- ? ?
setup_base_frame(fbi, 0);
+ ? ?setup_base_frame(fbi, var, 0);? ? ?
fbi->reg_lccr0=fbi->lccr0|
? ? ? ? ? ? ? (LCCR0_LDM|LCCR0_SFM|LCCR0_IUM|LCCR0_EFM| --
1.6.5_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/1 ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
Quoted 1 line · Eric Miao
I see no problem with this patch, applied to 'devel'.
This patch looks broken to me. The only fields of of the fb_var_screeninfo passed to pan_display that should be used are xoffset, yoffset and vmode & FB_VMODE_YWRAP. The rest are not checked by the common code at all and depending on the hardware the pan operation may involve looking at any number of fields from fb_var_screeninfo so if other fields are taken from the passed fb_var_screeninfo the pan operation may end up doing a lot more than panning (eg. it could change the video mode). Even worse things could happen since the values are not checked at all.
To prevent driver authors' from shooting themselves in the foot it might make sense to change the common code to make a copy of info->var and merge those three fields from the passed fb_var_screeninfo into the copy, which would then be passed to the driver.
Quoted 93 lines · Daniel Mack
Quoted 81 lines
Any idea what to do with this one?
Daniel
Quoted 75 lines · Daniel Mack
Hi Eric,
this one has been living in our kernel tree for quite some time now but it seems it hasn't been merged yet. It's needed to make the pxafb driver work with DirectFB applications properly.
Thanks,
DanielFrom
42e8a4226777b6cc82988061c80167813f403ec8Mon Sep 17 00:00:00 2001
From: Sven Neumann <[email protected]>
Date: Wed, 6 May 2009 16:22:50 +0200
Subject: [PATCH] ARM: pxafb: Use the passedfb_var_screeninfostruct inpxafb_pan_display()
pxafb_pan_display()used to ignore thefb_var_screeninfoparameter. Now pass it tosetup_base_frame()instead of pulling default values out offb_info.Signed-off-by Sven Neumann <[email protected]>Signed-off-by Daniel Mack <[email protected]>Cc Eric Miao <[email protected]>---
?drivers/video/pxafb.c | ? 12 +++++++-----
?1 files changed, 7 insertions(+), 5 deletions(-)drivers/video/pxafb.c +6
-4@@ -80,7 +80,8 @@ ?static int pxafb_activate_var(struct fb_var_screeninfo *var, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct pxafb_info *); ?static void set_ctrlr_state(struct pxafb_info *fbi, u_int state); -static void setup_base_frame (struct pxafb_info *fbi,int branch); +static void setup_base_frame (struct pxafb_info *fbi, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct fb_var_screeninfo *var, int branch); ?static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned long offset, size_t size);@@ -536,7 +537,7 @@ static int pxafb_pan_display(struct fb_var_screeninfo *var, ? ? ? if (fbi->state != C_ENABLE) ? ? ? ? ? ? ? return 0; - ? ? setup_base_frame(fbi, 1); + ? ? setup_base_frame(fbi, var, 1); ? ? ? if (fbi->lccr0 & LCCR0_SDS) ? ? ? ? ? ? ? lcd_writel(fbi, FBR1, fbi->fdadr[dma + 1] | 0x1);@@ -1052,9 +1053,10 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, ? ? ? return 0; ?} -static void setup_base_frame (struct pxafb_info *fbi,int branch) +static void setup_base_frame (struct pxafb_info *fbi, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct fb_var_screeninfo *var, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? int branch) ?{ - ? ? struct fb_var_screeninfo *var = &fbi->fb.var; ? ? ? struct fb_fix_screeninfo *fix = &fbi->fb.fix; ? ? ? int nbytes, dma, pal, bpp = var->bits_per_pixel; ? ? ? unsigned long offset;@@ -1332,7 +1334,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,?#endif
? ? ? ? ? ? ?setup_parallel_timing(fbi, var);- ? ?
setup_base_frame(fbi, 0);
+ ? ?setup_base_frame(fbi, var, 0);? ? ?
fbi->reg_lccr0=fbi->lccr0|
? ? ? ? ? ? ? (LCCR0_LDM|LCCR0_SFM|LCCR0_IUM|LCCR0_EFM| --
1.6.5Quoted 5 lines
Quoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
Ville Syrj?l? syrjala at sci.fi http://www.sci.fi/~syrjala/
PATCH 1/1 ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
Quoted 12 lines · Ville Syrj?l?
Quoted 1 line · Eric Miao
I see no problem with this patch, applied to 'devel'.
This patch looks broken to me. The only fields of of the
fb_var_screeninfopassed topan_displaythat should be used are xoffset, yoffset and vmode &FB_VMODE_YWRAP. The rest are not checked by the common code at all and depending on the hardware the pan operation may involve looking at any number of fields fromfb_var_screeninfoso if other fields are taken from the passedfb_var_screeninfothe pan operation may end up doing a lot more than panning (eg. it could change the video mode). Even worse things could happen since the values are not checked at all.
Quoted 5 lines
To prevent driver authors' from shooting themselves in the foot it might make sense to change the common code to make a copy of
info->varand merge those three fields from the passedfb_var_screeninfointo the copy, which would then be passed to the driver.
Daniel,
Could you please help look into this?
Quoted 99 lines
Quoted 89 lines · Daniel Mack
Quoted 81 lines
Any idea what to do with this one?
Daniel
Quoted 75 lines · Daniel Mack
Hi Eric,
this one has been living in our kernel tree for quite some time now but it seems it hasn't been merged yet. It's needed to make the pxafb driver work with DirectFB applications properly.
Thanks,
DanielFrom
42e8a4226777b6cc82988061c80167813f403ec8Mon Sep 17 00:00:00 2001
From: Sven Neumann <[email protected]>
Date: Wed, 6 May 2009 16:22:50 +0200
Subject: [PATCH] ARM: pxafb: Use the passedfb_var_screeninfostruct inpxafb_pan_display()
pxafb_pan_display()used to ignore thefb_var_screeninfoparameter. Now pass it tosetup_base_frame()instead of pulling default values out offb_info.Signed-off-by Sven Neumann <[email protected]>Signed-off-by Daniel Mack <[email protected]>Cc Eric Miao <[email protected]>---
?drivers/video/pxafb.c | ? 12 +++++++-----
?1 files changed, 7 insertions(+), 5 deletions(-)drivers/video/pxafb.c +6
-4@@ -80,7 +80,8 @@ ?static int pxafb_activate_var(struct fb_var_screeninfo *var, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct pxafb_info *); ?static void set_ctrlr_state(struct pxafb_info *fbi, u_int state); -static void setup_base_frame (struct pxafb_info *fbi,int branch); +static void setup_base_frame (struct pxafb_info *fbi, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct fb_var_screeninfo *var, int branch); ?static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned long offset, size_t size);@@ -536,7 +537,7 @@ static int pxafb_pan_display(struct fb_var_screeninfo *var, ? ? ? if (fbi->state != C_ENABLE) ? ? ? ? ? ? ? return 0; - ? ? setup_base_frame(fbi, 1); + ? ? setup_base_frame(fbi, var, 1); ? ? ? if (fbi->lccr0 & LCCR0_SDS) ? ? ? ? ? ? ? lcd_writel(fbi, FBR1, fbi->fdadr[dma + 1] | 0x1);@@ -1052,9 +1053,10 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, ? ? ? return 0; ?} -static void setup_base_frame (struct pxafb_info *fbi,int branch) +static void setup_base_frame (struct pxafb_info *fbi, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct fb_var_screeninfo *var, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? int branch) ?{ - ? ? struct fb_var_screeninfo *var = &fbi->fb.var; ? ? ? struct fb_fix_screeninfo *fix = &fbi->fb.fix; ? ? ? int nbytes, dma, pal, bpp = var->bits_per_pixel; ? ? ? unsigned long offset;@@ -1332,7 +1334,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,?#endif
? ? ? ? ? ? ?setup_parallel_timing(fbi, var);- ? ?
setup_base_frame(fbi, 0);
+ ? ?setup_base_frame(fbi, var, 0);? ? ?
fbi->reg_lccr0=fbi->lccr0|
? ? ? ? ? ? ? (LCCR0_LDM|LCCR0_SFM|LCCR0_IUM|LCCR0_EFM| --
1.6.5Quoted 5 lines
Quoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernelQuoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel--
Ville Syrj?l?
syrjala at sci.fi
http://www.sci.fi/~syrjala/
PATCH 1/1 ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
In reply to Ville SyrjäläQuoted 12 lines · Ville Syrj?l?
Quoted 1 line · Eric Miao
I see no problem with this patch, applied to 'devel'.
This patch looks broken to me. The only fields of of the
fb_var_screeninfopassed topan_displaythat should be used are xoffset, yoffset and vmode &FB_VMODE_YWRAP. The rest are not checked by the common code at all and depending on the hardware the pan operation may involve looking at any number of fields fromfb_var_screeninfoso if other fields are taken from the passedfb_var_screeninfothe pan operation may end up doing a lot more than panning (eg. it could change the video mode). Even worse things could happen since the values are not checked at all.
Quoted 4 lines
To prevent driver authors' from shooting themselves in the foot it might make sense to change the common code to make a copy of
info->varand merge those three fields from the passedfb_var_screeninfointo the copy, which would then be passed to the driver.
Agreed. See the fixup patch below. I did that locally now for pxafb to fix the potential regression. Eventually code like this could go to some more generic place.
Thanks for pointing this out!
Daniel
PATCH 1/1 ARM: pxafb: Use the passed fb_var_screeninfo struct in pxafb_pan_display()
Quoted 5 lines
Commit 3a8552e made pxafb pay attention to paramters passed to
pxafb_pan_display(). As Ville Syrj?l? pointed out, this is potentially dangerous as user could pass in any other screeninfo parameters as well, and not only such that are relevant for display panning.
Quoted 7 lines
This patch fixed that by limiting the arguments actually used to .xoffset, .yoffset and .vmode &
FB_VMODE_YWRAP.Signed-off-by Daniel Mack <[email protected]>Cc Ville Syrj?l? <[email protected]>Cc Eric Miao <[email protected]>Cc Sven Neumann <[email protected]>
OK, merged with the previous commit with additional comments of the issue found, and with Ville Syrj?l? <[email protected]> in the Cc list. Thanks.