linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Some questions about Linux Framebuffer programming
@ 2002-09-25 14:19 Eric Miao
  2002-09-25 14:49 ` Burton Samograd
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Miao @ 2002-09-25 14:19 UTC (permalink / raw)
  To: linux-kernel

Hi, everybody,

I need your help!

1. How can I switch to another virtual terminal by
normal user process?
VT_ACTIVATE ioctl can only be called by processes
having root rights.

2. When I switch away from and again back to the
virtual terminal where I do frame buffer drawing,
screen content is destroyed and replaced by original
console text?
How can I avoid this problem?

3. What is FBIOPUT_CON2FBMAP? What does it do?

4. How can I do flipping between primary frame and
secondary frame?





__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

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

* Re: Some questions about Linux Framebuffer programming
  2002-09-25 14:19 Some questions about Linux Framebuffer programming Eric Miao
@ 2002-09-25 14:49 ` Burton Samograd
  0 siblings, 0 replies; 2+ messages in thread
From: Burton Samograd @ 2002-09-25 14:49 UTC (permalink / raw)
  To: linux-kernel

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

On Wed, Sep 25, 2002 at 07:19:06AM -0700, Eric Miao wrote:
> 
> 1. How can I switch to another virtual terminal by
> normal user process?
> VT_ACTIVATE ioctl can only be called by processes
> having root rights.
>

This is a snippet of a little program I wrote called vtswitch that
shows how to use the VT_ACTIVATE ioctl.  This works as a normal user,
so you might be using it wrong.  I can send the whole program if you
want to see how the whole thing works but this is the guts:

<--- begin code block ---->

int vtfd;

#define VT_DEVICE_FILE "/dev/tty"
vtfd = open(VT_DEVICE_FILE, O_RDWR, 0);
  if(vtfd < 0)
    {
      printf("*error* Could not open /dev/tty\n");
    }

  /* Save the current vt index to the history file */
  save_cur_vt_index(vtfd);

  /* Switch to the terminal if there wasn't an error looking up the
  alias */
  if(ioctl(vtfd, VT_ACTIVATE, terminal))
    {
      printf("*error* Error switching to terminal %s (%d)\n", vt,
  terminal);
      return -1;
    }

<-- end code block -->


> 2. When I switch away from and again back to the
> virtual terminal where I do frame buffer drawing,
> screen content is destroyed and replaced by original
> console text?
> How can I avoid this problem?

You can save the framebuffer contents to a program array and then poll
the current vt every once and a while (using VT_GETSTATE and
vt_stat.vt_active), check to see if your program is on the visible vt
and then copy it back to restore it.  This could also keep your
program from drawing to the framebuffer when it's not visible.

> 
> 3. What is FBIOPUT_CON2FBMAP? What does it do?

Not sure.

> 
> 4. How can I do flipping between primary frame and
> secondary frame?

Create an offscreen surface using malloc and do your rendering to that
and then do a memcpy (simple way) or hardware accellerated blt (faster
but harder to setup).

burton

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2002-09-25 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-25 14:19 Some questions about Linux Framebuffer programming Eric Miao
2002-09-25 14:49 ` Burton Samograd

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