* [V2 6/7] video: mmp: calculate pitch value when fb set win
@ 2013-06-10 15:53 Jett.Zhou
2013-06-21 17:31 ` Daniel Drake
0 siblings, 1 reply; 2+ messages in thread
From: Jett.Zhou @ 2013-06-10 15:53 UTC (permalink / raw)
To: linux-arm-kernel
From: Jing Xiang <jxiang@marvell.com>
Add new func mmpfb_set_win to make code clean, it will calculate pitch
value when fb set win in mmpfb_set_win.
Signed-off-by: Jing Xiang <jxiang@marvell.com>
Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
---
drivers/video/mmp/fb/mmpfb.c | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/drivers/video/mmp/fb/mmpfb.c b/drivers/video/mmp/fb/mmpfb.c
index 6d1fa96..d9e7c94 100644
--- a/drivers/video/mmp/fb/mmpfb.c
+++ b/drivers/video/mmp/fb/mmpfb.c
@@ -392,12 +392,29 @@ static int var_update(struct fb_info *info)
return 0;
}
+static void mmpfb_set_win(struct fb_info *info)
+{
+ struct mmpfb_info *fbi = info->par;
+ struct fb_var_screeninfo *var = &info->var;
+ struct mmp_win win;
+ u32 stride;
+
+ memset(&win, 0, sizeof(win));
+ win.xsrc = win.xdst = fbi->mode.xres;
+ win.ysrc = win.ydst = fbi->mode.yres;
+ win.pix_fmt = fbi->pix_fmt;
+ stride = pixfmt_to_stride(win.pix_fmt);
+ win.pitch[0] = var->xres_virtual * stride;
+ win.pitch[1] = win.pitch[2] =
+ (stride == 1) ? (var->xres_virtual >> 1) : 0;
+ mmp_overlay_set_win(fbi->overlay, &win);
+}
+
static int mmpfb_set_par(struct fb_info *info)
{
struct mmpfb_info *fbi = info->par;
struct fb_var_screeninfo *var = &info->var;
struct mmp_addr addr;
- struct mmp_win win;
struct mmp_mode mode;
int ret;
@@ -409,11 +426,8 @@ static int mmpfb_set_par(struct fb_info *info)
fbmode_to_mmpmode(&mode, &fbi->mode, fbi->output_fmt);
mmp_path_set_mode(fbi->path, &mode);
- memset(&win, 0, sizeof(win));
- win.xsrc = win.xdst = fbi->mode.xres;
- win.ysrc = win.ydst = fbi->mode.yres;
- win.pix_fmt = fbi->pix_fmt;
- mmp_overlay_set_win(fbi->overlay, &win);
+ /* set window related info */
+ mmpfb_set_win(info);
/* set address always */
memset(&addr, 0, sizeof(addr));
@@ -427,16 +441,12 @@ static int mmpfb_set_par(struct fb_info *info)
static void mmpfb_power(struct mmpfb_info *fbi, int power)
{
struct mmp_addr addr;
- struct mmp_win win;
struct fb_var_screeninfo *var = &fbi->fb_info->var;
/* for power on, always set address/window again */
if (power) {
- memset(&win, 0, sizeof(win));
- win.xsrc = win.xdst = fbi->mode.xres;
- win.ysrc = win.ydst = fbi->mode.yres;
- win.pix_fmt = fbi->pix_fmt;
- mmp_overlay_set_win(fbi->overlay, &win);
+ /* set window related info */
+ mmpfb_set_win(fbi->fb_info);
/* set address always */
memset(&addr, 0, sizeof(addr));
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [V2 6/7] video: mmp: calculate pitch value when fb set win
2013-06-10 15:53 [V2 6/7] video: mmp: calculate pitch value when fb set win Jett.Zhou
@ 2013-06-21 17:31 ` Daniel Drake
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Drake @ 2013-06-21 17:31 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jun 10, 2013 at 9:53 AM, Jett.Zhou <jtzhou@marvell.com> wrote:
> From: Jing Xiang <jxiang@marvell.com>
>
> Add new func mmpfb_set_win to make code clean, it will calculate pitch
> value when fb set win in mmpfb_set_win.
It looks like a good idea to create a function for setting window
parameters from fb info, but this patch also starts to write into the
pitch[] fields which are not used anywhere. You should rework these
patches so that the pitch field is introduced, set, and consumed all
in the same patch.
The commit message for the patch that added pitch[] seems to suggest
that pitch[1] and pitch[2] are used for YUV formats. But in the code
posted here, they will not be used for PIXFMT_YUYV, PIXFMT_UYVY, etc.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-21 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-10 15:53 [V2 6/7] video: mmp: calculate pitch value when fb set win Jett.Zhou
2013-06-21 17:31 ` Daniel Drake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).