Qt API | Qtopia API | Qtopia Documentation |

# QLinuxFbScreen Class Reference

QLinuxFbScreen manages the Linux framebuffer. Accelerated drivers for Linux should inherit from it; it contains code for reading information about the framebuffer from the Linux framebuffer interface, managing the color palette, managing offscreen graphics memory and mapping the framebuffer interface itself, removing the need for drivers to do this. It also acts as a factory for the unaccelerated screen cursor and unaccelerated QGfxes. QLinuxFbScreen is a descendant of QScreen; there is precisely one per Qt/Embedded application. More...

`#include <qgfxlinuxfb_qws.h>`

Inherits QScreen.

List of all member functions.

## Public Members

- QLinuxFbScreen ( int display_id )
- virtual ~QLinuxFbScreen ()
- virtual bool initDevice ()
- virtual bool connect ( const QString & displaySpec )
- virtual bool useOffscreen ()
- virtual void disconnect ()
- virtual void shutdownDevice ()
- virtual void setMode ( int nw, int nh, int nd )
- virtual void save ()
- virtual void restore ()
- virtual void blank ( bool on )
- virtual void set ( unsigned int i, unsigned int r, unsigned int g, unsigned int b )
- virtual uchar * cache ( int amount, int optim )
- virtual void uncache ( uchar * c )

## Protected Members

- void deleteEntry ( uchar * c )

## Static Protected Members

- void clearCache ( QScreen * instance, int )

## Detailed Description

QLinuxFbScreen manages the Linux framebuffer. Accelerated drivers for Linux should inherit from it; it contains code for reading information about the framebuffer from the Linux framebuffer interface, managing the color palette, managing offscreen graphics memory and mapping the framebuffer interface itself, removing the need for drivers to do this. It also acts as a factory for the unaccelerated screen cursor and unaccelerated QGfxes. QLinuxFbScreen is a descendant of QScreen; there is precisely one per Qt/Embedded application.

## Member Function Documentation

### QLinuxFbScreen::~QLinuxFbScreen ()`[virtual]`

Destroys a QLinuxFbScreen.

### uchar * QLinuxFbScreen::cache ( int amount, int optim )`[virtual]`

Requests a block of offscreen graphics card memory from the memory manager; it will be aligned at pixmapOffsetAlignment(). If no memory is free 0 will be returned, otherwise a pointer to the data within the framebuffer. QScreen::onCard can be used to retrieve a byte offset from the start of graphics card memory from this pointer. The display is locked while memory is allocated and unallocated in order to preserve the memory pool's integrity, so cache and uncache should not be called if the screen is locked.

\amount is the amount of memory to allocate, optim gives the optimization level (same values as QPixmap::Optimization).

### bool QLinuxFbScreen::connect ( const QString & displaySpec )`[virtual]`

This is called by Qt/Embedded clients to map in the framebuffer. It should be reimplemented by accelerated drivers to map in graphics card registers; those drivers should then call this method in order to set up offscreen memory management.

### void QLinuxFbScreen::deleteEntry ( uchar * c )`[protected]`

Delete a block of memory allocated from graphics card memory.

### void QLinuxFbScreen::disconnect ()`[virtual]`

This simply unmaps the framebuffer

### bool QLinuxFbScreen::initDevice ()`[virtual]`

This is called by the Qt/Embedded server at startup time. It turns off console blinking, sets up the color palette, enables write combining on the framebuffer and initialises the offscreen memory manager.

### void QLinuxFbScreen::restore ()`[virtual]`

This is called when the virtual console is switched back to Qt/Embedded and restores the palette.

Reimplemented from QScreen.

### void QLinuxFbScreen::save ()`[virtual]`

This doesn't do anything; accelerated drivers may wish to reimplement it to save graphics cards registers. It's called by the Qt/Embedded server when the virtual console is switched.

Reimplemented from QScreen.

### void QLinuxFbScreen::set ( unsigned int i, unsigned int r, unsigned int g, unsigned int b )`[virtual]`

In paletted graphics modes, this sets color index i to the specified RGB value.

Reimplemented from QScreen.

### void QLinuxFbScreen::setMode ( int nw, int nh, int nd )`[virtual]`

Sets the framebuffer to a new resolution and bit depth. After doing this any currently-existing gfx's will be invalid and the screen should be completely redrawn. In a multiple-process Embedded Qt situation you will need to signal all other applications to also setMode() to the same mode and redraw.

### void QLinuxFbScreen::shutdownDevice ()`[virtual]`

This is called by the Qt/Embedded server when it shuts down, and should be inherited if you need to do any card-specific shutting down. The default version hides the screen cursor and reenables the blinking cursor and screen blanking.

Reimplemented from QScreen.

### void QLinuxFbScreen::uncache ( uchar * c )`[virtual]`

Delete a block of memory allocated from graphics card memory.

This function will first sync the graphics card to ensure the memory isn't still being used by a command in the graphics card fifo queue.

You can speed up a driver by overriding uncache to avoid syncing, however it will then be up to the driver to ensure the memory at c is no longer being used. For example the driver might delay deleting the memory until it detects that all commands dealing with the memory are no longer in the queue.

See also deleteEntry() and sync().

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.