Problem with Framebuffer

556 views
Skip to first unread message

Niraj

unread,
Dec 14, 2009, 8:22:29 AM12/14/09
to android-ndk
Hi,

I am trying to take screenshot of the android screen.
I written the screen-capture application. It is working fine with
android emulator.

After that I downloaded the complete source of android (x86 platform)
and tried the same application on that;
but it is not showing the proper screen capture.

What must be the issue?

visr

unread,
Dec 18, 2009, 3:57:55 PM12/18/09
to android-ndk
I am having similar problem, screehshot code work fine on Emulator but
does work fine when taken from devices.

I wrote this peace of code for android 1.5 it was working fine on
device and Emulator but when I ported for Android 2.0.1 I started
facing problem.
Please suggest what is wrong and what has changed on the framebuffer
side on 1.5 and 2.0?

Vineet

Adrian Taylor

unread,
Dec 19, 2009, 6:16:14 AM12/19/09
to andro...@googlegroups.com
On 18 Dec 2009, at 20:57, visr wrote:

> I am having similar problem, screehshot code work fine on Emulator but
> does work fine when taken from devices.
>
> I wrote this peace of code for android 1.5 it was working fine on
> device and Emulator but when I ported for Android 2.0.1 I started
> facing problem.
> Please suggest what is wrong and what has changed on the framebuffer
> side on 1.5 and 2.0?
>
> Vineet


I believe that graphics are rendered in the GPU's private memory on Android 2.0 rather than in a frame buffer accessible from the CPU.

The Android 2.0 Surface Flinger appears to have been changed with that in mind: it no longer assumes that it has direct memory access to the screen image, and all graphics operations are done through OpenGL calls.

The Android engineers have said that this transition would occur, in various mailing list posts over the past year or so.

For our attempts at allowing remote control of Android devices[1], we added a 'capture screen' API to the surface flinger. For Android 1.0-1.6, this could simply copy a section of the memory which Surface Flinger pointed at. For Android 2.0, we had to go a bit further and call glReadPixels to grab the screen image each time.

If this is the case, and graphics are being composited in GPU memory not accessible from the CPU, then that means there is no way to take screenshots of Android devices without adding additional APIs to Surface Flinger like we've had to, and using glReadPixels in their implementation. I find it amazing that Google's marketing department allow that situation to exist :-)

Regards

Adrian

[1] http://groups.google.com/group/android-platform/browse_thread/thread/77a2add4384202dc/9e7ee4259ee53d7c

p. yog

unread,
Dec 22, 2009, 10:41:41 AM12/22/09
to andro...@googlegroups.com
Hi Adrian,

I have few doubts on glReadpixels function,

1) Does the pixel information that we get from glreadpixels is the final frame buffer data prepared by surface flinger to send it to frame buffer driver?
2) Do you have any links which make to understand the use of glreadpixel function from app layer?

Thanks in advance,
Yog


 


--

You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.



p. yog

unread,
Dec 23, 2009, 10:58:31 AM12/23/09
to andro...@googlegroups.com
Hi all,

Iam trying to read glReadpixel API to get frame buffers, when printed buffer in API Iam getting  all 0's in my Emulator. Iam a new-bie to android and open-gl. can any one  help me why this is happening? Iam using Android 2.0. Is there any opensource android APP using glReadPixel function.

GLES10.glReadPixels(x, y, screenWidth, screenHeight,GLES10.GL_RGB, GLES10.GL_UNSIGNED_BYTE, pixel);
                                 0  0         320                 480
Thanks in advance,
Yog.

Adrian Taylor

unread,
Dec 24, 2009, 5:56:21 AM12/24/09
to andro...@googlegroups.com
Hello Yog,

I would not expect to be able to use glReadPixels from an application, to grab a screen shot.

To use it, you'd need access to the Surface Flinger's internal pixmaps. Only SurfaceFlinger itself will be able to use glReadPixels to grab the screen image.

So, to make it possible to grab screenshots, you'd need to contribute a whole new SurfaceFlinger API to the Android open-source project. This would use glReadPixels then return the screenshot across a Binder interface to some new Java API. This would be complicated, especially regarding the security implications!

Without this API, I suspect you will be unable to grab screenshots on some Android 2.0 devices. I may be wrong though.

Regards

Adrian

p. yog

unread,
Dec 24, 2009, 8:09:30 AM12/24/09
to andro...@googlegroups.com
Hi all and Andrian,

Thanks for your valuable suggestions, i have doubts in surface flinger part. can you please clarify these.

I want to collect frame buffer data in surface flinger layer and need to give it to APP. Here are my doubts

1) where can i get the right Frame buffer data that is going to frame-buffer driver in surface flinger? If i call glReadpixel, can i get right frame buffer data.

(or) Is there any other point that i get  Frame buffer info.

2) can the Java APP written can collect this frame buffer data? In "frameworks/base/core/res/AndroidManifest.xml" file there given "GET_FRAME_DATA" structure which says that we can collect frame buffer data, does it mean that any written APP can collect Frame data?

Any such open App that is collecting data from libraries section. Just for an Idea.

Thanks in advance,
Yog

Niraj

unread,
Jan 6, 2010, 2:13:18 PM1/6/10
to android-ndk
Hi all,

Now I am able to get screen-shot on android 1.6
I downloaded the full source code of android 1.6

For my device, the default screen resolution is 1366 x 768.
For this particular resolution, the frame-buffer size is not exactly
1366 x 768; some padding bits are added in frame-buffer.
If one is able to deal with this padding bits, it is possible to have
screen-capture.
This info is available in VSCREENINFO structure.

Right now I managed to change the screen resolution to 800 x 600.
For this resolution, no padding bits are added in the frame-buffer.
One can have exact screen-shot for this screen resolution.

Android DDMS screen capture utility also fails at 1366 x 768 screen
resolution and works properly for 800 x 600 screen resolution.

For screen capturing, I am directly reading /dev/graphics/fb0 file,
and creating bmp file.

Thanks,
Niraj

On Dec 24 2009, 6:09 pm, "p. yog" <usb...@gmail.com> wrote:
> Hi all and Andrian,
>
> Thanks for your valuable suggestions, i have doubts in surface flinger part.
> can you please clarify these.
>
> I want to collect frame buffer data in surface flinger layer and need to
> give it to APP. Here are my doubts
>
> 1) where can i get the right Frame buffer data that is going to frame-buffer
> driver in surface flinger? If i call glReadpixel, can i get right frame
> buffer data.
>
> (or) Is there any other point that i get  Frame buffer info.
>
> 2) can the Java APP written can collect this frame buffer data? In
> "frameworks/base/core/res/AndroidManifest.xml" file there given
> "GET_FRAME_DATA" structure which says that we can collect frame buffer data,
> does it mean that any written APP can collect Frame data?
>
> Any such open App that is collecting data from libraries section. Just for
> an Idea.
>
> Thanks in advance,
> Yog
>

> >> On Sat, Dec 19, 2009 at 4:46 PM, Adrian Taylor <adrian.tay...@realvnc.com

> >>>http://groups.google.com/group/android-platform/browse_thread/thread/...


>
> >>> --
>
> >>> You received this message because you are subscribed to the Google Groups
> >>> "android-ndk" group.
> >>> To post to this group, send email to andro...@googlegroups.com.
> >>> To unsubscribe from this group, send email to

> >>> android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>


> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/android-ndk?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to andro...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-ndk...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/android-ndk?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to andro...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>

Reply all
Reply to author
Forward
0 new messages