Android NDK - Multithreading Slowing Down Rendering?

Mar 26, 2014

I have an Android app with a C++ library which uses pthreads to break down rendering tasks. This is for devices running Android 4+.

Lets say I have a 100 x 100 array of elements into which I repetitively do CPU-intensive processing. Currently I'm breaking the array up into four 25 x 100 element chunks and handing it off to four Posix threads (from a pool of stalled, pre-created threads). This gives an almost 4x speed increase on iOS and desktop Mac but slower results than single-threading under Android.

So the same code is used successfully to speed up the app on iOS or desktop Mac but in Android it often makes it even slower. I have done some tests on it and only quite big junks of data speed up when using multi threading. If the whole process (all threads) takes around 2 seconds or more it will speed up in multi threading mode but if it is less (say only takes about 400ms) it will be either the same speed or slower than just calling the rendering function normally. Which could point to thread switching being really slow. The bigger the processing tasks, the more they profit from multithreading. My tasks are usually not as big, but not fast enough in single threading mode.

I have also noticed that on ARM builds the speed difference between slower multi threading and the faster single threading is quite significant (almost twice as fast in multi threading rather than single threading) whereas on x86 builds the multi and single threaded versions will run at about the same speed as single threading on ARM builds. So x86 builds do not get slower on multithreading but also not faster.

Android NDK - Multithreading slowing down rendering?


Android :: Multithreading And Progress Dialog With Remote Service

Apr 28, 2010

I like to do some long running initializing work in a remote service, and during that, a progress dialog shall be shown. So basicly, I invoke ProgressDialog.show, run a oneway method of the service with a callback to be invoked when it's finished, and in the callback dismiss the dialog. I expected the service method to work in it's own process while the activity shows the progress dialog. But what happens instead (according to debugger and logs) is: ProgressDialog.show and service method invocation return immediately, then the service method is processed, and finally the progress dialog is shown for a few milliseconds right before it's dismissed. Even a "not responding" error might occur during that. If I invoke the service method in an own thread, which (as it's to be expected) is finished long before the service method is done, everything works fine. But I don't get why this is necessary. Why does a remote service method block the Activity thread? This even happens if the service method only does a Handler.post and returns immediately.

Simplyfied code overview: Activity: public void onStart() { startService(...); bindService(...);}

View 2 Replies View Related

Android :: Implement Multithreading In Droid Application So As To Increase Responsiveness Of UI?

Jun 2, 2010

How to implement Multithreading in Android application so as to increase responsiveness of UI. ?

View 3 Replies View Related

Android :: General Direction For Bluetooth SPP App With Multiple UI Activities - Multithreading - Handlers)

Sep 15, 2010

I am writing an Application that has multiple layouts with buttons. I have set up onClickListners for the buttons. Some buttons will change the activity and bring up a new layout with new buttons, and others will send outgoing SPP strings over Bluetooth. The strings will be defined in an XML file and will not change (serial commands).I can hard code the MAC address of the Bluetooth Server and only need to send data, not receive.

I am looking for some general guidance on the direction to go as far as setting up my Bluetooth connection and outgoing transmissions. I have looked at the BluetoothChat example extensively but do not have any good resources in the case of multiple activities.

-Do I use a separate activity to manage all Bluetooth transmissions and connections and create handlers for every case where I would send a Bluetooth message?

-Should I add Bluetooth connection+transmission threads in every activity (seems like i would run into issues losing the connection when changing activities)?

-Can I use handlers that are not class specific where the BluetoothService Activity could send whatever was prompted by the active/current activity?

-Could I just hard code all strings to be sent in the BluetoothService Activity and the UI activity could prompt the BluetoothService Activity to send the requested string based on the button click?

View 1 Replies View Related

Android :: Dolphin Browser HD - Slowing Down Phone?

Oct 30, 2010

After about a day of using dolphin hd I think I'm noticing extra lag in just about everything. Especially switching apps and loading the home screen. My keyboard has lagged a few times too. Ive got a fascinate with launcher pro plus. Anyone else seeing this? What can I do other than uninstall?

View 2 Replies View Related

Android :: Dynamic Overlays Slowing Down Google Maps (2.1) On Nexus One

May 7, 2010

I'm trying to create a dynamic ItemizedOverylay (please see the code below) on Google Maps (Android 2.1) on a Nexus One. In my Activity (that extends MapActivity) I'm creating a data thread that is receiving data from the network. A 'handler' is used to communicate the data from the receiving thread to map activity. This data contains the locations (lat, lon) of the markers that I want to overlay on my map. The location of each marker is dynamic (i.e., it changes every time I receive new data from the network.) refreshItems(ArrayList<OverlayItem> newItems) method in invoked inside the handleMessage() of the handler. There are around 11 markers in the ArrayList that is passed to refreshItems

I can see the markers overlayed on the map. However, I've two issues:.....................

View 1 Replies View Related

HTC Hero :: 8Gb Transcend Class 6 Slowing Down Phone

Nov 17, 2009

I have recently bought a Transcend 8GB class6 but I have noticed that the phone generally behaved slower as compare to the time when i was using the stock SD. One possible reason maybe i have been installing more apps than previously... can some expert tell me how i can check my phone mem availability? from what i understand, the more apps i installed the less mem will be ava for running apps so in turn slowing the phone.

BUT one very noticeable lag i found is the music app! when the music app changes title during normal playback, most of the time for sure each song will lag (jitter) during the first 5secs. there r no problem with the mp3s coz i have been listening to them on itunes and other portable players!!can anyone give me any suggestion / advise. i love the phone, but this issue is currently bugging me! and will the performance improve if i root the phone? and can anyone suggest if there is another music player that i can use to test instead of the default one?

View 18 Replies View Related

HTC Incredible :: Flash Slowing Down Browser Scroll / Fix It

Aug 28, 2010

Maybe its just me but with this RUU and full flash, the browser scrolls a lot slower. I was running skyraider before and noticed this after I installed the full flash apk. Removed full flash and scrolling sped up like before.

Anyone notice this?

I'm temped to revert back to either skyraider or flash lite. The browser lag is quite annoying. Anyone know how to disable full flash in the latest leak (cant uninstall it). I imagine i could just rename something. Any tips?

View 4 Replies View Related

Motorola Droid : Running Apps Slowing Down

Jan 11, 2010

I understand that certain apps need to run in the back ground in order to work and others run so that they are easily accessible. Is it possible to pick and choose which apps run in the back ground so I can keep my phone running smoothly. I have used task killer apps but, they are just not the right solution as most apps will just restart them selfs.

My main problem is the fact that I have to many apps installed on the phone and as the app store grows and I keep reading this forum it only gets worse. My phone actually got to an unresponsive state so that every time I picked it up there is a serious lag. I fixed this by deleting unnecessary apps that aren't used daily or weekly. The problem is I liked these apps and want the ability to be able to use them in a pinch but I don't want them running all of the time.

View 21 Replies View Related

General :: Xperia S Updated - GO Launcher Slowing Down

Jul 10, 2012

Since my Update from my Xperia S i think GO Launcher EX is slow down more and more... On My Xperia Mini Pro is also the same thing...

Now my Question is which Launcher is faster and has almost the same functional things like Go Launcher EX?

Apex? Nova?

View 3 Replies View Related

HTC Droid Eris :: Texts Slowing Down Phone Bigtime

Mar 23, 2010

I was so excited when I had upgraded to 2.1 that my texts were sending fast, but then I realized it was just because the phone had no texts. If I try to delete threads, the phone freezes on the spinning wheel, and no other 3rd party app has worked either.

View 2 Replies View Related

Samsung Moment :: Sprints Internet Speed Slowing Down?

Jul 5, 2010

Has anyone here had experience with Sprints internet speed slowing down? I have 2 Samsung Moments and the internet speed was great for months. A couple weeks ago they both slowed to a crawl. I have noticed that this is in the area that I live (Chesterfield, MI) and if I am in other areas it works pretty well. As soon as I get home it is crap. No Pandora, nothing streaming works for crap, and even basic pages like Craigslist take a minute or so to load.

An internet speed test usually shows around 100 or less kb/s for downloading and 200-300 for uploading. Download speeds were at least 500 before this snafu.
Maybe a tower out or something? I thought of calling Sprints customer care, but from previous experience with real technical questions, I don't think I will get anything more than a "company" answer.

View 5 Replies View Related

General :: Data Speeds Slowing Down After Software Update

Dec 28, 2013

I have a Xperia Z on T-Mobile I recently updated for 4.1 to 4.2 & now my data speeds are slower or nonexistent at certain areas of my job. I just wanted to know how is it possible for this to happen because I had a Galaxy SII with Sprint & the exact same thing happened.

View 1 Replies View Related

HTC Incredible :: Systempanel Monitoring Draining Battery And Slowing Down Phone?

Aug 23, 2010

i bought the full version of systempanel last night, because i installed setcpu and tasker over the weekend and started overclocking - i wanted to try the monitoring service and try to see if there was a drastic effect on my battery... well, the battery DEFINITELY seems to be draining faster than it did yesterday, and the phone seemed to be very choppy when switching between home screens. i disabled monitoring and it seems to be more responsive again.

View 4 Replies View Related

Android :: Svg Files Rendering ?

Nov 10, 2010

I wrote a program in Android for setting different kinds of images as my background image, but it is not working with svg files. I am not getting any errors, it is not displaying any image and I'm getting a blank screen in my emulator when using svg files. Can any one suggest how to read and display svg files in Android with some code? Or should I convert xml code?

View 1 Replies View Related

Android :: SW - 2D API - Vs HW - OpenGL - Rendering

Apr 27, 2009

I'm trying to compare the difference in speed between software and hardware graphics rendering. I have 2 apps right now - one written with only java/android 2D APIs, and one written with openGL calls...

View 6 Replies View Related

Android :: What Is Rendering Lifecycle?

Sep 10, 2010

There's a decent amount of information out there on the Activity lifecycle. But I'm surprised how difficult it is to find a comprehensive description of the rendering lifecycle. By that I mean the order and rules by which a tree of nested activities, views, and drawables get to be sized and drawn to the screen, and the points at which a developer can modify rendering behavior.

View 1 Replies View Related

Android :: Measuring A View Before Rendering It

May 13, 2010

I need to find out how big a view will be after attaching it to its parent.I have overridden this method: Do you think there is a way to get this information before rendering the view itself? Basically I need to know the actually size before attaching it and not attach the view at all if it would take more certain amount of space. Code...

View 2 Replies View Related

Android :: Content Rendering For WebView

Jul 15, 2009

Can anyone help me to understand how WebView decided which content it can render and which it can't? For example I am inside a webview select a link and if the link sends an XML file I want my application to handle to data instead of WebView, Is this possible?

View 4 Replies View Related

Android :: ImageView With Drawable Not Always Rendering

Jun 22, 2010

I have an ImageView object that I'm setting the android:src="@drawable/some_xml_file" instead of a standard png and it seems to not always render the drawable, as you can see in the first row here (it also happens intermittently in other rows as well):

I've tried setting the src & the background property but they both have the same effect. the source code from my list view row item is this:

CODE:...............

Then my res/drawable/action_box.xml is this:

CODE:................

View 1 Replies View Related

Android :: Video Rendering Performance ?

Apr 14, 2010

I need to render video on android. I got sw decoder which decodes stream to YUV or RGB with very reasonable cpu usage, but so far haven't found a nice way how to render frames.

I have tried 3 methods so far: 1) using opengl from native code: * create a texture of type GL_TEXTURE_2D * set coordinates to fill full opengl rendering area * to render a frame update the texture with glTexSubImage2D or glTexImage2D function (more or less the same method that is used in vlc media player)

With this method the performance is most terrible.. VGA rendering @5..7FPS uses up 100% of nexus one cpu!

2) rendering with canvas function Canvas.drawBitmap(int[] colors, int offset, int stride, int x, int y, int width, int height, boolean hasAlpha, Paint paint)Was hoping to use this via JNI. First i just made a simple perfo test: * colors array was initialized in java code * then I just called mSurfaceHolder.lockCanvas(); canvas.drawBitmap(colors, ... ); mSurfaceHolder.unlockCanvasAndPost(canvas); in sequence

Perfo is better than with opengl - VGA@30FPS uses up 40% of nexus one- s cpu...

3) Rendering with canvas function Canvas.drawBitmap(Bitmap bitmap, float left, float top, Paint paint), while updating bitmap in native code * in java code i do:

CODE:.......

To get native pointer to memory (need to link to native android library libskia.so to get these functions) * copy or decode the video frame to this memory

With this method i get only 10% cpu usage when doing VGA@30fps... but lets face it - its a hack which may break in future. Am I missing something or there really isn't any better way to render video? for example some opengl extension function etc..?

View 2 Replies View Related

Android :: Simple 2D Tile Not Rendering ?

Mar 16, 2010

I'm putting together a simple test made up of two tutorials available online for OpenGL ES on Android. This is really just so that I can learn about the basics of OpenGL ES to better understand how I have to design my program.

Right now, when it tries to render, the mouse movement effect works, but I get no square drawn on the screen.

Here are the two source files I'm dealing with:

CODE:.......

The second one is the tile object itself:

CODE:........

View 1 Replies View Related

Android : Png Image Not Rendering Correct / How To Fix?

Jun 15, 2010

When trying to process this png image, webkit displays it blurry.

View 2 Replies View Related

Android :: Screen Sizes And Activity Rendering

Jul 1, 2010

I'm currently developing my first android app, and my first game. I've been developing on a netbook with a CliqXT (HVGA). Things are going well, it renders perfectly on the smaller screen. I knew I'd have some issues when rendering on larger screens, but the issues I'm having are not what I was expecting and I'm kind of stuck.

So basically the game consists of a main SurfaceView which I'm rendering the tiled game world on to. I followed this tutorial to get started, and my structure is still pretty similar except that it calculates the boundries based on the player location:

http://www.droidnova.com/create-a-scrollable-map-with-cells-part-i,654.html

The game also has various buildings the player can enter. Upon entering it launches another activity for that particular building. The building activities are just normal Views with Android UI stuff defined in XML (Buttons, TextViews, etc).

What I expected to happen:

So I expected the the building UIs to render correctly on the larger screen. I specified all dimensions in "dp" and fonts in "sp" in hopes that they'd scale correctly. I expected the actual game tilemap to render generally correctly, but maybe be really tiny due to the higher resolution / dpi. I'm using a very similar function to the tutorial linked above (calculateLoopBorders(), my version is pasted below) to calculate how many tiles to render based on screen height and width (getHeight() and getWidth()).

What is actually happening:

The whole game is just being rendered as if it's HVGA. The tilemap, and the building UIs are just scaled down to the smaller screen size, leaving black borders around the left, right, and bottom (see images).

View 2 Replies View Related

Android :: OpenGL Application Rendering Using Software?

Oct 27, 2009

From the adb log of my G1's boot time, it shows "requestGPU returned -1", among other stuff. Does this mean that my OpenGL app is being rendered using software? BTW, I see the same messages on Hero as well.

------------------------------------------ log begin ------------------------------------------

I/SurfaceFlinger( 81): SurfaceFlinger is starting I/SurfaceFlinger( 81): SurfaceFlinger's main thread ready to run. Initializing graphics H/W... D/SurfaceFlinger( 81): pid 81 requesting gpu core (owner = -1) W/SurfaceFlinger( 81): couldn't grant gpu core to pid 81 D/EGL ( 81): requestGPU returned -1 E/libEGL ( 81): h/w accelerated eglGetDisplay() failed (EGL_SUCCESS) I/SurfaceFlinger( 81): EGL informations: I/SurfaceFlinger( 81): # of configs : 6 I/SurfaceFlinger( 81): vendor : Android I/SurfaceFlinger( 81): version : 1.31 Android META-EGL I/SurfaceFlinger( 81): extensions: I/SurfaceFlinger( 81): Client API: OpenGL ES I/EGLDisplaySurface( 81): using (fd=19) I/EGLDisplaySurface( 81): .......

View 2 Replies View Related

Android :: A Good Droid Rendering Engine?

Sep 9, 2010

What is a rendering engine? Is there any for Android?

View 1 Replies View Related

Android :: Testing OpenGL Rendering In Java Outside?

Aug 30, 2009

I would like to write OpenGL classes and test them in java outside of an Android device or emulator, and then use these in the Android.

Has anybody done this?: If so, are there JOGL implementations that are directly compatible?

I tried doing this on Windows using JOGL and writing wrappers, etc, but it turned out to be a real mess. I finally gave up when I didn't know how to get a GLU instance for a frustrum call.

View 4 Replies View Related

Android :: Rendering Scaled Bitmap With High Fps

Apr 15, 2010

I'm in the following situation: I have a large bitmap (~1280x1024) that I'd like to display on screen, scaled down in a view that fits the phone's screen (~480x320). This bitmap is frequently updated (couple of tiles per frame at 15 FPS). I first wanted to implement the rendering with a SurfaceView but figured out that all the scaling would be done in software due to limitations in the Android SDK. The second solution would be to load and render textures in an OpenGL context. Would that accelerate the resizing? If yes, isn't the cost of loading textures going to offset what I'll win on the scaling side?

View 2 Replies View Related

General :: Android UI Rendering In Real-time?

Jun 10, 2013

I was wondering why Android keeps lagging a bit. I mean, quadcore should be fast enough to stop that from happening right? So I started Googling.

I got this article: [URL] .....

Basically it says this: Android's UI rendering thread does not work in real-time (the priority is not set at that), unlike iOS'. It's just about the one thing that's still better about iOS in my opinion.

How to make this thread render in real-time?

View 1 Replies View Related

Android :: How To Compute Screen Size Before Rendering Objects?

Jun 15, 2009

I want to render 3d object on the screen. Before that I would like to compute the screen so that the rendered object can be given relative position. How that can be done?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved