Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Porting SystemDraw to Frambuffer
Re: Porting SystemDraw to Frambuffer [message #27229 is a reply to message #27228] Tue, 06 July 2010 10:13 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
Quote:


compile as "NOGTK" and get default, non-OS dependent, look&feel.


thats great..., i already have specified NOGTK flag when selecting FB, so its goot to know that was right

Quote:


there should be something like "FB" flag


i already have previsted something like that, flags: GUI X11 for current linux stuff, GUI FB for framebuffer stuff, with fallback option, if nothing else specified, GUI defaults to GUI X11, so no package breaks

Quote:


the whole framebuffer "backend" should be virtualized, so that you can easily bind U++ to any sort of device (framebuffer, SDL...).


dont quite get you here. frame buffer cant be "virtualized", its a backaned like the others as well, with its own SystemDraw, input parsing queue, timer procedure etc.. could you explain?

btw: SDL should be a port of its own. ofcorse, then, you can run upp on framebuffer as well, because SDL runs on framebuffer as well, but upp wont know about framebuffer..
Re: Porting SystemDraw to Frambuffer [message #27253 is a reply to message #27229] Thu, 08 July 2010 10:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Tue, 06 July 2010 04:13

Quote:


compile as "NOGTK" and get default, non-OS dependent, look&feel.


thats great..., i already have specified NOGTK flag when selecting FB, so its goot to know that was right

Quote:


there should be something like "FB" flag


i already have previsted something like that, flags: GUI X11 for current linux stuff, GUI FB for framebuffer stuff, with fallback option, if nothing else specified, GUI defaults to GUI X11, so no package breaks

Quote:


the whole framebuffer "backend" should be virtualized, so that you can easily bind U++ to any sort of device (framebuffer, SDL...).


dont quite get you here. frame buffer cant be "virtualized", its a backaned like the others as well, with its own SystemDraw, input parsing queue, timer procedure etc.. could you explain?



All these 'details' can be expressed by a bunch of virtual methods (very simplified said).

Later you take these and bind U++ to SDL or framebuffer or whatever else.
Re: Porting SystemDraw to Frambuffer [message #27254 is a reply to message #27253] Thu, 08 July 2010 10:38 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
but they are already present arent they?

otherwise there will be a compile flags dependant source port like current situaion, for X11 and WIN32
Re: Porting SystemDraw to Frambuffer [message #27255 is a reply to message #27254] Thu, 08 July 2010 11:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Thu, 08 July 2010 04:38

but they are already present arent they?



No.

I am speaking about generic interface to accomodate input event queues and output buffer. This is not to be confused with Ctrl interfaces....

Re: Porting SystemDraw to Frambuffer [message #27256 is a reply to message #27255] Thu, 08 July 2010 11:36 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i'll try to..

Quote:


whole framebuffer "backend" should be virtualized, so that you can easily bind U++ to any sort of device (framebuffer, SDL...).


well, SDL is in fact not quite the same as simply framebuffer and /dev/input, its more sort of X11, you allocate a SDL_Surface, and need to process input events..

as far as got through that whole thing, SystemDraw is the implementation is draw backend and DoMouse & DispatchKey are already backends... to these i tried to connect.

so far i tried to sum up the whole WIN32 thing by runtime tracing in debugger: correct if i am wrong somewhere..

//////////////////////////////////////////////////////////// ////
SYSTEM BACKEND WIN32

win32 api current state and important stations, analyzing and tracking the GUI_APP_MAIN macro.

Ctrl::InitWin32(HINSTANCE hInstance)
init/ register der window classes and a seperate timer class, instantiating of timer class with lpfnWndProc = &Ctrl::UtilityProc; the window classes with lpfnWndProc = (WNDPROC)Ctrl::WndProc;, they are the message processors. calls to create windows are done with win function CreateWindow later.

void AppInitEnvironment__()
language and environment specific inits like charsets

GuiMainFn()
applications specific stuff, global intis, here, Run() of a TopWindow class should be called

TopWindow::Run()
basicly forwards to create the window class instances in Open() call, Show()s it and sets up the EventLoop() to run, which only exits when app quits. prepares the ctrl exit.

void TopWindow::Open()
creates the window instance using the Create() subsystem for the main window instance

void Ctrl::Create0(Ctrl::CreateBox *cr)
actually creates and shows the window instance with win32 OS means, sets up the drag and drop stuff and calls a first RefreshDeepLayout(), which triggers a WM_PAINT, which is processed in Ctrl::WndProc

LRESULT CALLBACK Ctrl::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
takes care of processing WM_CREATE und WM_DESTROY, otherwise forwards to the hwnd specific Ctrl (mapping exists), which is a TopWindow ctrl.. forwards to the WindowProc of the Ctrl, which is virtual

LRESULT TopWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
takes care of some minimal TopWindow specific stuff like close behaviour, then, forwards to Ctrl::WindowProc

LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
processes the win32 message queue messages, here comes in WM_PAINT, which uses a SystemDraw to paint the main / top Ctrl's area to the win32 GDC surface of the hWnd, here also comes in WM_'mousestuff' which forwards to DoMouse, which takes care of translating and delivering the messages to the ctrls. further, WM_'keystuff' comes in, which forwards to DispatchKey..

void Ctrl::EventLoop0(Ctrl *ctrl)
is called in Run() (via EventLoop) and returns when application is about to finish, basicly calls in a loop ProcessEvents() which calls ProcessEvent() which calls sProcessMSG()

void Ctrl::sProcessMSG(MSG& msg)
runs the win32 API typical TranslateMessage / DispatchMessage duo, which ends up calling WndProc and dispatching / evaluating messages

LRESULT CALLBACK Ctrl::UtilityProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
processes the WM_TIMER message. the timer is used to wake up the ProcessEvents stuff (TranslateMessage / DispatchMessage) which will also process what?? why does it need to wakeup? process the postcallbacks? becuse, user input and repaint stuff comes directly as WM_* messages, which wake up the queue as well

sorry for the long post, just need to clarify i dont miss things.


Re: Porting SystemDraw to Frambuffer [message #27258 is a reply to message #27256] Thu, 08 July 2010 15:07 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
so my base idea would be:

InitFB() / ExitFB()
open and close the framebuffer and input files, init the framebuffer blitting (in case of weired formats) and all other stuff Smile.

Open() / Create()
ensures that only one TopWindow exists, sets fullscreen flag, makes first RefreshDeepLayout()

ProcessEvents()
reads userinput and translate it to DoMouse() / DispatchKey() repaint the TopWindow area using SystemDraw from FB

about the timer thing i need some ideas Smile



Re: Porting SystemDraw to Frambuffer [message #27259 is a reply to message #27258] Thu, 08 July 2010 15:41 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

kohait00 wrote on Thu, 08 July 2010 15:07


about the timer thing i need some ideas Smile


Hi Kohait,

What about bazaar/Timer? It is pretty universal and independent package, someone isolated it from CtrlCore for use in console apps (it depends only on core). Only problem might be that it requires MT (Is it really problem?).

kohait00 wrote on Thu, 08 July 2010 15:07


Open() / Create()
ensures that only one TopWindow exists, sets fullscreen flag, makes first RefreshDeepLayout()

It might be easier (and even better) to not control how many TopWindows is opened. Just paint the topmost (the latest opened).

I really like the idea of U++ on framebuffer. Expect my help as far as my knowledge goes Wink

Bye, Honza

EDIT: Oh, now I see that bazaar/Timer is your work, so you probably already considered it Smile So, what about using POSIX timers (timer_create, timer_settime etc.)? I'll have a closer look at it as soon as I get back to my linux computer (which is unfortunatelly not until next week Sad )

[Updated on: Thu, 08 July 2010 17:16]

Report message to a moderator

Re: Porting SystemDraw to Frambuffer [message #27260 is a reply to message #27259] Thu, 08 July 2010 17:25 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hey dolik, thanks for help

i really considered using Timer, but it uses an extra thread.. well, what about apps compiled with GUI but *without* MT, they wont work..

i basicly thought of using the timer *queue*, executing it myself (means in the MainThread i call TimerProc in a loop)..thus i could PostCallback to it.

but: the TimerProc uses a fixed sleep intervall, 10 ms, when nothing is to be done..now when it sleeps, it sleeps hard. no way to wake it up before that time. this will affect responsiveness.

maybe i will neet to reimplement TimerProc, which will not sleep, but wait for some kind of wakeup signals, maybe select() stuff..

still in modeling phase Smile
Re: Porting SystemDraw to Frambuffer [message #27261 is a reply to message #27256] Thu, 08 July 2010 17:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Thu, 08 July 2010 05:36

i'll try to..

Quote:


whole framebuffer "backend" should be virtualized, so that you can easily bind U++ to any sort of device (framebuffer, SDL...).


well, SDL is in fact not quite the same as simply framebuffer and /dev/input, its more sort of X11, you allocate a SDL_Surface, and need to process input events..



Which is exactly why I would attempt to make the whole framebuffer variant generic... Smile

Quote:


LRESULT CALLBACK Ctrl::UtilityProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
processes the WM_TIMER message. the timer is used to wake up the ProcessEvents stuff (TranslateMessage / DispatchMessage) which will also process what?? why does it need to wakeup? process the postcallbacks? becuse, user input and repaint stuff comes directly as WM_* messages, which wake up the queue as well

sorry for the long post, just need to clarify i dont miss things.



Utility proc is Win32 implementation hack - we are using one special window (utilityHWND) to handle some Win32 messages that could not be handled otherwise. UtilityProc is its windows proc.

The rest you get right, however, it has little to do with planned framebuffer target.

Mirek
Re: Porting SystemDraw to Frambuffer [message #27262 is a reply to message #27261] Thu, 08 July 2010 18:46 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
thanks mirek

Quote:


it has little to do with planned framebuffer target.


ofcorse, but i need to know which stuff will be nessesary and which one is optional, and just wanted to be sure i got the underlaying layer to understand right (to spot and fit the interface).

step by step we go...

just a question aside: is there *anything* concerning format conversion or bitblitting in Painter ? (i asked it already maybe).
or is the one and only supported method: RGBA throughout Upp..
Re: Porting SystemDraw to Frambuffer [message #27263 is a reply to message #22966] Fri, 09 July 2010 08:37 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
All the major stuff is RGBA unified (unless Mirek says I'm wrong Smile ).

So in case of 16b 5:6:5 FB you have to convert the final RGBA raster during blit to FB. (which may be quite suboptimal on some weak devices, but recently mobile phones have 1GHz processors, so it's probably pointless to worry now ... anyway, forcing Painter&co to work also in some non-RGBA format would be probably as difficult as writing a new variant from scratch, so unless specific device proves to be worth of it, aim for RGBA internally)
Re: Porting SystemDraw to Frambuffer [message #27264 is a reply to message #27263] Fri, 09 July 2010 09:58 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i'm fine with RGBA, if painter is optimized for it, best case anyway, as far as i know, SDL does the same, everything RGBA until it is blited to destination, which may use a weired alignment / format.

the best thing would be to extend the Painter with some converterfunctions, to create i.e a ImageBuffer or sth. with the different format.. which i can write directly to framebuffer.

but first shot is ASSERT(RGBA) anyway.
Re: Porting SystemDraw to Frambuffer [message #27265 is a reply to message #22966] Fri, 09 July 2010 12:50 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Quote:

the best thing would be to extend the Painter with some converterfunctions, to create i.e a ImageBuffer or sth. with the different format.. which i can write directly to framebuffer.


You draw into Raster (or ImageBuffer?) with Painter, then with final Raster you can use RasterEncoder and RasterFormat classes to produce final format for output.

It will very likely in most cases require to write the final classes for desired format, but almost everything is ready, you just need to glue it together and init it correctly. See how RasterEncoder base is used trough upp (in various image formats plugins), or you may use RasterFormat only to convert RGBA line by line during blit, it's very simple for 15/16b modes. For palette modes you will have to do some more setup around conversion palette unless you want it dynamically created by upp.
Re: Porting SystemDraw to Frambuffer [message #27266 is a reply to message #27265] Fri, 09 July 2010 13:02 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
thats a nice info, really Smile
thanks, i'll take alook on it.
Re: Porting SystemDraw to Frambuffer [message #27269 is a reply to message #27265] Fri, 09 July 2010 14:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mr_ped wrote on Fri, 09 July 2010 06:50

Quote:

the best thing would be to extend the Painter with some converterfunctions, to create i.e a ImageBuffer or sth. with the different format.. which i can write directly to framebuffer.


You draw into Raster (or ImageBuffer?) with Painter, then with final Raster you can use RasterEncoder and RasterFormat classes to produce final format for output.



Well, I believe that "FB flag" configuration should end right at RGBA and eventual conversion should be performed by framebuffer host virtualization. It is one of tasks I would dedicate for that...

Mirek
Re: Porting SystemDraw to Frambuffer [message #27270 is a reply to message #27269] Fri, 09 July 2010 14:42 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
Quote:


eventual conversion should be performed by framebuffer host virtualization


ofcorse, but it would be great to have some 'generic' bit bliting / stride copying functions in Painter / ImageBuffer, imagine all the weired graphics formats that could be exported with it. or is plugin/* the place for that?

[Updated on: Fri, 09 July 2010 14:42]

Report message to a moderator

Re: Porting SystemDraw to Frambuffer [message #27271 is a reply to message #27270] Fri, 09 July 2010 16:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Fri, 09 July 2010 08:42

Quote:


eventual conversion should be performed by framebuffer host virtualization


ofcorse, but it would be great to have some 'generic' bit bliting / stride copying functions in Painter / ImageBuffer, imagine all the weired graphics formats that could be exported with it. or is plugin/* the place for that?


We already have it. See RasterFormat.

Mirek

[Updated on: Fri, 09 July 2010 16:59]

Report message to a moderator

Re: Porting SystemDraw to Frambuffer [message #27276 is a reply to message #27271] Sat, 10 July 2010 19:13 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Very interesting!

In this month I intend to buy a HTC Desire. Android seems to have frame-buffer and can be tested with Android NDK.

Ion Lupascu (tojocky)
Re: Porting SystemDraw to Frambuffer [message #27654 is a reply to message #27270] Tue, 27 July 2010 23:09 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

OK,

I'm ready to test to HTC Desire u++.
In the next fiew days I will install Android NDK and test to compile some real project like Navit
Re: Porting SystemDraw to Frambuffer [message #27656 is a reply to message #27654] Wed, 28 July 2010 05:37 Go to previous messageGo to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
tojocky wrote on Tue, 27 July 2010 17:09

OK,

I'm ready to test to HTC Desire u++.
In the next fiew days I will install Android NDK and test to compile some real project like Navit


IMHO the Android Emulator should also be handy.


Regards,
Novo
Previous Topic: Building 32 bit apps on Ubuntu64
Next Topic: Can anyone plan to bring ultimate++ Widget toolkit to GTK-compatible, GTK# and qt-compatible?
Goto Forum:
  


Current Time: Fri Apr 26 13:10:48 CEST 2024

Total time taken to generate the page: 0.05512 seconds