New issue
Advanced search Search tips

Issue 770422 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac , Fuchsia
Pri: 3
Type: Feature

Blocked on:
issue 754872
issue 760348



Sign in to add a comment

GLRenderer should try not to swizzle for SkBitmap copy requests

Project Member Reported by m...@chromium.org, Sep 30 2017

Issue description

When executing CopyOutputRequests that return SkBitmap results, there is some swizzle-to-native-Skia byte ordering code. However, it's very possible the OpenGL implementations on some (all?) platforms prefer the native Skia byte ordering anyway.

How it works today (two swizzles on the CPU!):

1. glReadPixels(in GL_RGBA format).
2. GPU natively uses BGRA ordering, and so the GPU driver must swizzle to RGBA ordering.
3. Code in our GLRenderer then swizzles back to BGRA (what Skia needs).

How it should work:

1. glReadPixels(in GL_BGRA_EXT format).
2. GPU natively uses BGRA ordering, and so the driver does NO swizzling.
3. Code in GLRenderer can do a straight memcpy() without swizzling too!

 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 2 2017

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

commit 349b1bf27a6b807c42155b895c4a9ef0a818f347
Author: Yuri Wiitala <miu@chromium.org>
Date: Mon Oct 02 20:29:11 2017

Expose GLHelperReadbackSupport to query for ideal readback configs.

This exposes the GLHelperReadbackSupport instance owned by a GLHelper so
that client code can query for platform-supported and performance-
optimal readback configurations.

This will be used for a number of things in soon-upcoming changes: 1) to
avoid unnecessary byte-order swizzling; 2) to avoid extra memcpy()'s in
GPU drivers. See crbug for further details.

Bug:  770422 
Change-Id: I544313f731b313c48f4d8198530e840559285157
Reviewed-on: https://chromium-review.googlesource.com/692853
Reviewed-by: Xiangjun Zhang <xjz@chromium.org>
Commit-Queue: Yuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505758}
[modify] https://crrev.com/349b1bf27a6b807c42155b895c4a9ef0a818f347/components/viz/common/gl_helper.cc
[modify] https://crrev.com/349b1bf27a6b807c42155b895c4a9ef0a818f347/components/viz/common/gl_helper.h

Project Member

Comment 2 by bugdroid1@chromium.org, Oct 25 2017

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

commit bab63555df3d1c31bfb96f14c8dae96ab773f65c
Author: Yuri Wiitala <miu@chromium.org>
Date: Wed Oct 25 00:19:37 2017

GLRendererCopier: Use optimal readback format.

Queries whether the GPU+driver internally use BGRA byte ordering and, if
so, uses that for readback. Otherwise, use the standard RGBA byte order.
This optimization prevents the need for extra memcpy/swizzling when
CopyOutputRequests produce SkBitmap results.

This change is also a prerequisite for a soon-upcoming change to add
I420 format readback to CopyOutputRequests.

Bug:  760351 , 770422 
Change-Id: I718401750470241e4188dfee2406867fa7293899
Reviewed-on: https://chromium-review.googlesource.com/731869
Commit-Queue: Yuri Wiitala <miu@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511317}
[modify] https://crrev.com/bab63555df3d1c31bfb96f14c8dae96ab773f65c/components/viz/service/display/gl_renderer_copier.cc
[modify] https://crrev.com/bab63555df3d1c31bfb96f14c8dae96ab773f65c/components/viz/service/display/gl_renderer_copier.h
[modify] https://crrev.com/bab63555df3d1c31bfb96f14c8dae96ab773f65c/components/viz/service/display/gl_renderer_copier_unittest.cc

Comment 3 by m...@chromium.org, Oct 25 2017

Status: Fixed (was: Assigned)
Components: -Internals>MUS Internals>Services>WindowService

Sign in to add a comment