Closed Bug 611799 Opened 14 years ago Closed 14 years ago

Prefill newly created buffers with old content

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: stechz, Assigned: stechz)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Bug 603885 removes prefilling new buffers with old content, but it turns out that we still need to do that.
Ah ... I gave bad advice on IRC.  This backout isn't actually the best solution.  The bug here is that after the new buffer is created and old pixels are copied into it, mRegionToPaint is actually a subset of what's out of sync between back/front.  We always need to read back the entire front buffer into the back after the first swap after an re-allocation.

Nice debugging work, thanks!
One relatively simple solution to this would be, in BasicShadowableThebesLayer::PaintBuffer after a buffer realloc, just pass the layer's entire visible region to BasicManager()->PaintedThebesBuffer(), instead of aRegionToDraw.
This would be slower though, yes?
As the backout?  No, it would be the same, except the copy would be off the critical path to Update()ing chrome, so it would be better.
Attachment #490195 - Attachment is obsolete: true
Attachment #490217 - Flags: review?(jones.chris.g)
Comment on attachment 490217 [details] [diff] [review]
Prefill newly created buffers with old content

>   NS_OVERRIDE virtual already_AddRefed<gfxASurface>
>   CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize);
> 
>   // This describes the gfxASurface we hand to mBuffer.  We keep a
>   // copy of the descriptor here so that we can call
>   // DestroySharedSurface() on the descriptor.
>   SurfaceDescriptor mBackBuffer;
>+
>+  bool mIsNewBuffer;
> };

PRBool for roc's sake.  Ditch the newline.

> 
> void
> BasicShadowableThebesLayer::SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
>                                                   const nsIntRegion& aValidRegion,
>                                                   float aXResolution,
>                                                   float aYResolution,
>                                                   const OptionalThebesBuffer& aReadOnlyFrontBuffer,
>@@ -1524,20 +1527,29 @@ BasicShadowableThebesLayer::PaintBuffer(
>                                         void* aCallbackData)
> {
>   Base::PaintBuffer(aContext, aRegionToDraw, aRegionToInvalidate,
>                     aCallback, aCallbackData);
>   if (!HasShadow()) {
>     return;
>   }
> 
>+  nsIntRegion visibleRegion;
>+  if (mIsNewBuffer) {
>+    visibleRegion = mVisibleRegion;
>+    mIsNewBuffer = false;
>+  } else {
>+    visibleRegion = aRegionToDraw;
>+  }

Call this |updatedRegion|, and add a comment describing why we ensure it's the entire visible region after a new buffer has been allocated.
Attachment #490217 - Flags: review?(jones.chris.g) → review+
Assignee: nobody → ben
blocking2.0: --- → final+
Keywords: regression
Pushed http://hg.mozilla.org/mozilla-central/rev/b7e6e0d314b6
Status: NEW → RESOLVED
blocking2.0: final+ → ---
Closed: 14 years ago
Resolution: --- → FIXED
why i oughta
blocking2.0: --- → final+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: