Commit 22681053 authored by Bobby Holley's avatar Bobby Holley
Browse files

Bug 1504115 - Track the total number of GPU bytes allocated by WebRender. r=gw

This is useful for sanity-checking memory reports, and we'll also use it
for our texture eviction heuristic.

Differential Revision: https://phabricator.services.mozilla.com/D10672
parent 7ac9331b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -678,6 +678,13 @@ struct WebRenderMemoryReporterHelper {
    ReportInternal(aBytes, path, desc, nsIMemoryReporter::KIND_OTHER);
  }

  void ReportTotalGPUBytes(size_t aBytes) const
  {
    nsCString path(NS_LITERAL_CSTRING("gfx/webrender/total-gpu-bytes"));
    nsCString desc(NS_LITERAL_CSTRING("Total GPU bytes used by WebRender (should match textures/ sum)"));
    ReportInternal(aBytes, path, desc, nsIMemoryReporter::KIND_OTHER);
  }

  void ReportInternal(size_t aBytes, nsACString& aPath, nsACString& aDesc, int32_t aKind) const
  {
    // Generally, memory reporters pass the empty string as the process name to
@@ -741,6 +748,9 @@ WebRenderMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
      helper.ReportTexture(aReport.texture_cache_textures, "texture-cache");
      helper.ReportTexture(aReport.depth_target_textures, "depth-targets");

      // Total GPU bytes, for sanity-checking the above.
      helper.ReportTotalGPUBytes(aReport.total_gpu_bytes_allocated);

      FinishAsyncMemoryReport();
    },
    [](mozilla::ipc::ResponseRejectReason aReason) {