[haiku-development] Re: A tale of two accelerant API's

  • From: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 10 Feb 2013 22:37:50 -0600

On 02/01/2013 3:57 am, Axel Dörfler wrote:
On February 1, 2013 at 3:28 AM Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
wrote:
I've branched a github repo to start toying with *real* mult-head stuff
on the app server.

That would be really great to have.

Here are my initial plans:
   * We should try to support "old" accelerants as well as new ones

Definitely.

My current plan goes as follows:
[...]
Anyway, this stuff could turn into a mess reaaaal quick.
(which is why i'm working on a github fork atm)

Thoughts? Does this look like a viable move? (or is it overkill?)

Not overkill, but also not the direction I would have gone to :-)

I think it definitely makes sense to create a new accelerant API that not only provides multi-head support, but also functions that do not work on the frame
buffer, but on any offscreen buffer, too. Plus compositing, plus ...
For this, I would introduce a new B_GET_ACCELERANT ioctl where you can specify the version you want, and you also get a structure, not just a name which would
also allow for future extensions of both the reply and the request.

I may just always default to the easy way out, but I had another idea :)


What about using the version field of the accelerant_device_info struct?
http://cgit.haiku-os.org/haiku/tree/headers/os/add-ons/graphics/Accelerant.h#n85


I'm not really sure of the intended use... but it is a pretty easy choice.
All of the drivers set it to B_ACCELERANT_VERSION (aka 1)
http://pastebin.com/8LEeRK49
http://cgit.haiku-os.org/haiku/tree/headers/os/add-ons/graphics/Accelerant.h#n19

Logic:
 1) Wire up the INIT_ACCELERANT
http://cgit.haiku-os.org/haiku/tree/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp#n303
 2) Call B_GET_ACCELERANT_DEVICE_INFO
 3) Check the version field returned
 4) Wire up the rest of the hooks based on API version.
    Here we can break off into whatever logic, classes, etc. we want.

Not sure if there was some planned use to that version field though.

A simple diff showing how easy this is:
  http://pastebin.com/w6Dc7e2m


 -- Alex

Other related posts: