Open Bug 1713417 Opened 4 years ago Updated 1 year ago

Allow choosing graphics backends based on Document

Categories

(Core :: Graphics: Canvas2D, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: tjr, Assigned: tjr)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fpp:future])

Attachments

(1 file, 1 obsolete file)

We have a new function that allows selective behavior for ResistFingerprinting based on an nsIChannel, most commonly called through the ShouldResistFingerprinting(Document) api. This new mechanism allows us to control RFP on a much more granular level, which presently is used to exempt based on the top level origin (as well as addons, and in non-PBM entirely.) This is all in-development experimental right now, and we're working to expand all of RFP's behavior to be so-controllable.

We're still testing, but it's looking like setting our backend to Skia will make canvas unfingerprintable (as long as we control for cleartype, but ignore that for now). So what we'd like to do is make the backend variable based on the ShouldResistFingerprinting() determination.

It looks like, to me, that Canvas-wise there's nothing that prevents us using different backends for different canvases, we just pass in the backend type to gfxPlatform::CreateDrawTargetForBackend and that normally comes from gfxPlatform::mPreferredCanvasBackend.

So the question is how to get the RFP decision down to gfxPlatform::CreateDrawTargetForBackend from some place we have a Document. It seems like the callstack is:

HTMLCanvasElement::CreateContext ->
CanvasRenderingContextHelper::CreateContextHelper ->
CanvasRenderingContext2D::CanvasRenderingContext2D ->
...
CanvasRenderingContext2D::TryBasicTarget ->
gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget

Presently, my best idea for this is to pass a single boolean down the call chain that indicates if we should use software rendering or not. Jeff, does this approach sounds good to you?

Flags: needinfo?(jgilbert)

setting our backend to Skia will make canvas unfingerprintable

How about fonts?

Also, can drawing performance be itself a fingerprint? Also can variations in skia version result in subtle differences in drawings of the same picture?

Severity: -- → S3
Type: defect → enhancement
Priority: -- → P3

I suspect the best thing to do is just use a different Create*DrawTarget call for RFP.

Flags: needinfo?(jgilbert)

I took a shot at this. I couldn't really tell how to made a new Create*DrawTarget for this, I ended up trying to get the boolean to where it needed to go... Still needs testing and improving, but this is a strawman for the design we should decide on before the rest is done.

I'm going to try to pick this up. I've rebased the patch here and in Bug 1724558 (although I'm not certain either was correct to begin with, but have to start somewhere.)

I started by trying to validate that setting webgl.angle.force-warp=true and gfx.canvas.azure.backends=skia produced consistent results between two windows computers. I found that the Scale option in System -> Display will cause the results to differ; but if matched, my two PCs at least will match. Going to be digging in more.

With the prefs on, the Windows Text Size setting also changes the results for some of the test canvases. The difference I'm confused about is when we render an image (with the prefs set as in C6) it has a different hash between two computers. I tried changing resolution, scaling, cleartype, text size, HDR, Nightlight - nothing affected the hash on my laptop. It is different between prefs and no-prefs also.

The comment in the test canvas mentions 'Canvas 3 renders an image at a reduced resolution, this also fingerprints via floating point rounding' so perhaps that is the source of the difference?

Okay, so it seems I'm going to need to put this to the side to finish Bug 1760633; and then after I've added those functions I can some back here, cut over Skia to use them, and see if it makes a difference.

See Also: → 1804368
Whiteboard: [fpp:future]

Okay; I am taking this back on now; we want to be able to software-render canvases for a telemetry page, so I'm going to be looking at this again.

Assignee: nobody → tom
Attachment #9315843 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: