linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Frame swapping
@ 2005-12-08 15:24 Jenkins, Clive
  2005-12-08 21:18 ` Antonino A. Daplas
  0 siblings, 1 reply; 4+ messages in thread
From: Jenkins, Clive @ 2005-12-08 15:24 UTC (permalink / raw)
  To: linux-fbdev-devel

How is frame swapping done, using the mechanisms provided
by FB (in 2.4 and 2.6)?
Can anyone point me to any good code examples in the
existing FB device drivers?

["Frame swapping" or "video page flipping" is switching
to an alternate framebuffer memory area during the
vertical blank period. This is a common technique to
achieve animation or a single clean change of picture.]

Thanks,
Clive


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id\x16865&op=click

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

* Re: Frame swapping
  2005-12-08 15:24 Frame swapping Jenkins, Clive
@ 2005-12-08 21:18 ` Antonino A. Daplas
  0 siblings, 0 replies; 4+ messages in thread
From: Antonino A. Daplas @ 2005-12-08 21:18 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Clive.Jenkins

Jenkins, Clive wrote:
> How is frame swapping done, using the mechanisms provided
> by FB (in 2.4 and 2.6)?
> Can anyone point me to any good code examples in the
> existing FB device drivers?
> 
> ["Frame swapping" or "video page flipping" is switching
> to an alternate framebuffer memory area during the
> vertical blank period. This is a common technique to
> achieve animation or a single clean change of picture.]

Use the pan display ioctl, FBIOPAN_DISPLAY.  Basically, set
var->yres_virtual to be at least 2x var->yres so you can have
2 video buffers, one visible, one offscreen.  Then just do a
ypan ioctl to set which buffer becomes visible and which
becomes offscreen.

Doing it during vblank is a little difficult.  You can poll
the VGA registers (which is slow), or set up an interrupt
handler for the driver you are using that waits for vblank.

See www.directfb.org for code on how this can be done.  Also,
the directfb source have patches to some drivers that implements
the wating for vblank, such as in matroxfb.

Tony



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

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

* RE: Frame swapping
@ 2005-12-09  9:37 Jenkins, Clive
  2005-12-09 12:27 ` Antonino A. Daplas
  0 siblings, 1 reply; 4+ messages in thread
From: Jenkins, Clive @ 2005-12-09  9:37 UTC (permalink / raw)
  To: Antonino A. Daplas, linux-fbdev-devel

> From: Antonino A. Daplas [mailto:adaplas@gmail.com] 
> Sent: 08 December 2005 21:18
> To: linux-fbdev-devel@lists.sourceforge.net
> Cc: Jenkins, Clive
> Subject: Re: [Linux-fbdev-devel] Frame swapping
> 
> Jenkins, Clive wrote:
> > How is frame swapping done, using the mechanisms provided
> > by FB (in 2.4 and 2.6)?
> > Can anyone point me to any good code examples in the
> > existing FB device drivers?
> > 
> > ["Frame swapping" or "video page flipping" is switching
> > to an alternate framebuffer memory area during the
> > vertical blank period. This is a common technique to
> > achieve animation or a single clean change of picture.]
> 
> Use the pan display ioctl, FBIOPAN_DISPLAY.  Basically, set
> var->yres_virtual to be at least 2x var->yres so you can have
> 2 video buffers, one visible, one offscreen.  Then just do a
> ypan ioctl to set which buffer becomes visible and which
> becomes offscreen.
> 
> Doing it during vblank is a little difficult.  You can poll
> the VGA registers (which is slow), or set up an interrupt
> handler for the driver you are using that waits for vblank.
> 
> See www.directfb.org for code on how this can be done.  Also,
> the directfb source have patches to some drivers that implements
> the wating for vblank, such as in matroxfb.
> 
> Tony

Thanks Tony. I was thinking I would have to implement my own
ioctl to do this, but I agree it can be regarded as a special
case of panning (even though my hardware doesn't fully support
panning).

I would expect panning to be smooth and glitch-free whenever
possible within the limitations of the hardware, so the
switch-over should always occur during vblank. I have seen some
drivers that definitely do this, by deferring all updates until
the vb interrupt. But maybe many other drivers don't bother.

Another way might be to do a GETVAR ioctl, modify "yoffset",
set the FB_ACTIVATE_VBL bit of "activate", and do a SETVAR
ioctl. I am sure this is the intended usage of the ACTIVATE_VBL
bit, even though it may not be well supported by existing drivers.

I notice in fbmem.c (2.4.20 version), there is no fall-back
code for the PAN_DISPLAY ioctl when the device method is absent.
Perhaps the getvar/modify/setvar above should be coded here.

Clive


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id\x16865&op=click

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

* Re: Frame swapping
  2005-12-09  9:37 Jenkins, Clive
@ 2005-12-09 12:27 ` Antonino A. Daplas
  0 siblings, 0 replies; 4+ messages in thread
From: Antonino A. Daplas @ 2005-12-09 12:27 UTC (permalink / raw)
  To: Jenkins, Clive; +Cc: linux-fbdev-devel

Jenkins, Clive wrote:
>> From: Antonino A. Daplas [mailto:adaplas@gmail.com] 
>> Sent: 08 December 2005 21:18
>> To: linux-fbdev-devel@lists.sourceforge.net
>> Cc: Jenkins, Clive
>> Subject: Re: [Linux-fbdev-devel] Frame swapping
>>
>> Jenkins, Clive wrote:
>>> How is frame swapping done, using the mechanisms provided
>>> by FB (in 2.4 and 2.6)?
>>> Can anyone point me to any good code examples in the
>>> existing FB device drivers?
>>>
>>> ["Frame swapping" or "video page flipping" is switching
>>> to an alternate framebuffer memory area during the
>>> vertical blank period. This is a common technique to
>>> achieve animation or a single clean change of picture.]
>> Use the pan display ioctl, FBIOPAN_DISPLAY.  Basically, set
>> var->yres_virtual to be at least 2x var->yres so you can have
>> 2 video buffers, one visible, one offscreen.  Then just do a
>> ypan ioctl to set which buffer becomes visible and which
>> becomes offscreen.
>>
>> Doing it during vblank is a little difficult.  You can poll
>> the VGA registers (which is slow), or set up an interrupt
>> handler for the driver you are using that waits for vblank.
>>
>> See www.directfb.org for code on how this can be done.  Also,
>> the directfb source have patches to some drivers that implements
>> the wating for vblank, such as in matroxfb.
>>
>> Tony
> 
> Thanks Tony. I was thinking I would have to implement my own
> ioctl to do this, but I agree it can be regarded as a special
> case of panning (even though my hardware doesn't fully support
> panning).
> 
> I would expect panning to be smooth and glitch-free whenever
> possible within the limitations of the hardware, so the
> switch-over should always occur during vblank. I have seen some
> drivers that definitely do this, by deferring all updates until
> the vb interrupt. But maybe many other drivers don't bother.

Yes, Because waiting for vblank will slow down console scrolling.

> 
> Another way might be to do a GETVAR ioctl, modify "yoffset",
> set the FB_ACTIVATE_VBL bit of "activate", and do a SETVAR
> ioctl. I am sure this is the intended usage of the ACTIVATE_VBL
> bit, even though it may not be well supported by existing drivers.
> 

No, this will be terribly slow.  And most drivers ignore 
ACTIVATE_VBL flag and also resets the yoffset to zero on a
SETVAR ioctl.

> I notice in fbmem.c (2.4.20 version), there is no fall-back
> code for the PAN_DISPLAY ioctl when the device method is absent.
> Perhaps the getvar/modify/setvar above should be coded here.

Possibly.  But don't do this for the reasons mentioned above.
It would be simpler to implement a pan_display hook.

Tony


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

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

end of thread, other threads:[~2005-12-09 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08 15:24 Frame swapping Jenkins, Clive
2005-12-08 21:18 ` Antonino A. Daplas
  -- strict thread matches above, loose matches on Subject: below --
2005-12-09  9:37 Jenkins, Clive
2005-12-09 12:27 ` Antonino A. Daplas

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