Title: [132686] trunk/Source/Platform
Revision
132686
Author
[email protected]
Date
2012-10-26 12:58:01 -0700 (Fri, 26 Oct 2012)

Log Message

[chromium] Add additional memory management fields to WebGraphicsContext3D
https://bugs.webkit.org/show_bug.cgi?id=99703

Patch by Christopher Cameron <[email protected]> on 2012-10-26
Reviewed by James Robinson.

Add new fields to WebGraphicsMemoryAllocation to allow for specifying
limits for when visible and not, and to allow for specifying priority
cutoffs (e.g, to allow specifying that backgrounded tabs should
retain only their visible textures).

Add sendManagedMemoryStatsCHROMIUM to WebGraphicsContext3D, and
add WebGraphicsManagedMemoryStats structure, to allow the GPU memory
manager to make more informed choices.

* chromium/public/WebGraphicsContext3D.h:
(WebKit::WebGraphicsContext3D::sendManagedMemoryStatsCHROMIUM):
* chromium/public/WebGraphicsMemoryAllocation.h:
(WebGraphicsMemoryAllocation):
(WebKit::WebGraphicsMemoryAllocation::WebGraphicsMemoryAllocation):
(WebKit):
(WebGraphicsManagedMemoryStats):
(WebKit::WebGraphicsManagedMemoryStats::WebGraphicsManagedMemoryStats):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (132685 => 132686)


--- trunk/Source/Platform/ChangeLog	2012-10-26 19:57:52 UTC (rev 132685)
+++ trunk/Source/Platform/ChangeLog	2012-10-26 19:58:01 UTC (rev 132686)
@@ -1,3 +1,28 @@
+2012-10-26  Christopher Cameron  <[email protected]>
+
+        [chromium] Add additional memory management fields to WebGraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=99703
+
+        Reviewed by James Robinson.
+
+        Add new fields to WebGraphicsMemoryAllocation to allow for specifying
+        limits for when visible and not, and to allow for specifying priority
+        cutoffs (e.g, to allow specifying that backgrounded tabs should
+        retain only their visible textures).
+
+        Add sendManagedMemoryStatsCHROMIUM to WebGraphicsContext3D, and
+        add WebGraphicsManagedMemoryStats structure, to allow the GPU memory
+        manager to make more informed choices.
+
+        * chromium/public/WebGraphicsContext3D.h:
+        (WebKit::WebGraphicsContext3D::sendManagedMemoryStatsCHROMIUM):
+        * chromium/public/WebGraphicsMemoryAllocation.h:
+        (WebGraphicsMemoryAllocation):
+        (WebKit::WebGraphicsMemoryAllocation::WebGraphicsMemoryAllocation):
+        (WebKit):
+        (WebGraphicsManagedMemoryStats):
+        (WebKit::WebGraphicsManagedMemoryStats::WebGraphicsManagedMemoryStats):
+
 2012-10-26  Dana Jansens  <[email protected]>
 
         [chromium] Add implicit conversions between WebFloatPoint and gfx::PointF

Modified: trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h (132685 => 132686)


--- trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2012-10-26 19:57:52 UTC (rev 132685)
+++ trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2012-10-26 19:58:01 UTC (rev 132686)
@@ -33,6 +33,7 @@
 
 #include "WebCommon.h"
 #include "WebGraphicsMemoryAllocation.h"
+#include "WebGraphicsMemoryStats.h"
 #include "WebNonCopyable.h"
 #include "WebString.h"
 
@@ -162,6 +163,7 @@
 
     // GL_CHROMIUM_gpu_memory_manager - sets callback to observe changes to memory allocation limits.
     virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { }
+    virtual void sendManagedMemoryStatsCHROMIUM(const WebGraphicsManagedMemoryStats* stats) { }
 
     // GL_EXT_discard_framebuffer - discard/ensure existance of surface backbuffer.
     // FIXME: make these pure virtual once they are implemented by clients.

Modified: trunk/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h (132685 => 132686)


--- trunk/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h	2012-10-26 19:57:52 UTC (rev 132685)
+++ trunk/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h	2012-10-26 19:58:01 UTC (rev 132686)
@@ -31,18 +31,55 @@
 namespace WebKit {
 
 struct WebGraphicsMemoryAllocation {
+    // Deprecated data, to be removed from this structure.
     unsigned gpuResourceSizeInBytes;
     bool suggestHaveBackbuffer;
 
+    enum PriorityCutoff {
+        // Allow no allocations.
+        PriorityCutoffAllowNothing,
+        // Allow only allocations that are visible.
+        PriorityCutoffAllowVisibleOnly,
+        // Allow only allocations that are few screens away from being visible.
+        PriorityCutoffAllowVisibleAndNearby,
+        // Allow all allocations.
+        PriorityCutoffAllowEverything,
+    };
+
+    // Limits when this renderer is visible.
+    size_t bytesLimitWhenVisible;
+    PriorityCutoff priorityCutoffWhenVisible;
+
+    // Limits when this renderer is not visible.
+    size_t bytesLimitWhenNotVisible;
+    PriorityCutoff priorityCutoffWhenNotVisible;
+    bool haveBackbufferWhenNotVisible;
+
+    // If true, enforce this policy just once, but do not keep
+    // it as a permanent policy.
+    bool enforceButDoNotKeepAsPolicy;
+
     WebGraphicsMemoryAllocation()
         : gpuResourceSizeInBytes(0)
         , suggestHaveBackbuffer(false)
+        , bytesLimitWhenVisible(0)
+        , priorityCutoffWhenVisible(PriorityCutoffAllowNothing)
+        , bytesLimitWhenNotVisible(0)
+        , priorityCutoffWhenNotVisible(PriorityCutoffAllowNothing)
+        , haveBackbufferWhenNotVisible(false)
+        , enforceButDoNotKeepAsPolicy(false)
     {
     }
 
     WebGraphicsMemoryAllocation(unsigned gpuResourceSizeInBytes, bool suggestHaveBackbuffer)
         : gpuResourceSizeInBytes(gpuResourceSizeInBytes)
         , suggestHaveBackbuffer(suggestHaveBackbuffer)
+        , bytesLimitWhenVisible(0)
+        , priorityCutoffWhenVisible(PriorityCutoffAllowNothing)
+        , bytesLimitWhenNotVisible(0)
+        , priorityCutoffWhenNotVisible(PriorityCutoffAllowNothing)
+        , haveBackbufferWhenNotVisible(false)
+        , enforceButDoNotKeepAsPolicy(false)
     {
     }
 };

Copied: trunk/Source/Platform/chromium/public/WebGraphicsMemoryStats.h (from rev 132684, trunk/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h) (0 => 132686)


--- trunk/Source/Platform/chromium/public/WebGraphicsMemoryStats.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebGraphicsMemoryStats.h	2012-10-26 19:58:01 UTC (rev 132686)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebGraphicsMemoryStats_h
+#define WebGraphicsMemoryStats_h
+
+#include "WebCommon.h"
+
+namespace WebKit {
+
+struct WebGraphicsManagedMemoryStats {
+    // Bytes required for all visible textures.
+    size_t bytesVisible;
+
+    // Bytes required for all textures visible or a few screens away from
+    // being visible.
+    size_t bytesVisibleAndNearby;
+
+    // The number of bytes currently allocated.
+    size_t bytesAllocated;
+
+    // Whether or not a backbuffer is currently requested (the memory usage
+    // of the buffer is known by the GPU process).
+    bool backbufferRequested;
+
+    WebGraphicsManagedMemoryStats() 
+        : bytesVisible(0)
+        , bytesVisibleAndNearby(0)
+        , bytesAllocated(0)
+        , backbufferRequested(0)
+    {
+    }
+};
+
+} // namespace WebKit
+
+#endif
+
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to