The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in mozilla14

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: BenWa, Assigned: BenWa)

Tracking

unspecified
mozilla14
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

5 years ago
Created attachment 610652 [details] [diff] [review]
patch

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-
(Assignee)

Comment 2

5 years ago
Created attachment 614555 [details] [diff] [review]
patch v2
Assignee: nobody → bgirard
Attachment #610652 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #614555 - Flags: review?(jmuizelaar)
(Assignee)

Updated

5 years ago
Summary: Add a Copy-On-Write surface wrapper (gfxCoWSurfaceWrapper) → Add a Copy-On-Write surface wrapper (gfxReusableSurface)
(Assignee)

Comment 3

5 years ago
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-
(Assignee)

Comment 5

5 years ago
Created attachment 615937 [details] [diff] [review]
patch-v3
Attachment #614555 - Attachment is obsolete: true
Attachment #615937 - Flags: review?(jmuizelaar)
Attachment #615937 - Flags: review?(jmuizelaar) → review+
(Assignee)

Comment 6

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/8f6fdee0a712
https://hg.mozilla.org/mozilla-central/rev/8f6fdee0a712
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
(Assignee)

Comment 8

5 years ago
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.