linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Using framebuffer device under Linux
@ 2003-11-18 12:41 Lawrence
  2003-11-18 13:11 ` Frederic Marmond
  0 siblings, 1 reply; 7+ messages in thread
From: Lawrence @ 2003-11-18 12:41 UTC (permalink / raw)
  To: linux-assembly

Hi All,

I am planning to do graphic with asm under Linux without X11.  I am try
to use framebuffer as the "drawing plane".

I've reached the article entitled "Using the framebuffer device under
Linux" within http://linuxassembly.org and I've extracted and compiled
fb.n according to the instruction.  However, when I run "fb" under the
console in RH9, I only got a refresh and then back to the text console.

I've tried fb under the installation environment of Debian 3.0, with I
thought it is already in framebuffer mode, but still got a failure.


I've tried ald fb, but when it is going to switch to framebuffer mode,
Linux squeeze and I have to telnet into my linux box using another
machine and issue a reboot...

I can successfully run "leaves" under a-linux however, but I don't know
how to put fb under a-linux so as to see if it works, as there seems no
way to mount a floppy or access ethernet under a-linux.

Would anyone be so kind as to tell me how could I access linux
framebuffer correcely using assembly, or point me out the forgettable
steps in order to run 'fb' successfully?

my 'nasm -r' command spit out:

NASM version 0.98.22 compiled on Sep 19 2003

Thanks
Lawrence



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

* Re: Using framebuffer device under Linux
  2003-11-18 12:41 Lawrence
@ 2003-11-18 13:11 ` Frederic Marmond
  2003-11-18 14:00   ` Lawrence
  0 siblings, 1 reply; 7+ messages in thread
From: Frederic Marmond @ 2003-11-18 13:11 UTC (permalink / raw)
  To: Lawrence; +Cc: linux-assembly

(re)Hi Lawrence! ;)

I don't know about the FB managment in linuxassembly, but here is some 
points you can have a look regarding FB:
- kernel may have support for FB already compiled in (see the kernel 
.config, and check that FB_ options are correctly setted)
- if kernel has the FB support, have a look at the kernel parameters 
(append="video=something" in your lilo.conf)
- you can also have a look at /var/log/messages
- to see if FB is already working, have a look at the '/proc'  (mount 
/proc;cat /proc/fb)
- to access FB, open/write to /dev/fb0
- to use kernel driver fb routines, use ioctl to /dev/fb0
- read documentation about the driver in /usr/src/linux/Documentation 
(if the kernel sources are installed, and if the kernel you run was 
compiled there)
- you can use the VESA driver (less optimised than a specific FB driver, 
but often work). Use the "vga=mode" parameter in your lilo to activate it.


To access the frame buffer as a large memory, you must use *mmap* in C. 
I don't know how it may be called in assembly under Linux, but this may 
be a start for you.
mmap will be used to map the device /dev/fb0 into memory. So, you may 
access the FB with assembly mov, very easily, as a 'standard' memory region.


Regards,
Fred


Lawrence wrote:

>Hi All,
>
>I am planning to do graphic with asm under Linux without X11.  I am try
>to use framebuffer as the "drawing plane".
>
>I've reached the article entitled "Using the framebuffer device under
>Linux" within http://linuxassembly.org and I've extracted and compiled
>fb.n according to the instruction.  However, when I run "fb" under the
>console in RH9, I only got a refresh and then back to the text console.
>
>I've tried fb under the installation environment of Debian 3.0, with I
>thought it is already in framebuffer mode, but still got a failure.
>
>
>I've tried ald fb, but when it is going to switch to framebuffer mode,
>Linux squeeze and I have to telnet into my linux box using another
>machine and issue a reboot...
>
>I can successfully run "leaves" under a-linux however, but I don't know
>how to put fb under a-linux so as to see if it works, as there seems no
>way to mount a floppy or access ethernet under a-linux.
>
>Would anyone be so kind as to tell me how could I access linux
>framebuffer correcely using assembly, or point me out the forgettable
>steps in order to run 'fb' successfully?
>
>my 'nasm -r' command spit out:
>
>NASM version 0.98.22 compiled on Sep 19 2003
>
>Thanks
>Lawrence
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>  
>



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

* Re: Using framebuffer device under Linux
  2003-11-18 13:11 ` Frederic Marmond
@ 2003-11-18 14:00   ` Lawrence
  2003-11-18 21:01     ` Karsten Scheibler
  0 siblings, 1 reply; 7+ messages in thread
From: Lawrence @ 2003-11-18 14:00 UTC (permalink / raw)
  To: fmarmond, linux-assembly

Hi Frederic,

Thanks for your reply. I did some more research after my post, and 
finally I can initialise the framebuffer under Red Hat 9.

I must pass something like "vga=788" as the kernel parameter to grub so 
that it will use /dev/fb0, "vga=ask" will change the mode you gave after 
boot up, but will immedately shift back to text mode when initialization 
script start.

Hoever, the asm program 'fb' still doesn't work...

Anyway, I'll try to consult the kernel doc you've mentioned.

Thanks again,
Lawrence

Frederic Marmond ??:

> (re)Hi Lawrence! ;)
>
> I don't know about the FB managment in linuxassembly, but here is some 
> points you can have a look regarding FB:
> - kernel may have support for FB already compiled in (see the kernel 
> .config, and check that FB_ options are correctly setted)
> - if kernel has the FB support, have a look at the kernel parameters 
> (append="video=something" in your lilo.conf)
> - you can also have a look at /var/log/messages
> - to see if FB is already working, have a look at the '/proc' (mount 
> /proc;cat /proc/fb)
> - to access FB, open/write to /dev/fb0
> - to use kernel driver fb routines, use ioctl to /dev/fb0
> - read documentation about the driver in /usr/src/linux/Documentation 
> (if the kernel sources are installed, and if the kernel you run was 
> compiled there)
> - you can use the VESA driver (less optimised than a specific FB 
> driver, but often work). Use the "vga=mode" parameter in your lilo to 
> activate it.
>
>
> To access the frame buffer as a large memory, you must use *mmap* in 
> C. I don't know how it may be called in assembly under Linux, but this 
> may be a start for you.
> mmap will be used to map the device /dev/fb0 into memory. So, you may 
> access the FB with assembly mov, very easily, as a 'standard' memory 
> region.
>
>
> Regards,
> Fred
>
>
> Lawrence wrote:
>
>> Hi All,
>>
>> I am planning to do graphic with asm under Linux without X11. I am try
>> to use framebuffer as the "drawing plane".
>>
>> I've reached the article entitled "Using the framebuffer device under
>> Linux" within http://linuxassembly.org and I've extracted and compiled
>> fb.n according to the instruction. However, when I run "fb" under the
>> console in RH9, I only got a refresh and then back to the text console.
>>
>> I've tried fb under the installation environment of Debian 3.0, with I
>> thought it is already in framebuffer mode, but still got a failure.
>>
>>
>> I've tried ald fb, but when it is going to switch to framebuffer mode,
>> Linux squeeze and I have to telnet into my linux box using another
>> machine and issue a reboot...
>>
>> I can successfully run "leaves" under a-linux however, but I don't know
>> how to put fb under a-linux so as to see if it works, as there seems no
>> way to mount a floppy or access ethernet under a-linux.
>>
>> Would anyone be so kind as to tell me how could I access linux
>> framebuffer correcely using assembly, or point me out the forgettable
>> steps in order to run 'fb' successfully?
>>
>> my 'nasm -r' command spit out:
>>
>> NASM version 0.98.22 compiled on Sep 19 2003
>>
>> Thanks
>> Lawrence
>>
>>
>> -
>> To unsubscribe from this list: send the line "unsubscribe 
>> linux-assembly" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>



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

* Re: Using framebuffer device under Linux
  2003-11-18 14:00   ` Lawrence
@ 2003-11-18 21:01     ` Karsten Scheibler
  0 siblings, 0 replies; 7+ messages in thread
From: Karsten Scheibler @ 2003-11-18 21:01 UTC (permalink / raw)
  To: linux-assembly; +Cc: Lawrence

Hello,

> Thanks for your reply. I did some more research after my post, and 
> finally I can initialise the framebuffer under Red Hat 9.
> 
> I must pass something like "vga=788" as the kernel parameter to grub so 
> that it will use /dev/fb0, "vga=ask" will change the mode you gave after 
> boot up, but will immedately shift back to text mode when initialization 
> script start.
> 
> Hoever, the asm program 'fb' still doesn't work...
> 
> Anyway, I'll try to consult the kernel doc you've mentioned.

maybe you could run

strace ./fb 2>log

and send what was written to log.



karsten

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

* Re: Using framebuffer device under Linux
@ 2003-11-19  1:28 Lawrence
  2003-11-19 22:03 ` Karsten Scheibler
  0 siblings, 1 reply; 7+ messages in thread
From: Lawrence @ 2003-11-19  1:28 UTC (permalink / raw)
  To: linux-assembly

Hi Karsten,

Thanks for your suggestion. here is what I got from strace:

execve("./fb", ["./fb"], [/* 18 vars */]) = 0
ioctl(0, 0x4b3b, 0x80492e8)             = 0
ioctl(0, 0x4b3a, 0x1)                   = 0
open("/dev/fb0", O_RDWR)                = 3
ioctl(3, 0x4600, 0x804931c)             = 0
ioctl(3, 0x4604, 0x80492ec)             = 0
ioctl(3, 0x4601, 0x80493bc)             = -1 EINVAL (Invalid argument)
ioctl(3, 0x4601, 0x804931c)             = 0
ioctl(3, 0x4605, 0x80492ec)             = 0
ioctl(0, 0x4b3a, 0)                     = 0
_exit(1)                                = ?


The system call in question seems on setting screen parameters.  But I 
don't know how to deal with this.  Could you please give me some hints?

Thanks and Regards,
Lawrence



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

* Re: Using framebuffer device under Linux
  2003-11-19  1:28 Using framebuffer device under Linux Lawrence
@ 2003-11-19 22:03 ` Karsten Scheibler
  2003-11-20  1:34   ` Lawrence
  0 siblings, 1 reply; 7+ messages in thread
From: Karsten Scheibler @ 2003-11-19 22:03 UTC (permalink / raw)
  To: linux-assembly

Hello Lawrence,

> Thanks for your suggestion. here is what I got from strace:
> 
> execve("./fb", ["./fb"], [/* 18 vars */]) = 0
> ioctl(0, 0x4b3b, 0x80492e8)             = 0
> ioctl(0, 0x4b3a, 0x1)                   = 0
> open("/dev/fb0", O_RDWR)                = 3
> ioctl(3, 0x4600, 0x804931c)             = 0
> ioctl(3, 0x4604, 0x80492ec)             = 0
> ioctl(3, 0x4601, 0x80493bc)             = -1 EINVAL (Invalid argument)
> ioctl(3, 0x4601, 0x804931c)             = 0
> ioctl(3, 0x4605, 0x80492ec)             = 0
> ioctl(0, 0x4b3a, 0)                     = 0
> _exit(1)                                = ?
> 
> 
> The system call in question seems on setting screen parameters.  But I 
> don't know how to deal with this.  Could you please give me some hints?

The fb example code tries to change the colordepth to 8bpp. That brings me to
the assumption that you use vesafb with another colordepth. vesafb is unable
to change colordepth after boot. All "real" fb drivers allow that, vesafb
not, due to BIOS calling limitations after boot. You should
change your vga= line which is passed to the kernel, to a mode with 8bpp.

If 

cat /proc/fb

outputs something like

0 VESA

then my assumption is right. Otherwise i would be interested in additional
information about your system (kernelversion etc.).

You may try to execute

fbset

to see your current fb parameters



karsten

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

* Re: Using framebuffer device under Linux
  2003-11-19 22:03 ` Karsten Scheibler
@ 2003-11-20  1:34   ` Lawrence
  0 siblings, 0 replies; 7+ messages in thread
From: Lawrence @ 2003-11-20  1:34 UTC (permalink / raw)
  To: linux-assembly

Hi Karsten,

Thank you very much for your invaluable adivce. Your assumption is 
right. I've set the color bit to 24bit so that the program fail. After 
setting it back to 8 bit, the program works elegantly.

Next I'll examine the code carefully in order to grasp the assets in it.

Thanks again for all your help.

Best Regards,
Lawrence

Karsten Scheibler ??:

>Hello Lawrence,
>
>  
>
>>Thanks for your suggestion. here is what I got from strace:
>>
>>execve("./fb", ["./fb"], [/* 18 vars */]) = 0
>>ioctl(0, 0x4b3b, 0x80492e8)             = 0
>>ioctl(0, 0x4b3a, 0x1)                   = 0
>>open("/dev/fb0", O_RDWR)                = 3
>>ioctl(3, 0x4600, 0x804931c)             = 0
>>ioctl(3, 0x4604, 0x80492ec)             = 0
>>ioctl(3, 0x4601, 0x80493bc)             = -1 EINVAL (Invalid argument)
>>ioctl(3, 0x4601, 0x804931c)             = 0
>>ioctl(3, 0x4605, 0x80492ec)             = 0
>>ioctl(0, 0x4b3a, 0)                     = 0
>>_exit(1)                                = ?
>>
>>
>>The system call in question seems on setting screen parameters.  But I 
>>don't know how to deal with this.  Could you please give me some hints?
>>    
>>
>
>The fb example code tries to change the colordepth to 8bpp. That brings me to
>the assumption that you use vesafb with another colordepth. vesafb is unable
>to change colordepth after boot. All "real" fb drivers allow that, vesafb
>not, due to BIOS calling limitations after boot. You should
>change your vga= line which is passed to the kernel, to a mode with 8bpp.
>
>If 
>
>cat /proc/fb
>
>outputs something like
>
>0 VESA
>
>then my assumption is right. Otherwise i would be interested in additional
>information about your system (kernelversion etc.).
>
>You may try to execute
>
>fbset
>
>to see your current fb parameters
>
>
>
>karsten
>-
>To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>  
>



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

end of thread, other threads:[~2003-11-20  1:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-19  1:28 Using framebuffer device under Linux Lawrence
2003-11-19 22:03 ` Karsten Scheibler
2003-11-20  1:34   ` Lawrence
  -- strict thread matches above, loose matches on Subject: below --
2003-11-18 12:41 Lawrence
2003-11-18 13:11 ` Frederic Marmond
2003-11-18 14:00   ` Lawrence
2003-11-18 21:01     ` Karsten Scheibler

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