Page 10 of 18

Re: GDISP driver

Posted: Sat Aug 04, 2012 6:44 pm
by inmarket
Yes the original intention was to put an abstraction in halext for low level drivers to be called from glcd. Once I got into coding however there were just too many changes required to glcd. So rather than annoying everyone and making wholesale incompatible changes to glcd, I instead put what is now a very thin high level layer into what is now called GDISP. The high level became thin particularly when I allowed for drivers to hardware accelerate functions and use an emulation layer for anything they didn't support.
In practice now the high level GDISP (in src/gdisp.c) contains some multi-threading stubs and a couple of routines to implement functions (like gdispDrawString) that are implemented be calling other (possibly hardware accelerated) low level functions (gdispDrawChar in this case).

To aid with this new interface, the halext/include/glcd.h file provide a glcd look-alike using the GDISP infrastructure.

The font code is glcd was particularly broken (on some architectures including mine it would segfault due to assumptions about endianness and word alignment) so it required a complete rewrite although using similar algorthims. The new scaled fonts are therefore part of the new GDISP font support. This support can be used from a glcd application by using the halext/include/glcd.h file to make GDISP look like glcd but with all the extra features that GDISP provides.

In practice I think that as halext components become more mature that the older ones will slowly retire.
Currently gdisp is at the stage where its structure is probably close to final, it has most of the functionality of glcd (still missing multi-thread - although the stubs are there), and some advantages on glcd (such as scaled fonts). It is in effect the child of glcd.
Halext however is still very much in infancy, having only gdisp currently, needing gui and touch to come close to matching what glcd and friends currently offers. Long term halext can offer many advantages (including such things as audio).

Re: GDISP driver

Posted: Sat Aug 04, 2012 10:59 pm
by Tectu
Hello inmarket,

We all thank you very much for your excellent work, you did a good job.
The orginal idea was to use the halext/ only for the HardwareAbstractionLayer, and nothing else. We feel very open and flexible for API changes and any other kind of improvements. But we put a lot of work into the GLCD project and now it looks like everything goes into halext. You mentioned yourself that gdisp is nearly finished and offers the same functionallity as the current glcd project. We are not quite sure why this happens and we also don't see where this is required.
We, as a community, would like to keep everything beside the drivers outside of the halext directory. We hope that we can still receive work beside the HAL from you.


~ Tectu

Re: GDISP driver

Posted: Sun Aug 05, 2012 12:29 am
by inmarket
Just figured out how to add VMT easily to GDISP without losing its current effiency. I'll make the changes slowly as I work on other stuff.

I am always happy to contribute to this excelent project whether it is via glcd or via halext.

In the end the requirement for stuff to go into halext was this idea that a low level driver might only support an init and a set pixel routine. Everything else then is emulated which means that the emulation becomes part of the low level driver and therefore part of halext. As most of glcd's code are now part of the emulation - that leaves very little in glcd (or gdisp high level for that matter).

I will create a new glcd.c that uses the new low level gdisp drivers that can be placed into the glcd directory for a true glcd calling interface rather than the current glcd.h emulation.

Re: GDISP driver

Posted: Sun Aug 05, 2012 12:34 am
by Tectu
Hello inmarket,

Okay, I worried that you would somehow try to put everything into halext and fork it then :D

I would love when you could move the font stuff etc. into the glcd. Please just put HAL stuff into halext. All other highlevel stuff is supposed to stay in the current configuration.
I don't have much time to spend into this library the next week. But after that week I will spend much more time into it.


~ Tectu

Re: GDISP driver

Posted: Sun Aug 05, 2012 12:50 am
by inmarket
Tectu wrote:Okay, I worried that you would somehow try to put everything into halext and fork it then


Whether or not everything goes into halext - that is just an architecture question. I have no interest in forking the project. That is too inefficient and there is still too much to do. I am interested in coding to get the job done for my little project which requires an lcd interface plus other bits of functionality and helping the community along the way who have been so generous with their time and code. Forking would be an absolute waste of time and effort.

Re: GDISP driver

Posted: Sun Aug 05, 2012 12:57 am
by Tectu
I just don't see why everything goes into halext. Why don't you just edit and improve the current glcd stuff?


~ Tectu

Re: GDISP driver

Posted: Sun Aug 05, 2012 6:05 am
by inmarket
Because the internal stucture is so different to meet the required aims of architecture independance, support for hardware acceleration and minimalist low level drivers.

As I was saying previously, I started doing it all in glcd but gave up and isolated it when I saw the level of changes required. The existing strucutre was limiting my thinking on ways to do things if only purely because it was an existing structure. It is often easier to start with a clean slate knowing what has gone before than it is to re-engineer the existing. You saw the level of commits with halext as various files moved location, changed names, changed purpose as I developed the current structure and played with the power of the make system and determined exactly how the interface between the high level and the low level drivers really needed to be.

You have seen in the group the discussions on a common QVGA driver and on VMT drivers. These are now easy to implement in GDISP, something I would have struggled to do in GLCD.

Having now built with a clean slate I am happy to back-port it to glcd. In fact the precense of the glcd.h under halext is testiment to the importance I placed in glcd and the work the community has done on it. There is significant overhead in changing the API an application is using and so a compatible API was required and is provided by the halext glcd.h file.

Whilst GDISP at the moment has similiar functionality to glcd, its new architecture allows it to easily grow its capabilities which I expect to happen quickly now that the structure has settled down.

I will branch my local reposoitory while I prepare the glcd back-port and once you have had a look we can either pull it into the main line or discard it as you see fit.

Re: GDISP driver

Posted: Sun Aug 05, 2012 12:13 pm
by Tectu
I agree with you that the new architecture is much better than the existing one. I fully understand that rewriting stuff from scratch with the knowing from previous experiences is much easier than fixing stuff up.
We would like to keep your work. We welcome the backport and are looking forward to it. Is it okay to keep your work and put it into the old structure (glcd, touchpad, graph, gui, hal) ?

I am still impressed how you handled the restructorizing of the entire library yourself. I couldn't have done that within the same time.


~ Tectu

Re: GDISP driver

Posted: Sun Aug 05, 2012 1:04 pm
by inmarket
You can certainly keep the work and put it back into the old structure (and I will even assist). I think however that would be a backwards step as the halext structure will enable a lot more going forward, is cleaner and is more the way that ChibiOS itself does it.

Back-port for GLCD is ready for you to look at and see if you like it.

Re: GDISP driver

Posted: Sun Aug 05, 2012 4:31 pm
by Badger
Shouldn't the halext code be structured such that each 'project' lives in its own subdirectory within halext? otherwise it would be hard to use several such projects concurrently.

I don't see a problem with the structure evolving, it is natural that after producing something we see a more natural way of doing it. But I think we should be careful to draw a line somewhere that distinguishes between the library that interfaces with the displays and the one that sits on top of it and does the high level stuff. inmarket, I am not sure if your intention is to do this distinction within the GDISP driver, or externally?