Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Canvas rendering project

Josh Matthews edited this pageFeb 14, 2018 ·2 revisions

Simplify the 2d canvas renderer

Background information: The HTML specification defines a<canvas> element that can use a 2d or 3d rendering context. Servo's implementation contains several inefficiencies that make some websites perform slowly or run out of memory when performing complex canvas operations. The goal of this project is to make these websites perform better when loaded in Servo.

Tracking issues (please ask questions here):

Initial steps:

  • email themozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions
  • create a testcase that contains two canvases and uses thedrawImage API to draw the contents of one canvas onto the other. Programmatically measure the time this operation takes.
  • To prepare for the big switch from 1 threads per canvas to 1 thread for all canvases, add astruct CanvasId(u64) type tocomponents/canvas_traits/canvas.rs and add aCanvasId member to each variant of theCanvasMsg enum.
  • add aCanvasId member toConstellation incomponents/constellation/constellation.rs which is initialized to 0 and increased by 1 each timehandle_create_canvas_paint_thread is called.
  • make theresponse_sender argument ofhandle_create_canvas_paint_thread also include the newCanvasId value, and pass it as an argument toCanvasPaintThread::start. Store the id when it is received for use in all canvas messages.
  • For eachCanvasMsg that is processed byCanvasPaintThread, verify that the id received matches the id that was provided toCanvasPaintThread::start

Subsequent steps:

  • extract the innards ofCanvasPaintThread into aCanvasData structure,
  • makeCanvasPaintThread store a hashtable of CanvasId->CanvasData
  • as part ofConstellation::start, create a canvas paint thread and store the channel to communicate with it as a member ofConstellation. Remove the initial canvas id from the API ofConstellation::start.
  • whenhandle_create_canvas_paint_thread is invoked, communicate with the canvas thread and have it create a new entry in the hashtable.
  • when the canvas thread receives a message, perform the operation on the appropriate canvas according to the provided id
  • optimize the DrawImageInOther operation by drawing on the destination canvas directly, rather than relying on sending a message to another canvas thread. Remove the now-unnecessaryIpcSender from theDrawImageInOther enum variant. Verify that the earlier testcase demonstrates a performance improvement.
  • report on how slither.io performs in Servo after all these changes

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp