linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Burton Samograd <kruhft@kruhft.dyndns.org>
To: linux-kernel@vger.kernel.org
Subject: Re: Some questions about Linux Framebuffer programming
Date: Wed, 25 Sep 2002 07:49:20 -0700	[thread overview]
Message-ID: <20020925144920.GA4398@kruhft.dyndns.org> (raw)
In-Reply-To: <20020925141906.78323.qmail@web12302.mail.yahoo.com>

[-- 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 --]

      reply	other threads:[~2002-09-25 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-25 14:19 Some questions about Linux Framebuffer programming Eric Miao
2002-09-25 14:49 ` Burton Samograd [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020925144920.GA4398@kruhft.dyndns.org \
    --to=kruhft@kruhft.dyndns.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).