Last Comment Bug 738189 - VRAM not reported correctly with Azure in about:memory
: VRAM not reported correctly with Azure in about:memory
Status: RESOLVED FIXED
[MemShrink:P1]
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: 14 Branch
: x86 Windows 7
: -- normal with 1 vote (vote)
: mozilla16
Assigned To: Bas Schouten (:bas.schouten)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-22 03:44 PDT by Grant
Modified: 2012-06-21 04:04 PDT (History)
13 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
-


Attachments
Add memory reporting for Azure VRAM (12.32 KB, patch)
2012-06-12 15:57 PDT, Bas Schouten (:bas.schouten)
jmuizelaar: review+
Details | Diff | Review

Description Grant 2012-03-22 03:44:28 PDT
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120321 Firefox/14.0a1
Build ID: 20120321031151

Steps to reproduce:

With just one tab opened (on Google's home page) I have been getting this amount of VRAM used, which I thought was normal as its been like this since I can remember. It would slowly grow with the more tabs I used:

12.03 MB ── gfx-d2d-surfacevram


Actual results:

When I enabled gfx.content.azure.enabled to true and the browser reset to googles , my VRAM usage reported on about:memory was this:

4.00 MB ── gfx-d2d-surfacevram

It changes by small amounts, but stays very close to the 4MB mark.


Expected results:

I would have thought it would still be around the 12-13MB mark.

My thoughts are, is about:memory not displaying Azure content properly or is Azure different in some way to make it use less VRAM?

Can anyone reproduce?
Comment 1 Bas Schouten (:bas.schouten) 2012-03-25 10:27:37 PDT
Azure content does not correctly report VRAM usage. So about:memory does not display Azure content properly.
Comment 2 Grant 2012-04-04 01:40:02 PDT
(In reply to Bas Schouten (:bas) from comment #1)
> Azure content does not correctly report VRAM usage. So about:memory does not
> display Azure content properly.

Thanks for the reply, this clears it up for me.

To get it reported, do I talk to the about:memory guys or is it already in the pipeline?
Comment 3 Ryan VanderMeulen [:RyanVM] 2012-05-25 19:47:11 PDT
This is particularly bad because Azure content seems to be leaking memory badly (at least with Intel graphics) since it was turned on, and there's no indication as to what's leaking when looking at about:memory.
Comment 4 timbugzilla 2012-05-25 19:56:53 PDT
(In reply to Ryan VanderMeulen from comment #3)
> This is particularly bad because Azure content seems to be leaking memory
> badly (at least with Intel graphics) since it was turned on, and there's no
> indication as to what's leaking when looking at about:memory.

I am also seeing a big increase in memory use (probably a leak) with azure content  turned on. This is with an AMD HD4650 GPU (latest drivers) on Win 7 64bit (32bit moz central nightlies).
Comment 5 Nicholas Nethercote [:njn] 2012-05-29 16:48:06 PDT
(In reply to Ryan VanderMeulen from comment #3)
> This is particularly bad because Azure content seems to be leaking memory
> badly (at least with Intel graphics) since it was turned on, and there's no
> indication as to what's leaking when looking at about:memory.

That's a separate issue.  Ryan, is there a bug filed on that?  If not, could you file one?

Who is a good candidate for writing a memory reporter for Azure content?
Comment 6 Bas Schouten (:bas.schouten) 2012-05-29 17:57:56 PDT
> (In reply to Ryan VanderMeulen from comment #3)
> > This is particularly bad because Azure content seems to be leaking memory
> > badly (at least with Intel graphics) since it was turned on, and there's no
> > indication as to what's leaking when looking at about:memory.
> 
> I am also seeing a big increase in memory use (probably a leak) with azure
> content  turned on. This is with an AMD HD4650 GPU (latest drivers) on Win 7
> 64bit (32bit moz central nightlies).

Yes, I believe there is a leak. There are bugs which are symptomatic of the leak.

Just for the record, considering the way we do memory counting for video memory it's unlikely the about:memory would show us much useful.
Comment 7 Nicholas Nethercote [:njn] 2012-05-29 19:21:44 PDT
> Just for the record, considering the way we do memory counting for video
> memory it's unlikely the about:memory would show us much useful.

Well, can we change it?  The memory reporter isn't much good if huge leaks don't show up in about:memory.
Comment 8 Bas Schouten (:bas.schouten) 2012-05-29 19:43:06 PDT
(In reply to Nicholas Nethercote [:njn] from comment #7)
> > Just for the record, considering the way we do memory counting for video
> > memory it's unlikely the about:memory would show us much useful.
> 
> Well, can we change it?  The memory reporter isn't much good if huge leaks
> don't show up in about:memory.

Realistically, very hard, there are no good APIs to measure VRAM usage (there has been improvement recently I believe, but I'm not sure), from usermode. And this address space is used by DirectX internally to swap to, it's just magic address space that's part of the working set (not the PWS).

We estimate this by counting how much surfaces we allocate, but that doesn't work if some object internal to a surface leaks for example, since DirectX will just keep memory around we don't count.

Having said that it would obviously be nice (and not hard), to extend the counting we did with Cairo to Azure.
Comment 9 Jeff Muizelaar [:jrmuizel] 2012-05-29 19:45:49 PDT
We try to measure this with bug 689870 but unfortunately we lack the headers required to make it build.
Comment 10 Alex Keybl [:akeybl] 2012-06-01 15:27:40 PDT
(In reply to Bas Schouten (:bas) from comment #6)
> Just for the record, considering the way we do memory counting for video
> memory it's unlikely the about:memory would show us much useful.

It sounds like it's more important to track the bug where we're investigating the memory leak. Please nominate that bug.
Comment 11 Bas Schouten (:bas.schouten) 2012-06-01 16:34:01 PDT
(In reply to Alex Keybl [:akeybl] from comment #10)
> (In reply to Bas Schouten (:bas) from comment #6)
> > Just for the record, considering the way we do memory counting for video
> > memory it's unlikely the about:memory would show us much useful.
> 
> It sounds like it's more important to track the bug where we're
> investigating the memory leak. Please nominate that bug.

That issue has been addressed. I believe, although that crash still exists it's now dropped to an occurrence level where it just indicates a general OOM.
Comment 12 Bas Schouten (:bas.schouten) 2012-06-12 15:57:58 PDT
Created attachment 632452 [details] [diff] [review]
Add memory reporting for Azure VRAM

This adds some VRAM usage estimates to Azure.
Comment 13 Jeff Muizelaar [:jrmuizel] 2012-06-13 13:43:07 PDT
Comment on attachment 632452 [details] [diff] [review]
Add memory reporting for Azure VRAM

Review of attachment 632452 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/2d/SourceSurfaceD2D.cpp
@@ +17,5 @@
>  
>  SourceSurfaceD2D::~SourceSurfaceD2D()
>  {
> +  if (mBitmap) {
> +    DrawTargetD2D::mVRAMUsageSS -= mSize.width * mSize.height * BytesPerPixel(mFormat);

Probably worth having a helper like in DrawTargetD2D
Comment 14 Bas Schouten (:bas.schouten) 2012-06-20 23:31:25 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/e7b9f828d4c1
Comment 15 Bas Schouten (:bas.schouten) 2012-06-20 23:32:10 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/c4083302aa3f

Note You need to log in before you can comment on or make changes to this bug.