Closed Bug 740557 Opened 8 years ago Closed 8 years ago

Add a Copy-On-Write surface wrapper (gfxReusableSurface)

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: BenWa, Assigned: BenWa)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
This surface is meant to be used for sharing copy on write surface between content and the compositor.
Attachment #610652 - Flags: review?(jmuizelaar)
Comment on attachment 610652 [details] [diff] [review]
patch

I'm not thrilled with some of the naming, but don't have a bunch of suggestions.

We should do away with the WriteLock stuff, it doesn't seem to be needed.

One of the things that's not clear about this stuff is that it needs to be used in a rather restrictive way. i.e. all ReadLocking has to happen on the same thread as GetWritable. I'm not sure how to make this more obvious in the interface, but it should be at least documented.

Further, we shouldn't allow access to the gfxImageSurface from a different thread. I suggest that we only have methods for decreasing the read count and getting the data/size/stride.

We can't delete gfxImageSurface from another thread, and I'm not sure how the gfxImageSurface's reference is managed by the gfxCoWSurfaceWrapper.

Another thing I don't like is the sort of duplication with reference count and the read count.
Attachment #610652 - Flags: review?(jmuizelaar) → review-
Attached patch patch v2 (obsolete) — Splinter Review
Assignee: nobody → bgirard
Attachment #610652 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #614555 - Flags: review?(jmuizelaar)
Summary: Add a Copy-On-Write surface wrapper (gfxCoWSurfaceWrapper) → Add a Copy-On-Write surface wrapper (gfxReusableSurface)
review ping
Comment on attachment 614555 [details] [diff] [review]
patch v2

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

You'll need to make sure you delete this on the main thread.

::: gfx/thebes/gfxReusableSurfaceWrapper.cpp
@@ +21,5 @@
> +{
> +  NS_ABORT_IF_FALSE(mReadCount == 0, "Should not be locked when released");
> +  MOZ_COUNT_DTOR(gfxReusableSurfaceWrapper);
> +  oC--;
> +  printf_stderr("oC %u\n", oC);

Make sure you take this out.

@@ +48,5 @@
> +    return this;
> +  }
> +
> +  // Something else is reading the surface, copy it
> +  gfxImageSurface* copySurface = new gfxImageSurface(mSurface->GetSize(), mSurface->Format());

You shouldn't initialize this surface.

::: gfx/thebes/gfxReusableSurfaceWrapper.h
@@ +2,5 @@
> + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
> + * You can obtain one at http://mozilla.org/MPL/2.0/. */
> +
> +#ifndef GFXCOWSURFACEWRAPPER
> +#define GFXCOWSURFACEWRAPPER

Fix the name here
Attachment #614555 - Flags: review?(jmuizelaar) → review-
Attached patch patch-v3Splinter Review
Attachment #614555 - Attachment is obsolete: true
Attachment #615937 - Flags: review?(jmuizelaar)
Attachment #615937 - Flags: review?(jmuizelaar) → review+
https://hg.mozilla.org/mozilla-central/rev/8f6fdee0a712
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
GFXCOWSURFACEWRAPPER didn't get fixed (must of not got qref properly), still need to fix this.
You need to log in before you can comment on or make changes to this bug.