[Qt-embedded-interest] Graphics Driver

Bryce Salmi Bryce.Salmi at zoran.com
Fri Jul 10 16:36:58 CEST 2009


Qt list,

     I seem to have a reoccuring problem when compiling the QImage (it happened before when I was playing around with the driver).  I am not sure but it seems to have something to do with the "new" function which if my research is correct is much like malloc in C.  I am still fairly new to C++ (but came from a decent background in C) so it may be an easy fix.  When compiling I get the following error:

vopuScreenDriver.cpp: In member function 'bool vopuScreenDriver::connect()':
vopuScreenDriver.cpp:37: error: invalid conversion from 'QImage*' to 'int'

And line 37 is:

vopuimage = new QImage(w, h, QImage::Format_RGB888);


Any ideas?


Thanks,
Bryce

-----Original Message-----
From: qt-embedded-interest-bounces at trolltech.com on behalf of Bryce Salmi
Sent: Fri 7/10/2009 5:57 AM
To: qt-embedded-interest at trolltech.com
Subject: Re: [Qt-embedded-interest] Graphics Driver
 
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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-embedded-interest/attachments/20090710/e9fdad60/attachment.html 


More information about the Qt-embedded-interest mailing list