bugGnash - The GNU Flash player - Bugs: bug #15515, Reassigned to another tracker...

 
 

bug #15515: Reassigned to another tracker [was: gnash burns CPU even when iconified]

Submitter:  None
Submitted:  Mon 23 Jan 2006 10:38:50 PM UTC
   
 
Category:  gui Severity:  3 - Normal
Release:  None Status:  Confirmed
Privacy:  Public Assigned to:  rsavoye
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 05 Jul 2007 12:39:11 PM UTC, comment #18: 

THIS ITEM WAS REASSIGNED TO TASK #7058


Please, do not post any new comments to this item.

Martin Guy <martinwguy>
Sat 12 May 2007 08:42:33 AM UTC, comment #17: 

A quick test shows that CPU burns even when window is iconified or covered by another window... this is with Magical Trevor 2 movie.
Didn't check if the renderer is actually called, I guess that would tell us wheter CPU is really busy there or somewhere else..

Sandro Santilli <strk>
Group Member
Tue 10 Apr 2007 02:24:50 PM UTC, comment #16: 

I think bastiaan fixed this lately, right ?

Sandro Santilli <strk>
Group Member
Tue 07 Nov 2006 01:14:13 PM UTC, comment #15: 

I'm sorry, the coordinates are always TWIPS

Udo Giacomozzi <udog>
Group Member
Tue 07 Nov 2006 11:21:34 AM UTC, comment #14: 

Please just document this as usual with comments in the code, I'm very busy with memory corruption at the moment and have to postpone   this "Gui" tasks, I'd just like not to discard the whole discussion so far.

Sandro Santilli <strk>
Group Member
Tue 07 Nov 2006 11:07:29 AM UTC, comment #13: 

Yeah, you're right.

get_invalidated_bounds() : TWIPS

gui.cpp -> GUI : TWIPS

GUI -> renderer : pixels!

It has it reasons :)

Udo Giacomozzi <udog>
Group Member
Tue 07 Nov 2006 11:04:54 AM UTC, comment #12: 

Have a look at my longer mailing list posting.

When Gui::set_invalidated_bounds() is called it means:

"Hey GUI, just to let you know, I will call display() soon and these are the coordinates that have changed in the movie for sure. Do whatever you want with it".

GTK-AGG then says:

"Oh, good to know, I'll tell the renderer that he can forget about the area outside these bounds and I'll copy the offscreen buffer only in that region. Oh, I just noticed that on my left side I have been uncovered and I have to redraw, so I'll ask the renderer to redraw that part too."

Clear now? ;)

I understand that the concept may be confusing...

Udo Giacomozzi <udog>
Group Member
Tue 07 Nov 2006 11:00:40 AM UTC, comment #11: 

Sounds good, next step would be properly document
the Gui::set_invalidated_bounds() to clearly specify
what would the coordinate system used there
(onscreen pixels? offscreen pixels [can they be different?] ?
 twips? would Scales change that]

Sandro Santilli <strk>
Group Member
Tue 07 Nov 2006 10:56:24 AM UTC, comment #10: 

You can keep a gnash::rect that holds information about re-exposed regions since the last display() call. It's easy to extend this rect using the class functions.

When you get the set_invalidated_bounds() call, extend the bounds to that rect before passing it to the renderer.

When receiving the expose event, just trigger display().

Don't know if it makes much sense but you could throttle the re-displaying using a one-shot timer (to skip quickly consecutive events). But I'm not that familiar with the GTK architecture to tell if this is complete nonsense.

Udo Giacomozzi <udog>
Group Member
Tue 07 Nov 2006 10:46:03 AM UTC, comment #9: 

I'm trying to define a "new", correct design here.
What I don't understand in Udo's summary is:
what should Gui::set_invalidated_bounds() do, really ?
Is it to tell the Gui which bounds of the movie changed ?
In this case the Gui should again intersect that with
exposed region, right ?

Sandro Santilli <strk>
Group Member
Tue 07 Nov 2006 10:34:18 AM UTC, comment #8: 

Just to understand Udo's proposal right:
At least for GTK I don't know a way to determine the visible region of the window. The expose event just tells what previously hidden region has to be redrawn. So, when calling display() the "exposed_region_rect" can be either the whole window region, the region for the exposed part of the window (which we get from the expose event) or NULL for an invisible window. Right?

Hannes Mayr <bik>
Group Member
Mon 06 Nov 2006 10:54:27 PM UTC, comment #7: 

Yes, seems an easy short-term fix for this bug.
I won't do it myself though. Bastiaan ? Bik ?

Sandro Santilli <strk>
Group Member
Mon 06 Nov 2006 10:30:40 PM UTC, comment #6: 

Ok, I understand your proposal.
But unless we change more parts of the code this would go an odd way:

- the exposed_region_rectangle is defined
- display() is called passing the exposed_region_rectangle
- the invalidated bounds are searched
- the intersection of these bounds is calculated
- Gui::set_invalidated_bounds() is called (so the info is passed back to the GUI!)
- render_handler::set_invalidated_bounds() is called
[BTW, don't forget that advance_movie() needs to know exposed_region_rectangle too]

as opposed to the current implementation:

- display() is called (maype indirectly via advance_movie), just like now
- the invalidated bounds are searched
- Gui::set_invalidated_bounds() is called, which intersects it with the current exposed rect (only code change is here!)
- render_handler::set_invalidated_bounds() is called with the new coordinates


Udo Giacomozzi <udog>
Group Member
Mon 06 Nov 2006 09:58:28 AM UTC, comment #5: 

I already added a ::display() method to the Gui:: class.
The ::advance_movie will call ::display() internally, but
nothing prevents Guis from calling ::display() directly.
This is already used by notify_mouse_moved() function to
redisplay.

The ::display() method calls display on the underlying movie
thouhg, doesn't simply refresh the screen. I think this is
fine if we add movie::display() an optional parameter to restrict
display to the characters that actually intersect a given
rectangle (or, as a short hack we can just skip the call
to the the movie::display if our "exposed_region_rectangle" is
NULL (iconified or completely hidden by another window)


Sandro Santilli <strk>
Group Member
Sun 05 Nov 2006 11:02:20 PM UTC, comment #4: 

IMHO the GUI (not gui.cpp) just needs to call a new advance_movie()-like method that avoids rendering.

The best would be to split Gui::advance_movie() and trigger rendering with a separate function.

This has the advantage that the individual GUI can re-render without advancing the frame and vice-versa.

Something like:

bool
Gui::advance_movie(Gui* gui)
{
assert(gui);
gnash::movie_interface* m = gnash::get_current_root();
// Advance movie by one frame
m->advance(1.0);
}

Gui::render(Gui* gui)
{
assert(gui);
gnash::movie_interface* m = gnash::get_current_root();
gui->display(m);

if ( ! gui->loops() )
{
size_t curframe = m->get_current_frame();
gnash::sprite_instance* si = m->get_root_movie();
if (curframe + 1 == si->get_frame_count())
{
    exit(0); // TODO: quit in a more gentile fashion.
}
}

return true;
}


BTW, the gui.cpp, GUI and GUI glue naming is very confusing...

Udo Giacomozzi <udog>
Group Member
Sun 05 Nov 2006 09:51:24 PM UTC, comment #3: 

Yes, we should completely skip the "movie::display" call if the drawable is not visible.

Maybe add a Gui::is_visible method (simple) ?
or a Gui::get_visible_region (more complex, allows calling display only on the characters whos bounds intersect the visible area) ?

Sandro Santilli <strk>
Group Member
Thu 30 Mar 2006 10:19:04 AM UTC, comment #2: 

IMHO, audio should continue playing, and should be kept in sync with the visuals. But I guess there is still a lot of CPU to be saved: No actual (vector) rendering is needed, no X server communication is needed.

Horst Schirmeier <bigfoot>
Thu 26 Jan 2006 05:13:53 PM UTC, comment #1: 

I can add some code to check the iconified state, but I had a question. If I'm playing a video or music file, it continues playing even when iconified. Shouldn't Gnash do the same ? It would be possible to have the player pause when iconified, but this doesn't seem to be the expected behaviour.

Rob Savoye <rsavoye>
Group administrator
Mon 23 Jan 2006 10:38:50 PM UTC, original submission:  

THIS ITEM WAS REASSIGNED TO TASK #7058
Gnash should notice when its window is not visible on the screen, and stop burning CPU to update it.  (It burns 100% of one of my CPUs when I have the X server's hardware acceleration off, run the standalone player with the JibJab.com "This Land is Your Land" .swf file, and then iconify the window.)

The same optimization should be made if the window is 100% hidden behind another window.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-07-05 martinwguy Reassign ItemGnash - The GNU Flash player, bug #15515 Gnash - The GNU Flash player, task #7058
    2007-04-10 strk CategoryNone gui
    2006-11-10 strk StatusNeed Info Confirmed
    2006-11-06 strk Carbon-Copy- Added bik
    2006-11-05 strk Carbon-Copy- Added udog
        Carbon-Copy- Added bjacques
    2006-01-26 rsavoye StatusNone Need Info
        Assigned toNone rsavoye

    Back to the top

    Powered by Savane 3.14-d582.
    Corresponding source code