Bug 257452 - Row byte count is not available in GraphicsContextGL::computeImageSizeBytes
Summary: Row byte count is not available in GraphicsContextGL::computeImageSizeBytes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks: 252876
  Show dependency treegraph
 
Reported: 2023-05-29 04:52 PDT by Kimmo Kinnunen
Modified: 2023-06-06 09:36 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2023-05-29 04:52:39 PDT
Row byte count is not available in GraphicsContextGL::computeImageSizeBytes

Needed for GPUP implementation when computing readPixels pixel rectangle byte size
Comment 1 Radar WebKit Bug Importer 2023-05-29 04:53:02 PDT
<rdar://problem/109969560>
Comment 2 Kimmo Kinnunen 2023-05-29 05:03:38 PDT
Pull request: https://github.com/WebKit/WebKit/pull/14450
Comment 3 EWS 2023-06-01 07:33:23 PDT
Committed 264794@main (19a2252db08c): <https://commits.webkit.org/264794@main>

Reviewed commits have been landed. Closing PR #14450 and removing active labels.
Comment 4 Michael Catanzaro 2023-06-05 06:08:47 PDT
Why is the test for bmalloc::roundUpToMultipleOfNonPowerOfTwo guarded by #if !USE(CAIRO)? That seems useful to test unconditionally?
Comment 5 Kimmo Kinnunen 2023-06-05 09:02:34 PDT
Wincairo doesn’t build with bmalloc in include path
Comment 6 Michael Catanzaro 2023-06-05 09:27:15 PDT
Ah, because bmalloc does not work on Windows. I would change that to OS(WINDOWS) then. Cairo is used on Linux too, and this code has nothing to do with Cairo.
Comment 7 Michael Catanzaro 2023-06-06 05:45:16 PDT
Oh, the other problem is bmalloc is just not in the include path on any platform. This broke JSCOnly builds.
Comment 8 Kimmo Kinnunen 2023-06-06 05:48:09 PDT
> Oh, the other problem is bmalloc is just not in the include path on any platform. This broke JSCOnly builds.

I think it passed all the tested builds.

Would it be possible to close this bug and fix whatever other build configurations in a subsequent bug?
Comment 9 Michael Catanzaro 2023-06-06 05:59:31 PDT
So the header that the test is trying to use is: Source/bmalloc/bmalloc/Algorithm.h. This directory is added to bmalloc_PRIVATE_INCLUDE_DIRECTORIES in Source/bmalloc/CMakeLists.txt in order to ensure it's not available to higher layers that depend on the bmalloc framework. We have no other tests that depend on bmalloc except for Tools/TestWebKitAPI/Tests/WTF/bmalloc/IsoHeap.cpp, which is never built because it's not added to any CMakeLists.txt (a common problem in TestWebKitAPI).

It's an intentional attempt to ensure that higher layers cannot use the bmalloc headers, but blocking ourselves from testing bmalloc does not seem useful. I see TestWebKit depends on many private framework headers:

    set(TestWebKit_PRIVATE_INCLUDE_DIRECTORIES
        ${CMAKE_BINARY_DIR}
        ${JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS_DIR}
        ${PAL_FRAMEWORK_HEADERS_DIR}
        ${TESTWEBKITAPI_DIR}
        ${WebCore_PRIVATE_FRAMEWORK_HEADERS_DIR}
        ${WebKit_FRAMEWORK_HEADERS_DIR}
    )

but TestWebCore and TestWTF do not. Don, Fujii, is this intentional? Are you trying to remove them? OK for me to just add the required include dir to TestWTF? It would conspicuously be the only such include directory, which seems pretty suspicious.

(In reply to Michael Catanzaro from comment #6)
> Ah, because bmalloc does not work on Windows. I would change that to
> OS(WINDOWS) then. Cairo is used on Linux too, and this code has nothing to
> do with Cairo.

Let's try #if !USE(SYSTEM_MALLOC).
Comment 10 Michael Catanzaro 2023-06-06 06:01:13 PDT
(In reply to Kimmo Kinnunen from comment #8)
> Would it be possible to close this bug and fix whatever other build
> configurations in a subsequent bug?

I don't care too much whether we use this bug or a new bug. I generally use the original bug for build failures because it's easier than reporting a new bug, and to keep discussion of the patch and its fix in one place.
Comment 11 Michael Catanzaro 2023-06-06 06:05:20 PDT
(In reply to Kimmo Kinnunen from comment #8)
> I think it passed all the tested builds.

Problem is the JSCOnly builders are all macOS bots using XCode build. There are post-commit JSCOnly Linux bots that are currently green, but I'm not sure how that's possible. Maybe they are not building TestWTF?
Comment 12 Michael Catanzaro 2023-06-06 07:16:34 PDT
OK, I've tried building locally to reproduce this problem and was unable to do so: the bmalloc include directory really does somehow get added to my JSCOnly build. So I'm just going to land a small follow-up to change the preprocessor guards.

I'll open a new bug for the missing include directory if I can figure out how to trigger it.
Comment 13 Michael Catanzaro 2023-06-06 07:18:27 PDT
Pull request: https://github.com/WebKit/WebKit/pull/14695
Comment 14 Michael Catanzaro 2023-06-06 08:01:28 PDT
(In reply to Michael Catanzaro from comment #12)
> I'll open a new bug for the missing include directory if I can figure out
> how to trigger it.

I figured it out: the build was failing when built with USE_SYSTEM_MALLOC because bmalloc was not built but was used unconditionally. So my pull request above is actually sufficient to fix things.
Comment 15 EWS 2023-06-06 09:36:21 PDT
Committed 264902@main (bdfef46eb471): <https://commits.webkit.org/264902@main>

Reviewed commits have been landed. Closing PR #14695 and removing active labels.