linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question abouf FB actual size
@ 2015-04-19 17:39 Paolo Niccolò Giubelli
  2015-04-19 19:29 ` Geert Uytterhoeven
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paolo Niccolò Giubelli @ 2015-04-19 17:39 UTC (permalink / raw)
  To: linux-fbdev

Hello world!
I'm developing a simple city simulator in C, and I'd like to draw the
city map on the framebuffer (it's just for debugging purposes).

There's something wrong with the math, because i have a 1366x768x32
FB, but my finfo.line_length (finfo is obtained via
FBIOGET_FSCREENINFO) is 5504 bytes. Well, 5504/4 (4 is 4 bytes per
pixel) is 1376 that is 10 pixels more than 1366.

Actually if I draw a full line using 5504 bytes everything is ok, if I
use 1366*4 I don't reach the edge of the monitor.

I'm using memset on a memory mapped /dev/fb0 file.

Is there something wrong or am I missing something?

Thank you in advance.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question abouf FB actual size
  2015-04-19 17:39 Question abouf FB actual size Paolo Niccolò Giubelli
@ 2015-04-19 19:29 ` Geert Uytterhoeven
  2015-04-19 20:01 ` Paolo Niccolò Giubelli
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-04-19 19:29 UTC (permalink / raw)
  To: linux-fbdev

On Sun, Apr 19, 2015 at 7:39 PM, Paolo Niccolò Giubelli
<paoloniccolo.giubelli@gmail.com> wrote:
> There's something wrong with the math, because i have a 1366x768x32
> FB, but my finfo.line_length (finfo is obtained via
> FBIOGET_FSCREENINFO) is 5504 bytes. Well, 5504/4 (4 is 4 bytes per
> pixel) is 1376 that is 10 pixels more than 1366.

1366 * 4 is not a multiple of 64. 5504 is.
I guess your hardware requires each line to start at an address which is a
multiple of 64.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question abouf FB actual size
  2015-04-19 17:39 Question abouf FB actual size Paolo Niccolò Giubelli
  2015-04-19 19:29 ` Geert Uytterhoeven
@ 2015-04-19 20:01 ` Paolo Niccolò Giubelli
  2015-04-19 20:15 ` Geert Uytterhoeven
  2015-04-19 20:20 ` Paolo Niccolò Giubelli
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Niccolò Giubelli @ 2015-04-19 20:01 UTC (permalink / raw)
  To: linux-fbdev

Thank you Geert! So I guess there's some kind of padding after the end
of the line, where I can write anything that has no effect. Do you
know if there's something to check into fb.h so to guess the alignment
requirements?

Greetings,
Paolo Niccolò

On Sun, Apr 19, 2015 at 9:29 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Sun, Apr 19, 2015 at 7:39 PM, Paolo Niccolò Giubelli
> <paoloniccolo.giubelli@gmail.com> wrote:
>> There's something wrong with the math, because i have a 1366x768x32
>> FB, but my finfo.line_length (finfo is obtained via
>> FBIOGET_FSCREENINFO) is 5504 bytes. Well, 5504/4 (4 is 4 bytes per
>> pixel) is 1376 that is 10 pixels more than 1366.
>
> 1366 * 4 is not a multiple of 64. 5504 is.
> I guess your hardware requires each line to start at an address which is a
> multiple of 64.
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question abouf FB actual size
  2015-04-19 17:39 Question abouf FB actual size Paolo Niccolò Giubelli
  2015-04-19 19:29 ` Geert Uytterhoeven
  2015-04-19 20:01 ` Paolo Niccolò Giubelli
@ 2015-04-19 20:15 ` Geert Uytterhoeven
  2015-04-19 20:20 ` Paolo Niccolò Giubelli
  3 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-04-19 20:15 UTC (permalink / raw)
  To: linux-fbdev

On Sun, Apr 19, 2015 at 10:01 PM, Paolo Niccolò Giubelli
<paoloniccolo.giubelli@gmail.com> wrote:
> On Sun, Apr 19, 2015 at 9:29 PM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
>> On Sun, Apr 19, 2015 at 7:39 PM, Paolo Niccolò Giubelli
>> <paoloniccolo.giubelli@gmail.com> wrote:
>>> There's something wrong with the math, because i have a 1366x768x32
>>> FB, but my finfo.line_length (finfo is obtained via
>>> FBIOGET_FSCREENINFO) is 5504 bytes. Well, 5504/4 (4 is 4 bytes per
>>> pixel) is 1376 that is 10 pixels more than 1366.
>>
>> 1366 * 4 is not a multiple of 64. 5504 is.
>> I guess your hardware requires each line to start at an address which is a
>> multiple of 64.
>
> Thank you Geert! So I guess there's some kind of padding after the end
> of the line, where I can write anything that has no effect. Do you
> know if there's something to check into fb.h so to guess the alignment
> requirements?

The only way to find out is to look at fb_fix_screeninfo.line_length.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question abouf FB actual size
  2015-04-19 17:39 Question abouf FB actual size Paolo Niccolò Giubelli
                   ` (2 preceding siblings ...)
  2015-04-19 20:15 ` Geert Uytterhoeven
@ 2015-04-19 20:20 ` Paolo Niccolò Giubelli
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Niccolò Giubelli @ 2015-04-19 20:20 UTC (permalink / raw)
  To: linux-fbdev

Perfect! Thank you so much, you've been very precious! :-D

Greetings,

Paolo


On Sun, Apr 19, 2015 at 10:15 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Sun, Apr 19, 2015 at 10:01 PM, Paolo Niccolò Giubelli
> <paoloniccolo.giubelli@gmail.com> wrote:
>> On Sun, Apr 19, 2015 at 9:29 PM, Geert Uytterhoeven
>> <geert@linux-m68k.org> wrote:
>>> On Sun, Apr 19, 2015 at 7:39 PM, Paolo Niccolò Giubelli
>>> <paoloniccolo.giubelli@gmail.com> wrote:
>>>> There's something wrong with the math, because i have a 1366x768x32
>>>> FB, but my finfo.line_length (finfo is obtained via
>>>> FBIOGET_FSCREENINFO) is 5504 bytes. Well, 5504/4 (4 is 4 bytes per
>>>> pixel) is 1376 that is 10 pixels more than 1366.
>>>
>>> 1366 * 4 is not a multiple of 64. 5504 is.
>>> I guess your hardware requires each line to start at an address which is a
>>> multiple of 64.
>>
>> Thank you Geert! So I guess there's some kind of padding after the end
>> of the line, where I can write anything that has no effect. Do you
>> know if there's something to check into fb.h so to guess the alignment
>> requirements?
>
> The only way to find out is to look at fb_fix_screeninfo.line_length.
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-19 20:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-19 17:39 Question abouf FB actual size Paolo Niccolò Giubelli
2015-04-19 19:29 ` Geert Uytterhoeven
2015-04-19 20:01 ` Paolo Niccolò Giubelli
2015-04-19 20:15 ` Geert Uytterhoeven
2015-04-19 20:20 ` Paolo Niccolò Giubelli

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).