Convert callers to BytesPerPixel() [chromium/src : main]

0 views
Skip to first unread message

Kyle Charbonneau (Gerrit)

unread,
Oct 31, 2025, 10:31:13 AM (6 days ago) Oct 31
to Colin Blundell, chromium...@chromium.org, Dirk Schulze, David Worsham, Robert Kroeger, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, emi...@google.com, fmalit...@chromium.org, fserb...@chromium.org, fuchsia...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from Colin Blundell

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Colin Blundell
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9407e7c8f6d0e7ade4f5c68c939048839f362af3
Gerrit-Change-Number: 7087047
Gerrit-PatchSet: 3
Gerrit-Owner: Kyle Charbonneau <kyle...@chromium.org>
Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Colin Blundell <blun...@chromium.org>
Gerrit-Comment-Date: Fri, 31 Oct 2025 14:31:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Colin Blundell (Gerrit)

unread,
Oct 31, 2025, 10:37:45 AM (6 days ago) Oct 31
to Kyle Charbonneau, Colin Blundell, chromium...@chromium.org, Dirk Schulze, David Worsham, Robert Kroeger, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, emi...@google.com, fmalit...@chromium.org, fserb...@chromium.org, fuchsia...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from Kyle Charbonneau

Colin Blundell voted and added 2 comments

Votes added by Colin Blundell

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Colin Blundell . resolved

Thanks!

File gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc
Line 666, Patchset 3 (Latest): int bytes_per_element = format.BytesPerPixel();
Colin Blundell . unresolved

This will now crash for ETC1 whereas the previous code would return null. Is that intentional, or do you know that this entrypoint will never be hit for ETC1? If you don't know that, maybe want to retain a check for ETC1 specifically that returns nullptr here?

Open in Gerrit

Related details

Attention is currently required from:
  • Kyle Charbonneau
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9407e7c8f6d0e7ade4f5c68c939048839f362af3
Gerrit-Change-Number: 7087047
Gerrit-PatchSet: 3
Gerrit-Owner: Kyle Charbonneau <kyle...@chromium.org>
Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Kyle Charbonneau <kyle...@chromium.org>
Gerrit-Comment-Date: Fri, 31 Oct 2025 14:37:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Kyle Charbonneau (Gerrit)

unread,
Oct 31, 2025, 10:47:32 AM (6 days ago) Oct 31
to Vasiliy Telezhnikov, Colin Blundell, chromium...@chromium.org, Dirk Schulze, David Worsham, Robert Kroeger, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, emi...@google.com, fmalit...@chromium.org, fserb...@chromium.org, fuchsia...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, spang...@chromium.org

Kyle Charbonneau added 1 comment

File gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc
Line 666, Patchset 3 (Latest): int bytes_per_element = format.BytesPerPixel();
Colin Blundell . resolved

This will now crash for ETC1 whereas the previous code would return null. Is that intentional, or do you know that this entrypoint will never be hit for ETC1? If you don't know that, maybe want to retain a check for ETC1 specifically that returns nullptr here?

Kyle Charbonneau

It's intentional. ETC1 is only used on Android so we can rule out D3DImageBacking from that. It's also not in [this list](https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc;l=145-146;drc=45a1118875a1b3a2a1ae9fee639cf1b546a43547) and there is no way to update ETC1 textures after creation so it would have to be.

ETC1 is only supported in WrappedSk/WrappedGraphite/GLTexture backings. I don't think we actually create GLTextureImageBacking with ETC1 anymore but the code exists and we'd have to verify it's unused.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9407e7c8f6d0e7ade4f5c68c939048839f362af3
    Gerrit-Change-Number: 7087047
    Gerrit-PatchSet: 3
    Gerrit-Owner: Kyle Charbonneau <kyle...@chromium.org>
    Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
    Gerrit-CC: David Worsham <dwor...@google.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Comment-Date: Fri, 31 Oct 2025 14:47:27 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Colin Blundell <blun...@chromium.org>
    satisfied_requirement
    open
    diffy

    Colin Blundell (Gerrit)

    unread,
    Oct 31, 2025, 10:50:06 AM (6 days ago) Oct 31
    to Kyle Charbonneau, Vasiliy Telezhnikov, Colin Blundell, chromium...@chromium.org, Dirk Schulze, David Worsham, Robert Kroeger, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, emi...@google.com, fmalit...@chromium.org, fserb...@chromium.org, fuchsia...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
    Attention needed from Kyle Charbonneau

    Colin Blundell added 1 comment

    File gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc
    Line 666, Patchset 3 (Latest): int bytes_per_element = format.BytesPerPixel();
    Colin Blundell . resolved

    This will now crash for ETC1 whereas the previous code would return null. Is that intentional, or do you know that this entrypoint will never be hit for ETC1? If you don't know that, maybe want to retain a check for ETC1 specifically that returns nullptr here?

    Kyle Charbonneau

    It's intentional. ETC1 is only used on Android so we can rule out D3DImageBacking from that. It's also not in [this list](https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc;l=145-146;drc=45a1118875a1b3a2a1ae9fee639cf1b546a43547) and there is no way to update ETC1 textures after creation so it would have to be.

    ETC1 is only supported in WrappedSk/WrappedGraphite/GLTexture backings. I don't think we actually create GLTextureImageBacking with ETC1 anymore but the code exists and we'd have to verify it's unused.

    Colin Blundell

    Great, thanks!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Kyle Charbonneau
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9407e7c8f6d0e7ade4f5c68c939048839f362af3
    Gerrit-Change-Number: 7087047
    Gerrit-PatchSet: 3
    Gerrit-Owner: Kyle Charbonneau <kyle...@chromium.org>
    Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
    Gerrit-CC: David Worsham <dwor...@google.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Kyle Charbonneau <kyle...@chromium.org>
    Gerrit-Comment-Date: Fri, 31 Oct 2025 14:49:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kyle Charbonneau <kyle...@chromium.org>
    Comment-In-Reply-To: Colin Blundell <blun...@chromium.org>
    satisfied_requirement
    open
    diffy

    Kyle Charbonneau (Gerrit)

    unread,
    Oct 31, 2025, 11:54:16 AM (6 days ago) Oct 31
    to Vasiliy Telezhnikov, Colin Blundell, chromium...@chromium.org, Dirk Schulze, David Worsham, Robert Kroeger, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, emi...@google.com, fmalit...@chromium.org, fserb...@chromium.org, fuchsia...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, spang...@chromium.org

    Kyle Charbonneau voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9407e7c8f6d0e7ade4f5c68c939048839f362af3
    Gerrit-Change-Number: 7087047
    Gerrit-PatchSet: 3
    Gerrit-Owner: Kyle Charbonneau <kyle...@chromium.org>
    Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
    Gerrit-Reviewer: Kyle Charbonneau <kyle...@chromium.org>
    Gerrit-CC: David Worsham <dwor...@google.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Comment-Date: Fri, 31 Oct 2025 15:54:11 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Oct 31, 2025, 12:50:42 PM (6 days ago) Oct 31
    to Kyle Charbonneau, Vasiliy Telezhnikov, Colin Blundell, chromium...@chromium.org, Dirk Schulze, David Worsham, Robert Kroeger, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, emi...@google.com, fmalit...@chromium.org, fserb...@chromium.org, fuchsia...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, spang...@chromium.org

    Chromium LUCI CQ submitted the change

    Change information

    Commit message:
    Convert callers to BytesPerPixel()

    All callers of SharedImageFormat::BitsPerPixel() that divide by 8 can
    just call BytesPerPixel(). That is all callers so this also removes
    BitsPerPixel().

    The only caller that isn't simply replacing BitsPerPixel() / 8 is
    TryAllocateSkDataForBitmap)(). The logic there was identical to
    EstimatedSizeInBytes() so that is used instead.
    Bug: 450804509
    Change-Id: I9407e7c8f6d0e7ade4f5c68c939048839f362af3
    Commit-Queue: Kyle Charbonneau <kyle...@chromium.org>
    Reviewed-by: Colin Blundell <blun...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1538665}
    Files:
    • M components/viz/common/resources/shared_image_format.cc
    • M components/viz/common/resources/shared_image_format.h
    • M gpu/command_buffer/service/shared_image/ahardwarebuffer_image_backing_factory.cc
    • M gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc
    • M gpu/command_buffer/service/shared_image/iosurface_image_backing.mm
    • M gpu/command_buffer/service/webgpu_decoder_impl.cc
    • M third_party/blink/renderer/core/html/canvas/canvas_rendering_context.cc
    • M third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
    • M ui/gfx/mac/io_surface.cc
    • M ui/ozone/platform/flatland/flatland_sysmem_buffer_collection.cc
    Change size: M
    Delta: 10 files changed, 13 insertions(+), 57 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Colin Blundell
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9407e7c8f6d0e7ade4f5c68c939048839f362af3
    Gerrit-Change-Number: 7087047
    Gerrit-PatchSet: 4
    Gerrit-Owner: Kyle Charbonneau <kyle...@chromium.org>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages