linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [Linux-fbdev-devel] Re: Generic VESA framebuffer driver and Video card BOOT?
@ 2004-10-21 22:28 Pallipadi, Venkatesh
  2004-10-21 23:00 ` Pavel Machek
  2004-10-22 17:10 ` Kendall Bennett
  0 siblings, 2 replies; 26+ messages in thread
From: Pallipadi, Venkatesh @ 2004-10-21 22:28 UTC (permalink / raw)
  To: Kendall Bennett, Pavel Machek; +Cc: linux-kernel, linux-fbdev-devel

 

>-----Original Message-----
>From: linux-kernel-owner@vger.kernel.org 
>>         pushl   $0                                           
>   # Kill any dangerous flags
>>         popfl
>> 
>>         movl    real_magic - wakeup_code, %eax
>>         cmpl    $0x12345678, %eax
>>         jne     bogus_real_magic
>> 
>>         testl   $1, video_flags - wakeup_code
>>         jz      1f
>>         lcall   $0xc000,$3
>
>The call to 0xC000:0x0003 is the entry point to POST the card. However 
>for PCI cards you need to make sure that AX is loaded with the 
>bus, slot 
>and function for the card that is being POST'ed. It will pass 
>this value 
>to the PCI BIOS Int 0x1A functions in order to find itself, so 
>if this is 
>not set many BIOS'es will not work.
>
>The rest of the code you have above seems superfluous to me as we have 
>never needed to do that. Then again we boot the card using the BIOS 
>emulator, which is different because it runs within a 
>protected machine 
>state.
>
>Have you taken a look at the X.org code? They have code in 
>there to POST 
>the video card also (either using vm86() or the BIOS emulator).
>

I have done some experiments with this video post stuff.
I think this should be done using x86 emulator rather than doing 
in real mode. The reason being, with an userlevel emulator we can call
it at different times during resume. The current real mode videopost
does 
it before the driver has restored the PCI config space. Some systems 
(mostly the ones with Radeon card) requires this to be done after 
PCI config space is restored. With a userspace emulator, we can 
call it at various places during the driver restore.

I have seen the SciTech's x86 emulator in X.org. I could seperate it out

from X into a stand alone application that does x86 emulation. I use it
to get 
the video back on my laptop (which has radeon card), by calling this
user level 
emulator using usermodehelper call. I hope we will have x86 emulator
sitting in 
a standard place in userspace. That way we can use it in driver restore
and 
solve the S3 video restore problem in a more generic way.

Thanks,
Venki

^ permalink raw reply	[flat|nested] 26+ messages in thread
* RE: [Linux-fbdev-devel] Re: Generic VESA framebuffer driver and Video card BOOT?
@ 2004-10-22 18:04 Pallipadi, Venkatesh
  0 siblings, 0 replies; 26+ messages in thread
From: Pallipadi, Venkatesh @ 2004-10-22 18:04 UTC (permalink / raw)
  To: Jon Smirl; +Cc: Matthew Garrett, stefandoesinger, linux-kernel

>-----Original Message-----
>From: Jon Smirl [mailto:jonsmirl@gmail.com] 
>Sent: Friday, October 22, 2004 10:19 AM
>To: Pallipadi, Venkatesh
>Cc: Matthew Garrett; stefandoesinger@gmx.at; 
>linux-kernel@vger.kernel.org
>Subject: Re: [Linux-fbdev-devel] Re: Generic VESA framebuffer 
>driver and Video card BOOT?
>
>On Fri, 22 Oct 2004 09:36:40 -0700, Pallipadi, Venkatesh
><venkatesh.pallipadi@intel.com> wrote:
>> Actually I sent the kernel patch to call some userlevel 
>vgapost utility
>> on this same thread around a week back. I am sending it here again.
>
>It is more complex to restart the VGA system when there are multiple
>cards. You have to disable all of the other VGA devices before
>reseting one otherwise you will end up with two enabled VGA devices
>and address ownership conflicts. You also have to move the PCI bus
>routing around so that it points to the correct card.
>
>There is a pending patch in mm, bk-pci, that exposes video ROMs via
>sysfs. That makes writing the reset program cleaner. You should not
>play with the ROM or the PIC bus routine from user space, that needs
>to be done in the kernel.
>

Yes. I looked at that patch which exposes video ROM through sysfs. 
But, we will also need either a kernel or user level x86 emulator, 
to use this ROM for things like vgapost. Right? 
I was using the video ROM exposed through sysfs for my userlevel 
emulation, until I found out the vgapost calls also uses some other 
things outside video ROM as it makes other INT calls internally.
That's when I moved out to use the X approach of mapping /dev/mem.

I agree with you on all the things about multiple VGA card and 
their initializations. But, I am more concerned about the more 
common single video card systems, which doesn't get video back after 
S3 suspend and resume, just because the kernel doesn't do vgapost 
at proper time. With thousands of such systems being used already, 
I feel we need to have some working solution for that sooner.

Thanks,
Venki



^ permalink raw reply	[flat|nested] 26+ messages in thread
* RE: [Linux-fbdev-devel] Re: Generic VESA framebuffer driver and Video card BOOT?
@ 2004-10-22 17:16 Pallipadi, Venkatesh
  0 siblings, 0 replies; 26+ messages in thread
From: Pallipadi, Venkatesh @ 2004-10-22 17:16 UTC (permalink / raw)
  To: Kendall Bennett; +Cc: linux-kernel, linux-fbdev-devel

 

>-----Original Message-----
>From: Kendall Bennett [mailto:KendallB@scitechsoft.com] 
>Sent: Friday, October 22, 2004 10:11 AM
>To: Pallipadi, Venkatesh
>Cc: linux-kernel@vger.kernel.org; 
>linux-fbdev-devel@lists.sourceforge.net
>Subject: RE: [Linux-fbdev-devel] Re: Generic VESA framebuffer 
>driver and Video card BOOT?
>
>"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com> wrote:
>
>> I have done some experiments with this video post stuff. I think
>> this should be done using x86 emulator rather than doing in real
>> mode. The reason being, with an userlevel emulator we can call it
>> at different times during resume. The current real mode videopost
>> does it before the driver has restored the PCI config space. Some
>> systems (mostly the ones with Radeon card) requires this to be
>> done after PCI config space is restored. With a userspace
>> emulator, we can call it at various places during the driver
>> restore. 
>> 
>> I have seen the SciTech's x86 emulator in X.org. I could seperate
>> it out from X into a stand alone application that does x86
>> emulation. I use it to get the video back on my laptop (which has
>> radeon card), by calling this user level emulator using
>> usermodehelper call. I hope we will have x86 emulator sitting in a
>> standard place in userspace. That way we can use it in driver
>> restore and solve the S3 video restore problem in a more generic
>> way. 
>
>We already have all this code completely separate from X and would 
>release this as part of the Video Boot package for Linux. The kernel 
>module is one part of it, but the code can be compiled as a 
>stand alone 
>user land program as well (SNAPBoot we call it right now). 
>

That is really nice to know. That will make "video on S3 resume" problem
go away on quite a few laptops. Will look forward to release of such a
code.

Thanks,
Venki

^ permalink raw reply	[flat|nested] 26+ messages in thread
* RE: [Linux-fbdev-devel] Re: Generic VESA framebuffer driver and Video card BOOT?
@ 2004-10-22 16:36 Pallipadi, Venkatesh
  2004-10-22 17:19 ` Jon Smirl
  2004-10-22 17:31 ` Stefan Dösinger
  0 siblings, 2 replies; 26+ messages in thread
From: Pallipadi, Venkatesh @ 2004-10-22 16:36 UTC (permalink / raw)
  To: Matthew Garrett, stefandoesinger; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]

>-----Original Message-----
>From: Matthew Garrett [mailto:mgarrett@chiark.greenend.org.uk] 
>Sent: Thursday, October 21, 2004 6:39 PM
>To: Pallipadi, Venkatesh
>Cc: linux-kernel@vger.kernel.org
>Subject: Re: [Linux-fbdev-devel] Re: Generic VESA framebuffer 
>driver and Video card BOOT?
>
>Pallipadi, Venkatesh <venkatesh.pallipadi@intel.com> wrote:
>
>Hi,
>
>> Even I thought so. But, with the emulator it doesn't hang. It brings 
>> back my video. I double checked this using another vm86 
>emulator too. 
>> No hang even there. I couldn't figure out why Ole's patch won't work 
>> though. Right now I am using call_usermodehelper() to call the 
>> emulator during resume and the video comes back just fine on this 
>> system where Ole's patch didn't work.
>
>Is it possible to get this patch and code off you? I'd be interested in
>testing this solution on various bits of hardware I've been working on.
>

Actually I sent the kernel patch to call some userlevel vgapost utility 
on this same thread around a week back. I am sending it here again. 

I don't think sending a big userlevel code tar file is appropriate on
lkml. 
I will send that in a separate mail to Matthew and Stefan. If anyone
else 
wants to play with it, just let me know.

It works for me on various systems with Radeon card. It didn't help on 
systems with Intel Graphics card.

Stefan: Yes. Usermodehelper won't work during the driver resume. But, it

works later after the kernel threads are woken up. With attached patch
and
with user level vgapost I can get video back, both on X and VGA console.
It doesn't help with framebuffer, as the framebuffer reinitialization 
happens during the driver resume, which is earlier than this vgapost
call.


Thanks,
Venki

[-- Attachment #2: vgapost2.patch --]
[-- Type: application/octet-stream, Size: 1916 bytes --]

--- linux-2.6.9/kernel/power/main.c.org	2004-10-22 11:11:58.000000000 -0700
+++ linux-2.6.9/kernel/power/main.c	2004-10-22 11:15:45.000000000 -0700
@@ -93,6 +93,19 @@ static int suspend_enter(u32 state)
 	return error;
 }
 
+int vgapost_usermode(void)
+{
+      char    *argv[3] = {NULL, NULL, NULL};
+      char    *envp[3] = {NULL, NULL, NULL};
+
+      argv[0] = "/root/emu/video_post";
+
+      /* minimal command environment */
+      envp[0] = "HOME=/";
+      envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+
+      return call_usermodehelper(argv[0], argv, envp, 1);
+}
 
 /**
  *	suspend_finish - Do final work before exiting suspend sequence.
@@ -107,6 +120,10 @@ static void suspend_finish(u32 state)
 	device_resume();
 	if (pm_ops && pm_ops->finish)
 		pm_ops->finish(state);
+
+        thaw_processes_kernel();
+        vgapost_usermode();
+
 	thaw_processes();
 	pm_restore_console();
 }
--- linux-2.6.9/kernel/power/process.c.org	2004-10-22 11:12:14.000000000 -0700
+++ linux-2.6.9/kernel/power/process.c	2004-10-22 11:20:37.000000000 -0700
@@ -97,6 +97,29 @@ int freeze_processes(void)
 	return 0;
 }
 
+void thaw_processes_kernel(void)
+{
+	struct task_struct *g, *p;
+
+	printk( "Restarting kernel tasks..." );
+	read_lock(&tasklist_lock);
+	do_each_thread(g, p) {
+		if (!freezeable(p))
+			continue;
+		if (p->parent->pid != 1)
+			continue;
+		if (p->flags & PF_FROZEN) {
+			p->flags &= ~PF_FROZEN;
+			wake_up_process(p);
+		} else
+			printk(KERN_INFO " Strange, %s not stopped\n", p->comm );
+	} while_each_thread(g, p);
+
+	read_unlock(&tasklist_lock);
+	schedule();
+	printk( " done\n" );
+}
+
 void thaw_processes(void)
 {
 	struct task_struct *g, *p;
@@ -106,6 +129,8 @@ void thaw_processes(void)
 	do_each_thread(g, p) {
 		if (!freezeable(p))
 			continue;
+		if (p->parent->pid == 1)
+			continue;
 		if (p->flags & PF_FROZEN) {
 			p->flags &= ~PF_FROZEN;
 			wake_up_process(p);


^ permalink raw reply	[flat|nested] 26+ messages in thread
* RE: [Linux-fbdev-devel] Re: Generic VESA framebuffer driver and Video card BOOT?
@ 2004-10-21 23:44 Pallipadi, Venkatesh
  2004-10-22  1:39 ` Matthew Garrett
  2004-10-22 12:57 ` Stefan Dösinger
  0 siblings, 2 replies; 26+ messages in thread
From: Pallipadi, Venkatesh @ 2004-10-21 23:44 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Kendall Bennett, linux-kernel, linux-fbdev-devel, stefandoesinger

>-----Original Message-----
>From: linux-kernel-owner@vger.kernel.org 
>[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Pavel Machek
>Sent: Thursday, October 21, 2004 4:23 PM
>To: Pallipadi, Venkatesh
>Cc: Kendall Bennett; linux-kernel@vger.kernel.org; 
>linux-fbdev-devel@lists.sourceforge.net; stefandoesinger@gmx.at
>Subject: Re: [Linux-fbdev-devel] Re: Generic VESA framebuffer 
>driver and Video card BOOT?
>
>Hi!
>
>> >> I have done some experiments with this video post stuff.
>> >> I think this should be done using x86 emulator rather than doing 
>> >> in real mode. The reason being, with an userlevel emulator 
>> >we can call
>> >> it at different times during resume. The current real 
>mode videopost
>> >> does 
>> >
>> >Actually Ole Rohne has patch that allows you to call real mode any
>> >time you want.
>> 
>> Yes. I tried Ole's patch. That helped on one of my laptops. But, on 
>> the other one it doesn't work. It goes into real mode but 
>never returns.
>> Both systems had Radeom 9000M cards, but one with older 
>version of the 
>> firmware (didn't work) and one with newer version.
>> 
>> IIRC, even Stefan had similar problems with Ole's patch.
>
>It did not work for me, either, but I verified that it works as
>expected if I comment out actuall call of BIOS. So the problem is not
>with Ole's patch but with bios, and it may be the same if you emulate
>it...
>
>[Of course, it will not crash whole system when emulated, but system
>without video is not too good, either].

Even I thought so. But, with the emulator it doesn't hang. It brings 
back my video. I double checked this using another vm86 emulator too. 
No hang even there. I couldn't figure out why Ole's patch won't work 
though. Right now I am using call_usermodehelper() to call the 
emulator during resume and the video comes back just fine on this 
system where Ole's patch didn't work.

Thanks,
Venki

^ permalink raw reply	[flat|nested] 26+ messages in thread
* RE: [Linux-fbdev-devel] Re: Generic VESA framebuffer driver and Video card BOOT?
@ 2004-10-21 23:10 Pallipadi, Venkatesh
  2004-10-21 23:23 ` Pavel Machek
  0 siblings, 1 reply; 26+ messages in thread
From: Pallipadi, Venkatesh @ 2004-10-21 23:10 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Kendall Bennett, linux-kernel, linux-fbdev-devel, stefandoesinger

>-----Original Message-----
>From: Pavel Machek [mailto:pavel@ucw.cz] 
>Sent: Thursday, October 21, 2004 4:00 PM
>To: Pallipadi, Venkatesh
>Cc: Kendall Bennett; linux-kernel@vger.kernel.org; 
>linux-fbdev-devel@lists.sourceforge.net
>Subject: Re: [Linux-fbdev-devel] Re: Generic VESA framebuffer 
>driver and Video card BOOT?
>
>Hi!
>
>> >The rest of the code you have above seems superfluous to me 
>as we have 
>> >never needed to do that. Then again we boot the card using the BIOS 
>> >emulator, which is different because it runs within a 
>> >protected machine 
>> >state.
>> >
>> >Have you taken a look at the X.org code? They have code in 
>> >there to POST 
>> >the video card also (either using vm86() or the BIOS emulator).
>> >
>> 
>> I have done some experiments with this video post stuff.
>> I think this should be done using x86 emulator rather than doing 
>> in real mode. The reason being, with an userlevel emulator 
>we can call
>> it at different times during resume. The current real mode videopost
>> does 
>
>Actually Ole Rohne has patch that allows you to call real mode any
>time you want.
>								Pavel

Yes. I tried Ole's patch. That helped on one of my laptops. But, on 
the other one it doesn't work. It goes into real mode but never returns.
Both systems had Radeom 9000M cards, but one with older version of the 
firmware (didn't work) and one with newer version.

IIRC, even Stefan had similar problems with Ole's patch.

Thanks,
Venki

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Generic VESA framebuffer driver and Video card BOOT?
@ 2004-10-14 19:02 Kendall Bennett
  2004-10-15 18:36 ` Kendall Bennett
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Kendall Bennett @ 2004-10-14 19:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fbdev-devel, penguinppc-team

Hello All,

I am writing this email to guage the interest in having code contributed 
to the main stream Linux kernel that would support the user of a generic, 
full featured VESA framebuffer driver that works on any CPU architecture 
along with a generic Video card BOOT or POST mechanism.

We have been working on a project under contract to ATI that involves 
porting a version of our SNAPBoot BIOS emulator solution to the PowerPC 
Linux kernel. The SNAPBoot code supports initialising a graphics card 
using an x86 BIOS image on any platform (currently tesed on x86, x86-64 
and PowerPC). Initially SNAPBoot was developed to work across multiple 
operating systems and CPU architectures from user space, but the desire 
to use it to initialise the graphics card on embedded PowerPC kernels 
prompted us to port a version of it for use within the Linux kernel. The 
version we have ported for use in the kernel can be used to initialise 
the graphics card for use with any accelerated framebuffer console 
driver, such as the radeonfb driver which we are currently using it with.

Note that the SNAPBoot code uses the x86emu BIOS emulator project as the 
core CPU emulation technology, and project we have been actively involved 
with for many years since the licensing on the project was changed to 
MIT/BSD style licensing and incorporated into the XFree86 project. We 
have built code on top of x86emu to provide generic support for 
initialising graphics cards on multiple platforms as well as supporting 
initialisation of modern NonVGA graphics cards (like the ATI Radeon 
family) without needing access to real VGA resources such as VGA I/O 
ports and physical memory at 0xA0000-0xBFFFF.

More importantly we have used SNAPBoot to port our generic VESA SNAP 
display driver to work on multiple operating systems and platforms, 
including both x86-64 and PowerPC platforms. Using this driver you can 
use any graphics card in the machine and it will support all the features 
provided by the graphics cards VESA BIOS, including support for refresh 
rate control on cards that support VBE 3.0 services. We have been 
actively testing both the SNAPBoot capability and the BIOS emulator on 
many platforms and graphics cards, and the latest version work flawlessly 
on just about every graphics card we have tested.

What this means is that it should be possible to build a new version of 
the VESA framebuffer console driver for the Linux kernel that will have 
these important features:

1. Be able to switch display modes on the fly, supporting all modes 
enumerated by the Video BIOS.

2. Be able to support refresh rate control on graphics cards that support 
the VBE 3.0 services.

3. Be able to support 8-bit and 32-bit display modes on any graphics card 
on big endian machines (16-bit is not possible unless software rendering 
code is written to enable endian swapping in software, which may be 
possible).

So what we would like to find out is how much interest there might be in 
both an updated VESA framebuffer console driver as well as the code for 
the Video card BOOT process being contributed to the maintstream kernel. 
If there is interest, we would start out by first contributing the core 
emulator and Video BOOT code, and then work on building a better VESA 
framebuffer console driver. 

So what do you guys think? 

Regards,

---
Kendall Bennett
Chief Executive Officer
SciTech Software, Inc.
Phone: (530) 894 8400
http://www.scitechsoft.com

~ SciTech SNAP - The future of device driver technology! ~



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

end of thread, other threads:[~2004-10-27 19:59 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-21 22:28 [Linux-fbdev-devel] Re: Generic VESA framebuffer driver and Video card BOOT? Pallipadi, Venkatesh
2004-10-21 23:00 ` Pavel Machek
2004-10-22 17:10 ` Kendall Bennett
  -- strict thread matches above, loose matches on Subject: below --
2004-10-22 18:04 Pallipadi, Venkatesh
2004-10-22 17:16 Pallipadi, Venkatesh
2004-10-22 16:36 Pallipadi, Venkatesh
2004-10-22 17:19 ` Jon Smirl
2004-10-22 17:31 ` Stefan Dösinger
2004-10-21 23:44 Pallipadi, Venkatesh
2004-10-22  1:39 ` Matthew Garrett
2004-10-22 12:57 ` Stefan Dösinger
2004-10-21 23:10 Pallipadi, Venkatesh
2004-10-21 23:23 ` Pavel Machek
2004-10-14 19:02 Kendall Bennett
2004-10-15 18:36 ` Kendall Bennett
2004-10-15 21:51   ` [Linux-fbdev-devel] " Antonino A. Daplas
2004-10-15 22:12   ` Kendall Bennett
2004-10-16  0:41     ` [Linux-fbdev-devel] " Antonino A. Daplas
2004-10-26 11:14       ` Paulo Marques
2004-10-27  1:58         ` Kendall Bennett
2004-10-27 11:11           ` Paulo Marques
2004-10-27 19:52             ` Kendall Bennett
2004-10-16 17:44 ` Jon Smirl
2004-10-18 19:34   ` [Linux-fbdev-devel] " Kendall Bennett
2004-10-19 21:11 ` Pavel Machek
2004-10-20 17:01   ` [Linux-fbdev-devel] " Kendall Bennett
2004-10-20 17:31     ` Pavel Machek
2004-10-20 18:44       ` Kendall Bennett
2004-10-20 19:10         ` Pavel Machek
2004-10-21 19:36           ` Kendall Bennett
2004-10-21 20:47             ` Richard Smith

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