Closed Bug 543887 Opened 14 years ago Closed 14 years ago

Need to implement readback in drawWindow to allow reftest to work with layers/acceleration

Categories

(Core :: Graphics: Canvas2D, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jgriffin, Unassigned)

Details

Per the graphics team meeting on Monday, please implement readback in drawWindow so that we can use reftest to test the layers/hardware acceleration work that's currently in progress.
That's already implemented in part 6 in bug 534425.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
That applies for layers. How will layers make it so we can do readback for a direct2d build, or a hypothetical cairo-gl build?
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Can you explain what you mean by 'implement readback in drawWindow'?
We need a way to, in drawWindow(), specify that, instead of rerendering using software, the drawWindow call should read back from whatever rendering system is currently in use, possibly involving a GPU->main memory copy. The reason this wouldn't be default would be because it could screw up the GPU pipeline/be slower than software. Only testing will discover whether it is, in fact, slower.

(We need this to test rendering quality of hardware accelerated backends.)
Short answer: it'll just work once your layer implementation implements BeginTransaction(gfxContext*).

Long answer: reftest.js passes DRAWWINDOW_USE_WIDGET_LAYERS to nsCanvasRenderingContext2D::DrawWindow. That forces DrawWindow (via nsLayoutUtils::PaintFrame) to use the widget layer manager with BeginTransaction(gfxContext*) to draw into the canvas. That should use the accelerated rendering path to render into a temporary buffer followed by a readback (if necessary) to draw into the target context.
Of course the canvas itself could be using an accelerated surface (e.g., D2D or caior-gl). In that case, the layer rendering wouldn't require a readback. Instead, nsDOMWindowUtils::CompareCanvases would do a readback via CanvasToImageSurface.
DRAWWINDOW_USE_WIDGET_LAYERS could be used by other callers, such as callers that want to generate a window thumbnail. Possibly we might need an additional flag to distinguish those callers (where software rendering would be acceptable) from reftests (where we really want the GPU rendering). But I'm skeptical --- let's wait and see the need before we add such a flag. (In fact, it's most likely that those callers will want their canvas surfaces to live in GPU memory, in which case there is no readback issue.)
What's the status of this?  From some of roc's comments at the last work week, I was under the impression that reftest (and thus drawWindow) are currently testing hardware acceleration code, when that feature is enabled.  Is that correct?
I'll re-close this. All the pieces are in place for reftests to test accelerated layer backends.
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.