radeonfb: FB_WAITFORVSYNC implementation
PATCH 1/1 radeonfb: FB_WAITFORVSYNC implementation
This is an implementation of the FB_WAITFORVSYNC ioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.
Signature · 1 line
Torgeir Veimo <[email protected]>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#define __u32 u_int32_t
#ifndef FBIO_WAITFORVSYNC
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
#endif
/* check functionality of VSYNC ioctl & determine approximate vertical refresh frequency */ /* compile with gcc -o vsynctest vsynctest.c */
/* March 12th, 2005, torgeir at nothome dot com. */
int main(int argc, char** argv) {
int retval = 0;
int fd = 0;
int zero = 0;
int i;
struct timeval start;
struct timeval end;
long total; float secs; float rate;
printf("testing refresh rate using FB_WAITFORVSYNC ioctl, standby while i loop 500 times..\n");
if ((fd = open( "/dev/fb0", O_RDWR )) < 0) {
printf("unable to access /dev/fb0, exiting..\n");
exit(1);
}
gettimeofday(&start, NULL);
for (i = 0; i < 500; i++) {
retval = ioctl(fd, FBIO_WAITFORVSYNC, &zero);
if (retval != 0) {
printf("ioctl failed, aborting...\n");
exit(1);
}
}
gettimeofday(&end, NULL);
total = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec);
secs = total / 1000000.0;
rate = 500000000.0 / total;
printf("time elapsed: %2.2f secs, refresh rate is %2.2f Hz\n", secs, rate);
close( fd );
}include/video/radeon.h +8 -0
@@ -541,6 +541,14 @@#define CRTC_EN (1 << 25)#define CRTC_DISP_REQ_EN_B (1 << 26) +/* GEN_INT_CNTL bit constants */ +#define CRTC_VBLANK_MASK (1 << 0) +#define CRTC_VBLANK_INT_EN (1 << 0) + +/* GEN_INT_STATUS bit constants */ +#define CRTC_VBLANK_STAT (1 << 0) +#define CRTC_VBLANK_STAT_ACK (1 << 0) +/* CRTC_STATUS bit constants */ #define CRTC_VBLANK 0x00000001
drivers/video/aty/radeonfb.h +10 -0
@@ -269,6 +269,11 @@ radeon_pm_off = 0x00000002, /* Can resume from D3 cold */ }; +struct radeon_interrupt { +wait_queue_head_t wait; +unsigned int count; +}; +struct radeonfb_info {struct fb_info *info;
@@ -344,6 +349,11 @@struct timer_list lvds_timer;u32 pending_lvds_gen_cntl; +int open; +struct radeon_interrupt vblank; +unsigned long irq_flags; +spinlock_t int_lock; +#ifdef CONFIG_FB_RADEON_I2C struct radeon_i2c_chan i2c[4 ];#endif
drivers/video/aty/radeon_base.c +126 -0
161 lines not on this page · raw message
Quoted 3 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.
Some comements below.
Also adding support for FB_ACTIVATE_VBL should be quite simple now.
Quoted 2 lines
drivers/video/aty/radeonfb.h +0
-0
<snip>
drivers/video/aty/radeonfb.h line 356
Quoted 9 lines
drivers/video/aty/radeonfb.h +5
-0@@ -344,6 +349,11 @@struct timer_list lvds_timer;u32 pending_lvds_gen_cntl; +int open; +struct radeon_interrupt vblank; +unsigned long irq_flags; +spinlock_t int_lock; +
Unused spinlock.
drivers/video/aty/radeon_base.c line 72
Quoted 11 lines
drivers/video/aty/radeonfb.h +0
-0#ifdef CONFIG_FB_RADEON_I2C struct radeon_i2c_chan i2c[4 ];#endif drivers/video/aty/radeon_base.c +2
-0@@ -68,6 +68,9 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/pci.h> +#include <linux/interrupt.h> +#include <linux/spinlock.h>
Unused spinlock so no need for the header.
Quoted 13 lines
drivers/video/aty/radeon_base.c +6
-0+#include <linux/wait.h> #include <linux/vmalloc.h> #include <linux/device.h> #include <linux/i2c.h> @@ -863,6 +866,97 @@ } +static irqreturn_t radeon_irq (int irq,void *dev_id,struct pt_regs *fp) +{ +struct radeonfb_info *rinfo = dev_id; +u32 int_cntl =0 ; +u32 stat =0 ;
drivers/video/aty/radeon_base.c line 883
Quoted 10 lines
drivers/video/aty/radeon_base.c +10
-0+ + int_cntl =INREG (GEN_INT_CNTL ); + stat =INREG (GEN_INT_STATUS ) & (CRTC_VBLANK_MASK ); +if (!stat) +return IRQ_NONE ; +if (stat) { +/* clear interrupt */ +OUTREG (GEN_INT_STATUS , stat); + + (rinfo->vblank.count)++;
Nitpick: Drop the parentheses.
Quoted 9 lines
drivers/video/aty/radeon_base.c +9
-0+wake_up_interruptible (&rinfo->vblank.wait); + } +return IRQ_HANDLED ; +} + +static int radeon_enable_irq (struct radeonfb_info *rinfo,int reenable) +{ +u32 int_cntl; +
drivers/video/aty/radeon_base.c line 902
Quoted 10 lines
drivers/video/aty/radeon_base.c +10
-0+if (!test_and_set_bit (0 , &rinfo->irq_flags)) { +if (request_irq (rinfo->pdev->irq, radeon_irq,SA_SHIRQ , +"radeonfb" , rinfo)) { +printk ("radeonfb: request_irq failed..\n" ); +clear_bit (0 , &rinfo->irq_flags); +return -EINVAL ; + } + int_cntl =INREG (GEN_INT_CNTL ) &CRTC_VBLANK_MASK ; +/* clear interrupt */ +//OUTREG(GEN_INT_CNTL, int_cntl | CRTC_VBLANK_STAT_ACK);
Why is this commented out?
Quoted 15 lines
drivers/video/aty/radeon_base.c +15
-0+/* enable interrupt */ +OUTREG (GEN_INT_CNTL , int_cntl |CRTC_VBLANK_INT_EN ); +printk ("radeonfb: enabled IRQ\n" ); + }else if (reenable) { + int_cntl =INREG (GEN_INT_CNTL ) &CRTC_VBLANK_MASK ; +if (!(int_cntl &CRTC_VBLANK_INT_EN )) { +printk ("radeonfb: someone disabled IRQ [%08x]\n" , int_cntl); +/* re-enable interrupt */ +OUTREG (GEN_INT_CNTL , int_cntl |CRTC_VBLANK_INT_EN ); + } + } + +return 0 ; +} +
<snip>
drivers/video/aty/radeon_base.c line 2463
Quoted 5 lines
drivers/video/aty/radeon_base.c +1
-0@@ -2338,6 +2460,10 @@radeon_create_i2c_busses (rinfo);#endif + rinfo->irq_flags =0 ;
Nitpick: No need to set to 0. rinfo is memset() to 0 by framebuffer_alloc().
drivers/video/aty/radeon_base.c line 2466
Quoted 3 lines
drivers/video/aty/radeon_base.c +3
-0+init_waitqueue_head (&rinfo->vblank.wait); +spin_lock_init (&(rinfo->int_lock)); +
Unused spinlock.
Quoted 2 lines
drivers/video/aty/radeon_base.c +0
-0/* set all the vital stuff */ radeon_set_fbinfo (rinfo);
Signature · 10 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 6 lines · Ville Syrjälä
Quoted 3 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.Some comements below.
Ok, I'll provide a new patch with fixes for these..
Quoted 1 line
Also adding support for
FB_ACTIVATE_VBLshould be quite simple now.
I guess it would require storing values, and apply the at the next vsync irq. What operations would be interesting to do this way?
Signature · 9 lines
Torgeir Veimo <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 2 lines · Ville Syrjälä
Also adding support for
FB_ACTIVATE_VBLshould be quite simple now.
You don't need an interrupt for that. You can choose via the CRTC_OFFSET_CNTL:CRTC_OFFSET_FLIP_CNTL bit whether the update of the CRTC offset should take effect immediately or on the next vertical blank.
Personally, I'm not sure why something that needs this functionality can't use the DRM...
Signature · 9 lines
Earthling Michel Dänzer | Debian (powerpc), X and DRI developer Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 11 lines · Michel Dänzer
Quoted 2 lines · Ville Syrjälä
Also adding support for
FB_ACTIVATE_VBLshould be quite simple now.You don't need an interrupt for that. You can choose via the CRTC_OFFSET_CNTL:CRTC_OFFSET_FLIP_CNTL bit whether the update of the CRTC offset should take effect immediately or on the next vertical blank.
Personally, I'm not sure why something that needs this functionality can't use the DRM...
My interest for adding this is video playback. It's kind of hard to do through the DRM.
Signature · 9 lines
Torgeir Veimo <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 10 lines · Torgeir Veimo
Quoted 9 lines · Michel D채nzer
Quoted 2 lines · Ville Syrj채l채
Also adding support for
FB_ACTIVATE_VBLshould be quite simple now.You don't need an interrupt for that. You can choose via the CRTC_OFFSET_CNTL:CRTC_OFFSET_FLIP_CNTL bit whether the update of the CRTC offset should take effect immediately or on the next vertical blank.
Quoted 5 lines
Quoted 2 lines
Personally, I'm not sure why something that needs this functionality can't use the DRM...
My interest for adding this is video playback. It's kind of hard to do through the DRM.
You don't have to use the DRM for anything but the wait for vsync; I can see the effort of initializing the DRM to the point where this is possible being prohibitive though.
The real point is that the usage of the interrupt needs to be coordinated between the framebuffer device and the DRM. Something like the first one to request the IRQ setting up a callback mechanism where the other can hook into might be a possibility? Or the shared mini-driver that has been proposed for years, but isn't liked by some...
Signature · 9 lines
Earthling Michel D채nzer | Debian (powerpc), X and DRI developer Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 21 lines · Michel Dänzer
Quoted 10 lines · Torgeir Veimo
Quoted 9 lines · Michel Dänzer
Quoted 2 lines · Ville Syrjälä
Also adding support for
FB_ACTIVATE_VBLshould be quite simple now.You don't need an interrupt for that. You can choose via the CRTC_OFFSET_CNTL:CRTC_OFFSET_FLIP_CNTL bit whether the update of the CRTC offset should take effect immediately or on the next vertical blank.
Quoted 5 lines
Quoted 2 lines
Personally, I'm not sure why something that needs this functionality can't use the DRM...
My interest for adding this is video playback. It's kind of hard to do through the DRM.
You don't have to use the DRM for anything but the wait for vsync; I can see the effort of initializing the DRM to the point where this is possible being prohibitive though.
Quoted 5 lines
The real point is that the usage of the interrupt needs to be coordinated between the framebuffer device and the DRM. Something like the first one to request the IRQ setting up a callback mechanism where the other can hook into might be a possibility? Or the shared mini-driver that has been proposed for years, but isn't liked by some...
When we get merged my thought was to let fbdev catch the vsync IRQ and then chain into DRM. In that model fbdev becomes the mini-driver. Right now I don't think there is any other solution than merging fbdev/DRM that doesn't result in some kind of dead on VT switch scenario.
Also, I have the hotplug monitor change interrupt hookup in my local code but I'm waiting for BenH to finish his dual head radeonfb first. He has said it will probably be ready this week, patches are starting to appear on lkml from him.
Signature · 9 lines
Jon Smirl [email protected] ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 6 lines
When we get merged my thought was to let fbdev catch the vsync IRQ and then chain into DRM. In that model fbdev becomes the mini-driver. Right now I don't think there is any other solution than merging fbdev/DRM that doesn't result in some kind of dead on VT switch scenario.
A VT switch should stop all asynchronous activity (interrupt, DRM, etc...). X already stops the DRM on switch-out, this could be enforced by the kernel.
Quoted 4 lines
Also, I have the hotplug monitor change interrupt hookup in my local code but I'm waiting for BenH to finish his dual head radeonfb first. He has said it will probably be ready this week, patches are starting to appear on lkml from him.
Those are just fixes to the existing code base. The new one isn't ready yet. I'll give it one more week unfortunately, I've been pressured by other issues those past few days.
Ben.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 8 lines · Michel Dänzer
Quoted 2 lines · Ville Syrjälä
Also adding support for
FB_ACTIVATE_VBLshould be quite simple now.You don't need an interrupt for that. You can choose via the CRTC_OFFSET_CNTL:CRTC_OFFSET_FLIP_CNTL bit whether the update of the CRTC offset should take effect immediately or on the next vertical blank.
Great. Matrox and mach64 chips don't have such a bit so they need to perform the flip/pan from the interrupt handler.
Quoted 2 lines
Personally, I'm not sure why something that needs this functionality can't use the DRM...
I think the DRM is a real bitch to use. It requires a lot of hw specific init code and AFAIK it needs root privilidges to get to the state where you can actually use it. It's much easier to use fbdev. And IMO logically that's where the vblank interrupt belongs since fbdev is the one programming the CRTC.
Signature · 10 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 10 lines · Ville Syrjälä
Quoted 3 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.Some comements below.
drivers/video/aty/radeonfb.h line 355
Quoted 1 line
drivers/video/aty/radeonfb.h +1
-0+spinlock_t int_lock;Unused spinlock.
Removed. Something leftover as I experimented to get it to work properly..
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* clear interrupt */ + //OUTREG(GEN_INT_CNTL, int_cntl | CRTC_VBLANK_STAT_ACK);Why is this commented out?
Well, first of all is it really important to clear the interrupt when enabling it?
From what I've seen the rage128 acknowledges an interrupt by writing to the int_cntl register, while the radeon does it by writing to the int_status register, so I think the above code is not correct.. I might want to clear any vblank interrupts by writing to the int_status register though.
I based my code on the matrox fb driver and the atyfb driver. I don't have any documentation on the radeon chipsets, so am working on what I can gather on the net.
Signature · 9 lines
Torgeir Veimo <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 6 lines · Torgeir Veimo
Quoted 4 lines · Ville Syrjälä
Quoted 3 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.
Quoted 7 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* clear interrupt */ + //OUTREG(GEN_INT_CNTL, int_cntl | CRTC_VBLANK_STAT_ACK);Why is this commented out?
Well, first of all is it really important to clear the interrupt when enabling it?
Well, this being the vblank interrupt it's not really critical but probably a good idea anyway.
Quoted 5 lines
Quoted 1 line
From what I've seen the rage128 acknowledges an interrupt by writing to
the
int_cntlregister, while the radeon does it by writing to theint_statusregister, so I think the above code is not correct.. I might want to clear any vblank interrupts by writing to theint_statusregister though.
mach64 chips both enable and ack interrupts using the INT_CNTL register (hence the spinlock in atyfb). Apparently they weren't really thinking straight when they designed it.
Signature · 10 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 8 lines · Torgeir Veimo
Quoted 6 lines · Ville Syrjälä
Review
Quoted 2 lines · Torgeir Veimo
(quoted diff) +2
-0+ /* clear interrupt */ + //OUTREG(GEN_INT_CNTL, int_cntl | CRTC_VBLANK_STAT_ACK);Why is this commented out?
Quoted 6 lines
Well, first of all is it really important to clear the interrupt when enabling it?
From what I've seen the rage128 acknowledges an interrupt by writing to the
int_cntlregister, while the radeon does it by writing to theint_statusregister, so I think the above code is not correct..
That's right, so the int_cntl stuff in the interrupt handler is superfluous?
Quoted 3 lines
I based my code on the matrox fb driver and the atyfb driver. I don't have any documentation on the radeon chipsets, so am working on what I can gather on the net.
Let me point out again that the DRM has perfectly working code for this...
Signature · 9 lines
Earthling Michel Dänzer | Debian (powerpc), X and DRI developer Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
You can't do this without coordination from X and DRM. If either of those are in use you will lock the machine with this patch. DRM also implements WAITFORVSYNC as well as other interrupts. If you clear the ISR DRM is going to stop working.
X is a bigger problem. If the radeonfb adapter is not the primary X adapter, X is going to disable its IO/MEM access at the PCI level on VT switch. Your radeonfb will then take an interrupt and not be able to acknowledge it. This results in an interrupt loop and you rebooting your machine.
See the "Who is stomping PCI config space?" thread in the x.org xserver list.
Because of these issues WAITFORVSYNC in radeondb has to wait for merged DRM/fbdev to be implemented.
Signature · 9 lines
Jon Smirl [email protected] ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 11 lines · Jon Smirl
You can't do this without coordination from X and DRM. If either of those are in use you will lock the machine with this patch. DRM also implements WAITFORVSYNC as well as other interrupts. If you clear the ISR DRM is going to stop working.
X is a bigger problem. If the radeonfb adapter is not the primary X adapter, X is going to disable its IO/MEM access at the PCI level on VT switch. Your radeonfb will then take an interrupt and not be able to acknowledge it. This results in an interrupt loop and you rebooting your machine.
Quoted 4 lines
See the "Who is stomping PCI config space?" thread in the x.org xserver list.
Because of these issues WAITFORVSYNC in radeondb has to wait for merged DRM/fbdev to be implemented.
It's not a problem if one doesn't use X.Org/XFree86. Also this patch should not affect X.Org/XFree86 users unless they manage to call the FBIO_WAITFORVSYNC ioctl. matroxfb and atyfb both have similar interrupt support and X can still be used with both.
Signature · 10 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 4 lines · Ville Syrjälä
It's not a problem if one doesn't use X.Org/XFree86. Also this patch should not affect X.Org/XFree86 users unless they manage to call the
FBIO_WAITFORVSYNCioctl. matroxfb and atyfb both have similar interrupt support and X can still be used with both.
Almost all PPC Linux boxes are running radeonfb with Xorg.
Quoted 16 lines
--
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&opclick
_______________________________________________
Linux-fbdev-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
Signature · 9 lines
Jon Smirl [email protected] ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 7 lines · Jon Smirl
Quoted 4 lines · Ville Syrjälä
It's not a problem if one doesn't use X.Org/XFree86. Also this patch should not affect X.Org/XFree86 users unless they manage to call the
FBIO_WAITFORVSYNCioctl. matroxfb and atyfb both have similar interrupt support and X can still be used with both.Almost all PPC Linux boxes are running radeonfb with Xorg.
What's your point? I doubt X.Org uses FBIO_WAITFORSYNC so the patch should not interfere with anything.
Signature · 10 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 11 lines · Ville Syrjälä
Quoted 7 lines · Jon Smirl
Quoted 4 lines · Ville Syrjälä
It's not a problem if one doesn't use X.Org/XFree86. Also this patch should not affect X.Org/XFree86 users unless they manage to call the
FBIO_WAITFORVSYNCioctl. matroxfb and atyfb both have similar interrupt support and X can still be used with both.Almost all PPC Linux boxes are running radeonfb with Xorg.
What's your point? I doubt X.Org uses
FBIO_WAITFORSYNCso the patch should not interfere with anything.
Run something on one VT that uses radeonfb with FBIO_WAITFORSYNC. Switch to VT with xorg.
Reboot box.
Quoted 16 lines
--
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&opclick
_______________________________________________
Linux-fbdev-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
Signature · 9 lines
Jon Smirl [email protected] ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 8 lines · Jon Smirl
Quoted 7 lines · Ville Syrjälä
Quoted 6 lines · Jon Smirl
Quoted 4 lines · Ville Syrjälä
It's not a problem if one doesn't use X.Org/XFree86. Also this patch should not affect X.Org/XFree86 users unless they manage to call the
FBIO_WAITFORVSYNCioctl. matroxfb and atyfb both have similar interrupt support and X can still be used with both.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Almost all PPC Linux boxes are running radeonfb with Xorg.
What's your point? I doubt X.Org uses
FBIO_WAITFORSYNCso the patch should not interfere with anything.Run something on one VT that uses radeonfb with
FBIO_WAITFORSYNC. Switch to VT with xorg.
Reboot box.
Not necessarily. We have the concept of active VT. FBIO_WAITFORSYNC only need to enable interrupts during the ioctl execution, and mail stop waiting and return an error if blank/set_var is called (and thus a VT switch happens).
Ben.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Quoted 4 lines · Jon Smirl
You can't do this without coordination from X and DRM.
Because of these issues WAITFORVSYNC in radeondb has to wait for merged DRM/fbdev to be implemented.
It's a bit hard to track the merge-dri-and-db work, so I'm basing it on mainline kernel. Is there a common repository for this work somewhere?
I think it would be a good idea to settle on a common set of register locations and values. Right now the #defines names used by framebuffers differ quite a lot from those used by dri.
Signature · 9 lines
Torgeir Veimo <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 7 lines · Torgeir Veimo
Quoted 4 lines · Jon Smirl
You can't do this without coordination from X and DRM.
Because of these issues WAITFORVSYNC in radeondb has to wait for merged DRM/fbdev to be implemented.
It's a bit hard to track the merge-dri-and-db work,
^^ merge-dri-and-fb
Signature · 9 lines
Torgeir Veimo <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 10 lines · Torgeir Veimo
Quoted 7 lines · Torgeir Veimo
Quoted 4 lines · Jon Smirl
You can't do this without coordination from X and DRM.
Because of these issues WAITFORVSYNC in radeondb has to wait for merged DRM/fbdev to be implemented.
It's a bit hard to track the merge-dri-and-db work,
^^ merge-dri-and-fb
Merging DRM and fbdev is happening in bits and pieces in both DRM and fbdev. I've already tried once at building it as a separate project and the political hassles of getting it merged made me stop. The new approach is to add the various bits to both drivers until they will merge with each other. A big piece of getting fbdev ready for DRM was getting the extended sysfs and module support that just went in.
BenH is working on a new version of radeonfb with support for both heads. I've stopped working on radeonfb until this lands since it changes 90% of the code.
Once the foundation is in place I'll modify DRM to attach to fbdev instead of loading as a standalone driver. At that point we can work on shared interrupt and buffer management code.
There are still some major unsettled issues:
1) where is the list of valid modes computed? in-kernel or user space. Technically either will work but each has plus and minuses. Right now radeonfb can do both.
1a) #1 is computing the mode list, not setting the mode. The mode is always set in the kernel.
2) multiheads implies buffer management, this needs to be coordinated with DRM
3) fbdev needs to implement hardware cursors
4) The fb_info struct doesn't work too well for multiple heads. It really should be split up into fb_device/fb_head.
5) driver initiated secondary card reset needs to be implement via a user space helper.
6) fbcon is tied way too closely to fb_info. There should be an interface instead of just letting it muck around in fbdev data structures.
Signature · 9 lines
Jon Smirl [email protected] ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 7 lines · Jon Smirl
1) where is the list of valid modes computed? in-kernel or user space. Technically either will work but each has plus and minuses. Right now radeonfb can do both.
1a) #1 is computing the mode list, not setting the mode. The mode is always set in the kernel.
At first, I would keep the current mecanism. After all, parsing the EDID and building the modelist is quite simple. Let the kernel driver do it, pick a default mode, and let userland optionally change that. That gives us at least a working boot mode for splash/console before userland is available. fbdev now has an API for userland to add/remove entries to modelists, we can extend on that.
Quoted 1 line
2) multiheads implies buffer management, this needs to be coordinated with DRM
Yes. That's the main issue with the merge imho. My initial version will do like MacOS, and cut the framebuffer in 2 apertures split in the middle. That's the simplest way to get 2 independant access swappers. This is necessary if we want completely independant framebuffer accesses to /dev/fbN and /dev/fbN+1 with different bit depth. It may not stay necessary in the long run if we have some lock for fb access, like X has, in which case we can just switch the swapper settings before each access.
Quoted 1 line
3) fbdev needs to implement hardware cursors
That isn't terribly difficult.
Quoted 2 lines
4) The
fb_infostruct doesn't work too well for multiple heads. It really should be split up into fb_device/fb_head.
Well, when I look at other OSes, they don't do that neither. They basically behave like if there was one device per head. All we need, I think, is the necessary infos to let userland know which heads are "linked" to a given device, but I don't think the fbdev layer has to care about the concept of "device". All it cares about is a "head" which is what fb_info represents.
Quoted 6 lines
5) driver initiated secondary card reset needs to be implement via a user space helper.
6) fbcon is tied way too closely to
fb_info. There should be an interface instead of just letting it muck around in fbdev data structures.
It's been very significantly split already, but yes, it could probably be separated a bit more, though there again, we can go step by step, there is no need to rewrite the whole world at once.
Ben.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 6 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.Signed-off-by Torgeir Veimo <[email protected]>
Please, CC me further radeonfb patches.
Ben.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 6 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.Signed-off-by Torgeir Veimo <[email protected]>Please, CC me further radeonfb patches.
Sure! Am mostly driven by what I need myself, not by any agenda... :
Signature · 9 lines
Torgeir Veimo <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 5 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.Signed-off-by Torgeir Veimo <[email protected]>
Please, put patches inline in the mail, not as attachment, it makes dealing with them simpler and possible to quote them with any mailer.
The patch definitely needs a lot of cleanups. A few things are wrong too, like using test_and_set_* as a mean of locking. This doesn't work on relaxed ordering architectures.
Besides, the entire fbdev subsystem is protected by the console semaphore, so you shouldn't need anything else. You need to acquire it yourself in the driver ioctl() routine though.
In order to avoid conflicting with other apps, you should probably "abort" the operation if a console switch happens while you are waiting. That is, a set_var() and/or a blank(). Return -EINTR or something like that.
Ben.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 3 lines · Torgeir Veimo
This is an implementation of the
FB_WAITFORVSYNCioctl for the radeonfb. A small test application is attached at the end. This patch is against vanilla 2.6.11.The patch definitely needs a lot of cleanups. A few things are wrong too, like using test_and_set_* as a mean of locking. This doesn't work on relaxed ordering architectures.
Quoted 8 lines
Besides, the entire fbdev subsystem is protected by the console semaphore, so you shouldn't need anything else. You need to acquire it yourself in the driver
ioctl()routine though.In order to avoid conflicting with other apps, you should probably "abort" the operation if a console switch happens while you are waiting. That is, a
set_var()and/or ablank(). Return-EINTRor something like that.
Do you have any example code I can look at for this? From what I can see neither the atyfb or matroxfb drivers do this. Not that I'm claiming they're correct, I guess the current vanilla kernel source is a bit behind the latest and greatest fb development.
Signature · 9 lines
Torgeir Veimo <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click