Closed Bug 997517 Opened 10 years ago Closed 10 years ago

Never try to use non-data drawtargets with BufferTextureClient

Categories

(Core :: Graphics: Layers, defect)

x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: bas.schouten, Assigned: bas.schouten)

Details

Attachments

(1 file)

Currently we have a fallback codepath where we try really hard to create a DrawTarget that has the content backend for BufferTextureClient. This is a bad idea because we always end up reading it back if it's for example a D2D DrawTarget to get our data into the shmem. We should just fallback to a data-based drawtarget if we failed to create one of the desired backend.
Note: CreateTextureClientForDrawing takes a Moz2D BackendType as parameter so we could try hard not to create a BufferTextureClient if the specified backend is, say, D2D.

Isn't there a risk, if we just fallback to a data DrawTarget, that users of TextureClient will expect it to be whaterver backend there own backend is and pass it non-data source surfaces? or do data DrawTargets just check the type of the input surfaces and get data surfaces out of the ones that are not compatible?
(In reply to Nicolas Silva [:nical] from comment #1)
> Note: CreateTextureClientForDrawing takes a Moz2D BackendType as parameter
> so we could try hard not to create a BufferTextureClient if the specified
> backend is, say, D2D.
> 
> Isn't there a risk, if we just fallback to a data DrawTarget, that users of
> TextureClient will expect it to be whaterver backend there own backend is
> and pass it non-data source surfaces? or do data DrawTargets just check the
> type of the input surfaces and get data surfaces out of the ones that are
> not compatible?

I don't think so... after all, they're taking a -buffer- texture client. Fundamentally, yes, they'll have to readback, but hell, they had to read back anyway :-). It's better that the user needs to do the messed up stuff than the texture client hitting the performance impact. What happens to incompatible sourcesurfaces sort of differs. But mostly it'll work. Anyway, this way at least we catch those instead of failing miserably :)
Attachment #8411219 - Flags: review?(nical.bugzilla)
Attachment #8411219 - Flags: review?(nical.bugzilla) → review+
https://hg.mozilla.org/mozilla-central/rev/a71ab9427855
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.