[Qt-embedded-interest] Graphics Driver

Bryce Salmi Bryce.Salmi at zoran.com
Fri Jul 10 14:57:30 CEST 2009


Tom,
     Thank you for the reply.  That does make more sense; it actually
looks a lot more like a simple C frame buffer implementation I wrote a
while ago for the same board (more of a test like the frame buffer test
that comes with Qt).  I must have missed the facts that open and write
could be used in C++.  I did a search for reading and writing to files
(/dev/fb0) in C++ and I did not seem to find any suggestions relating to
using those functions.  I will try to get something working today and
see what happens.



Thanks,
Bryce

-----Original Message-----
From: qt-embedded-interest-bounces at trolltech.com
[mailto:qt-embedded-interest-bounces at trolltech.com] On Behalf Of Tom
Cooksey
Sent: Friday, July 10, 2009 2:35 AM
To: qt-embedded-interest at trolltech.com
Subject: Re: [Qt-embedded-interest] Graphics Driver

> Qt list,
>      Ok, so after a lot of experimenting I have come to a point
> where I need some more guidance, maybe not answers but at least
> some pointers to get going again.  Using the suggestions from Tom
> Cooksay I tried to write my own driver (which was emailed out
> several days ago yet had no replies) so then I tried to modify the
> dbscreen driver supplied with Qt.  I managed to figure out that it
> relies on the QScreen::connect call given by every application
> rather than re-implementing it.  After some investigation into
> QScreenLinuxFb, I am pretty sure that the mapping is occurring in
> the connect function.  So I have a few questions:
>
>
>  *   Does the mapping occur in QScreen::connect?
>  *   How do I set the screen address pointer?
>     *   Does this use QImage::data?
>  *   How do I implement uchar * QImage::bits();?
>
> I would really enjoy ANY help or suggestions or anything.  Just
> getting to a point where I know there is at least some base plug-in
> that can be recognized by the Qt application (I use analogclock as
> a test application).  Even if you don't know if your suggestion
> will help it may steer me in the correct direction so I look
> forward to hearing from anyone who has anything to add!

In ::connect(), you need to set the pointer to your "fake" 
framebuffer. The pointer is a protected member of QScreen, I think 
called "data", but can't remember exactly.

E.g.


MyScreen::MyScreen(int d)
    : QScreen(d)
{
}

bool MyScreen::connect()
{
    m_screenFd = open("/dev/fb0"...);

    w = 640;
    h = 480;
    d = 16;

    m_image = new QImage(w, h, QImage::Format_RGB16);
    data = m_image->bits();
}

void MyScreen::blit(const QImage &img,
				  const QPoint &topLeft,
   				  const QRegion &region)
{
    QScreen::blit(img, topLeft, region);
    write(m_screenFd, m_image.bits(), m_image.size());
}

void MyScreen::solidFill(const QColor &color, const QRegion &region)
{
    QScreen::solidFill(color, region);
    write(m_screenFd, m_image.bits(), m_image.size());
}




_______________________________________________
Qt-embedded-interest mailing list
Qt-embedded-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-embedded-interest




More information about the Qt-embedded-interest mailing list