New issue
Advanced search Search tips

Issue 867601 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 30
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocked on:
issue 789232

Blocking:
issue 839970
issue 789232



Sign in to add a comment

Canvas 2D lowlatency on CrOs doesn't show anything on the screen

Project Member Reported by mcasas@chromium.org, Jul 25

Issue description

This is a sister-splinter bug of  https://crbug.com/867025#c1  for Canvas 2D
versions.

Steps to repro:

Compile and run a ToT (r577574) simplechrome on nautilus (or eve), with chrome:flags
  enable-experimental-web-platform-features
set to "enabled"

And with the lines around [0] commented out:
  // TODO( crbug.com/789232 ): Make low latency mode work with GPU acceleration
  if (LowLatencyEnabled())
    return false;

then: Navigate to https://codepen.io/miguelao/pen/EReOgO
which essentially does:

  var ctx = canvas.getContext('2d', {lowLatency: true});
  function draw_lines() {
    # Set color and line width. Then paint a line from and to a random location.
    ctx.moveTo(Math.random() * width, Math.random() * height);
    ctx.lineTo(Math.random() * width, Math.random() * height);
    ctx.stroke(); // Draw it
  }
  setTimeout( draw_lines, 5000 )

nothing shows up on the screen. There's a correct callstack to FinalizeFrame()
that ends up in CanvasResourceProviderTextureGpuMemoryBuffer::ProduceFrame.


The same codepen works: draws a random (random shade of green, random start and
end points) line  every 5s,  when removing {lowLatency: true}.


[0] https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc?gsn=ShouldAccelerate2dContext&g=0&l=972

 
Blocking: 789232
Labels: OS-Chrome
Related to  crbug.com/789232 : we have to enable Gpu acceleration for low
latency to work.
Blocking: 839970
Cc: tbuck...@chromium.org
Adding the trace of the codepen in https://codepen.io/miguelao/pen/EReOgO
manipulated to draw every 500ms; categories: bilnk, drm, viz.
trace_lowlatency_canvas_2d_lines_every_half_second.json.gz
2.0 MB Download
Blockedon: 789232
Project Member

Comment 6 by bugdroid1@chromium.org, Jul 27

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b63360e2a16d03144d748ff4179339fde2217c27

commit b63360e2a16d03144d748ff4179339fde2217c27
Author: Justin Novosad <junov@chromium.org>
Date: Fri Jul 27 00:04:53 2018

Fix low latency 2D canvas updates

The code was failing to flush deferred rendering commands recorded
by Canvas2DLayerBridge before dispatching animation frames.

This CL does not fix the problem completely: there is still an issue
when the canvas is not gpu-accelerated

BUG= 867601 

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I32db0759af549ec6cd09ca677fff4ee215cae49e
Reviewed-on: https://chromium-review.googlesource.com/1152028
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Commit-Queue: Justin Novosad <junov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578493}
[modify] https://crrev.com/b63360e2a16d03144d748ff4179339fde2217c27/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
[modify] https://crrev.com/b63360e2a16d03144d748ff4179339fde2217c27/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h

Owner: mcasas@chromium.org
Status: Assigned (was: Available)
Low latency 2D canvas now uses gpu acceleration by default and that code path works.  The non-accelerated code path is still broken.  That code path uses shared memory bitmaps to push frames to the GPU process.  Based on trace graph observations, it look like the frames are indeed being dispatched to the GPU process, and the display compositor is getting triggered, but it exits rapidly (35 microseconds).  I have not had time to fully investigate, but I have a hunch that the an early exit condition is getting triggered in the display compositor.

If we don't find a fix for this in a timely manner, plan B would be to force canvases to be GPU-accelerated (and remain GPU-accelerated) when low latency mode is requested, and to not enter low latency mode on systems that do not support gpu-accelerated 2d canvas, or if the canvas surface allocation falls back to software mode (e.g. out of GPU memory, max texture size exceeded, etc.)
Status: Fixed (was: Assigned)

Sign in to add a comment