Hi Phil,
As I said, all these questions will be answered when we do have the
framework to do this. I can try to answer some:
> - With respect to integrating OpenGL ES -
> - What forms of OpenGL ES surfaces does Android use? (Window? PBuffer?
> NativePixmap?).
Window only for now. Of course, a 3rd party GL application is free to
use whatever it wants.
> - Does Android expect to allow accelerated rendering to a UI component AND
> to be able to draw to it directly?
SurfaceFlinger expects to be able to do this. If this feature is not
available, it will revert to making copies. There are no clear gl
extensions to do this, so we expect "some" integration to have to
happen for each GL implementation.
> - Which Android UI components translate into being EGL Surfaces of one
> shape or another?
All windows in the system.
> - Do you have a list of where the integration 'hacks' need to be made in
> the Android code to ease integration issues? (This would be *really* useful
Yes I do. However, these integrations points will change and/or go away.
> - a driver writer knows and understand ths EGL/Integration issues, but will
> be much less aware of any 'engineering modifications' that need applying to
> different parts of the Android code).
There are mainly 2 issues: one, the EGL implementation needs to know
about the platform's native types (NativeWindowType, this is defined
in egl_natives.h), and then there is the question of GPU management
(when to power it down, when to reset it (if an app goes berserk)) and
finally there is the question of passing surfaces across processes.
These are the "hard" problems that, currently, are not resolved in a
generic way.
> - Is the source to libhgl around - or is this a third-party entity?
Never. libhgl *is* the h/w accelerated gl. This is the library that
Android doesn't want to know about, shouldn't care about -- it just
needs to follow a certain protocol (namely EGL 1.0 at the bare
minium). By definition this cannot be part of Android, it is a "board"
dependent component (a user-space driver if you will).
> - Does pixelflinger always use OpenGL for surface composition?
pixelflinger never use h/w acceleration -- it is just a software
renderer used *when* there is no h/w acceleration. SurfaceFlinger, on
the other hand, android's composition engine uses OpenGL ES.
> - I imagine that hooking up to a 'generic' OpenGL ES driver (requiring no
> integration) would result in ugly uploads/downloads being performed (unless
> all of the surfaces used for rendering were derived from EGL surfaces).
No. It would just not work at all. What would a "generic" driver
(whatever that means) do when eglCreateWindowSurface() is called on
it?
Now if you *reallllllllly* want to use your h/w driver now, there is a
(non efficient, but probably good enough) way to do it. You could do
all the rendering in hardware in "private" buffers, and when
eglSwapBuffers() is called, you could make a copy (with memcpy).
Have a look at libagl.so (it's part of core Android, and therefore is
opensource), it is our *software* OpenGL ES implementation. In
particular, look at egl.cpp, which is its EGL implementation. Yours
should look like something like it. If your GPU is able to render
into "regular" memory you're all set -- it will "just work". If it
doesn't (like most GPU), you'll need to make a copy.
Note that what I describe here is a STOP GAP, until we get the HAL put
together. You won't get good performance with this. Also, be *assured*
that your driver will break when we roll out the new GPU framework and
that no effort will be made to maintain source or binary compatibility
-- you've been warned :-)
I would strongly encourage you to try to make your h/w work with the
"trick" above where you make a copy of the framebuffer upon
eglSwapBuffers(), this will require you to do at least half of the
work needed for the "real thing".
Mathias