Closed Bug 1139252 Opened 9 years ago Closed 8 years ago

Fix D3D9 memory reporters

Categories

(Core :: Graphics: Layers, defect)

All
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file, 1 obsolete file)

Bug 1128765 added three memory reporters. D3D9SurfaceImageReporter is ok, but D3D9TextureReporter and D3D9SharedTextureReporter are not:

> class D3D9TextureReporter MOZ_FINAL : public nsIMemoryReporter
> {
>   ...
>   NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
>                             nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
>   {
>     return MOZ_COLLECT_REPORT("d3d9-shared-textures", KIND_OTHER, UNITS_BYTES,
>                               gfxWindowsPlatform::sD3D9MemoryUsed,
>                               "Memory used for D3D9 shared textures");
>   }
> };
> 
> class D3D9SharedTextureReporter MOZ_FINAL : public nsIMemoryReporter
> {
>   ...
>   NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
>                             nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
>   {
>     return MOZ_COLLECT_REPORT("d3d9-shared-texture", KIND_OTHER, UNITS_BYTES,
>                               gfxWindowsPlatform::sD3D9SharedTextureUsed,
>                               "Memory used for D3D9 shared textures");
>   }
> };

The following things should be consistent within each reporters:
- the reporter class name;
- the report path;
- the static variable name;
- the description (which should also end with a '.').

It's enough of a copy+paste mess that I can't work out which parts need to be changed to fix it.

Jeff, can you fix this? Thank you.
Flags: needinfo?(jmuizelaar)
Attached patch Fix reporters (obsolete) — Splinter Review
Flags: needinfo?(jmuizelaar)
Attachment #8573452 - Flags: review?(n.nethercote)
Comment on attachment 8573452 [details] [diff] [review]
Fix reporters

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

Looking much better! I'd to check it one more time before landing, thanks.

::: gfx/layers/D3D9SurfaceImage.cpp
@@ +34,5 @@
>   * on destruction */
>  class TextureMemoryMeasurer9 : public IUnknown
>  {
>  public:
>    TextureMemoryMeasurer9(size_t aMemoryUsed)

Nit: it's pre-existing, but the '9' suffix here surprised me. Would 'D3D9' be better?

::: gfx/layers/d3d11/TextureD3D11.cpp
@@ +372,5 @@
>   * on destruction */
>  class TextureMemoryMeasurer : public IUnknown
>  {
>  public:
>    TextureMemoryMeasurer(size_t aMemoryUsed)

Similarly, would 'TextureMemoryMeasurerD3D11' be a better name?

::: gfx/thebes/gfxWindowsPlatform.cpp
@@ +332,2 @@
>  
> +class D3DTextureReporter MOZ_FINAL : public nsIMemoryReporter

Putting them all in a single reporter class is a good idea.

@@ +342,2 @@
>  
> +    rv =  MOZ_COLLECT_REPORT("d3d-shared-textures/d3d11", KIND_OTHER, UNITS_BYTES,

You now have the following paths:

- "d3d-shared-textures/d3d11"
- "d3d-shared-textures/d3d9"
- "d3d9-shared-texture-client"
- "d3d9-surface-image"

The first two will be grouped together in a subtree, though I suspect one of them will always be zero because it's unlikely that D3D9 and D3D11 are running at the same time? (I'm not sure about that.) But the latter two will be separate.

Would it instead make sense to do something like this:

- "d3d11/shared-textures"
- "d3d9/shared-textures"
- "d3d9/shared-texture-client"
- "d3d9/surface-image"

So that all the D3D9 measurements end up in the same subtree? If so, please change the variable names to match the paths, e.g. sD3D11SharedTextures.

Also, you might want to skip reporting values that are zero. You could create a local REPORT macro to encapsulate that. See the one in xpcom/base/nsCycleCollector.cpp for an example, and don't forget to #undef it afterwards.
Attachment #8573452 - Flags: review?(n.nethercote) → feedback+
Jeff, looks like this stalled 14 months ago. Any updates?
Flags: needinfo?(jmuizelaar)
Whiteboard: [gfx-noted]
The code has changed enough that my patch is no longer useful. Nick, are there still changes that you want made in the current code?
Flags: needinfo?(jmuizelaar) → needinfo?(n.nethercote)
If there are, Mason can you pick it up instead?
Assignee: jmuizelaar → mchang
Sometimes it's just easier to do something yourself.
Assignee: mchang → n.nethercote
Flags: needinfo?(n.nethercote)
This patch makes the names and reporter paths more consistent. It also removes
sD3D9MemoryUsed, which was unused.
Attachment #8753698 - Flags: review?(jmuizelaar)
Attachment #8573452 - Attachment is obsolete: true
Attachment #8753698 - Flags: review?(jmuizelaar) → review+
https://hg.mozilla.org/mozilla-central/rev/c9f15ab5c6c5
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: