linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Cc: linux-fbdev-devel@lists.sourceforge.net,
	Andrew Victor <andrew@sanpeople.com>,
	"Antonino A. Daplas" <adaplas@gmail.com>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Jan Altenberg <jan.altenberg@linutronix.de>,
	Patrice Vilchez <patrice.vilchez@rfo.atmel.com>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [PATCH] atmel_lcdfb: Fix wrong line_length calculation
Date: Tue, 12 Jun 2007 13:27:57 +0200	[thread overview]
Message-ID: <1181647677482-git-send-email-hskinnemoen@atmel.com> (raw)
In-Reply-To: <1179511541.3811.16.camel@bender>

As Jan Altenberg pointed out, line_length will always be 0 if
bits_per_pixel < 8. Fix this and also make sure that we round up to
the nearest byte.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
I haven't tested this with any real program that uses the frame buffer,
but fbset seems to report sane values for line_length:

-sh-3.2# fbset -i

mode "320x240-68"
    # D: 6.891 MHz, H: 17.852 kHz, V: 68.400 Hz
    geometry 320 240 320 240 4
    timings 145116 17 33 10 10 16 1
    rgba 4/0,4/0,4/0,0/0
endmode

Frame buffer device information:
    Name        :
    Address     : 0x102c0000
    Size        : 230400
    Type        : PACKED PIXELS
    Visual      : PSEUDOCOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 160
    MMIO Address: 0xff000000
    MMIO Size   : 4096
    Accelerator : No

The XPanStep and YPanStep values are wrong though. Nicolas, I suspect
YPanStep should be 1 on AT91 as well since the only thing required is
the ability to change the DMA base address. The DMA2D stuff is only
required for X panning if I understand it correctly.

 drivers/video/atmel_lcdfb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index e1d5bd0..695d520 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -230,6 +230,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
 	struct atmel_lcdfb_info *sinfo = info->par;
 	unsigned long value;
 	unsigned long clk_value_khz;
+	unsigned long bits_per_line;
 
 	dev_dbg(info->device, "%s:\n", __func__);
 	dev_dbg(info->device, "  * resolution: %ux%u (%ux%u virtual)\n",
@@ -246,7 +247,8 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
 	else
 		info->fix.visual = FB_VISUAL_TRUECOLOR;
 
-	info->fix.line_length = info->var.xres_virtual * (info->var.bits_per_pixel / 8);
+	bits_per_line = info->var.xres_virtual * info->var.bits_per_pixel;
+	info->fix.line_length = DIV_ROUND_UP(bits_per_line, 8);
 
 	/* Re-initialize the DMA engine... */
 	dev_dbg(info->device, "  * update DMA engine\n");
-- 
1.4.4.4

  reply	other threads:[~2007-06-12 11:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-07 14:11 [PATCH] atmel_lcdfb: AT91/AT32 LCD Controller framebuffer driver Nicolas Ferre
2007-05-07 16:01 ` [RFC] AVR32: Implement platform hooks for atmel_lcdfb driver Haavard Skinnemoen
2007-05-07 21:40 ` [Linux-fbdev-devel] [PATCH] atmel_lcdfb: AT91/AT32 LCD Controller framebuffer driver Antonino A. Daplas
2007-05-08 17:26   ` Haavard Skinnemoen
2007-05-09 14:59   ` [Linux-fbdev-devel] " Nicolas Ferre
2007-05-18 18:05     ` Jan Altenberg
2007-06-12 11:27       ` Haavard Skinnemoen [this message]
2007-06-15  8:49         ` [PATCH] atmel_lcdfb: Fix wrong line_length calculation Nicolas Ferre
2007-05-09 14:59   ` [PATCH] atmel_lcdfb: AT91/AT32 LCDController framebuffer driver Nicolas Ferre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1181647677482-git-send-email-hskinnemoen@atmel.com \
    --to=hskinnemoen@atmel.com \
    --cc=adaplas@gmail.com \
    --cc=andrew@sanpeople.com \
    --cc=jan.altenberg@linutronix.de \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@rfo.atmel.com \
    --cc=patrice.vilchez@rfo.atmel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).