How to enable Overlay features in Android

by waterblood » Thu, 19 Mar 2009 05:52:45 GMT

Sponsored Links
 Hi All,

   Below is my understanding about how to enable the Overlay in a new
hardware platform. Correct me if I am wrong.

1.  Implement the stub funtions in hardware\libhardware\modules\overlay
\overlay.cpp, this will generate a share library

2. In SurfaceFlinger, it will create a DisplayHardware instance, and
call DisplayHardware::init() which will create an overlay engine from

3. When we want a OverlayRef from ISurface, we call
ISurface::createOverlay() which will take use of the overlay engine
creat in step 2.

4. Create a Overlay from OverlayRef as it in frameworks\base\libs

    sp<OverlayRef> ref = isurface->createOverlay(320, 240,
    sp<Overlay> overlay = new Overlay(ref);

     * here we can use the overlay API

    overlay_buffer_t buffer;
    printf("buffer = %p\n", buffer);

    void* address = overlay->getBufferAddress(buffer);
    printf("address = %p\n", address);


My questions are:
a. In step 4, as we want paint something in the overlay, should we
just put the image data to the buffer return by  overlay->dequeueBuffer
(), and call queueBuffer() to show the buffer?

b. I dont see any update in android_surface_output to take use of
overlay interface, will it be updated to use overlay interface if
overlay is exit in the hardware? I suggest the surface output may try
to create OverlayRef from surface interface, if it fail, surface
output take the display mechanism as before(post buffer), otherwise it
use this overlay to display video frame.

Guoyin Chen

How to enable Overlay features in Android

by AJAY » Tue, 24 Mar 2009 04:33:45 GMT

 You are correct. The current android_surface_output.cpp doesnt have
any Overlay implementation . However you can check the TI
implementation at omap-zoom site

Here is the link : ;a=tree;f=libopencorehw;h=4b843e240897931c150f1a0cb25b1785c9e8dab2;hb=HEAD



Sponsored Links

How to enable Overlay features in Android

by Jill.Zhou » Wed, 29 Apr 2009 02:15:33 GMT

 Hi, Ajay

But how to set position of overlay with current overlay interface.



Other Threads

1. Lat/long coord to pixel screen XY coord without showing MapView

Hi guys, I need to convert the lat/long coord to pixel xy coord to
show a dot on the top of some image, I know I can use the following
code inside MapView to do that conversion:

mapView.getProjection().toPixels(location.getPoint(), screenCoords);
int x=screenCoords.x;
int y=screenCoords.y;

however, I don't want to show or use the MapView, I just want to
extract the X and Y screen coord, because I have my own background, my
app will use a simple ImageView to display that background and I want
to draw a little dot on canvas, on the top of that background, that
dot will only appear if that location respect some range.

To better understand the question, imagine I have an aerial photo
showing some building, I know the lat/long of that building, and I
want to display a dot representing the building and a second dot if my
actual position is near from that local.

How I can get the XY pixel screen position of that location without
showing the MapView?


2. Signing in Eclipse

Not sure if this is the place to be asking this, I have tried many
places with no answer.

I am recently trying export my app with Eclipse and I am running to
"ERROR: cannot recover key" I know I am using the right password. I
tired restarting eclipse, removing and importing project, cant seem to
get anything to work.



3. One frame buffer per activity or one frame buffer per the whole system

4. Error in building Android 2.2

5. Mediaplayer cuts off early

6. Input text-field hidden behind keyboard in Air 2 app

7. Speed and Bearing data from a GPX file