Bug 238775 - GraphicsContextGL subclasses should be able to supply a custom IOSurfacePool
Summary: GraphicsContextGL subclasses should be able to supply a custom IOSurfacePool
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-04 16:20 PDT by Simon Fraser (smfr)
Modified: 2022-04-05 09:18 PDT (History)
12 users (show)

See Also:


Attachments
Patch (7.12 KB, patch)
2022-04-04 16:22 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (7.11 KB, patch)
2022-04-04 17:54 PDT, Simon Fraser (smfr)
kkinnunen: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2022-04-04 16:20:51 PDT
GraphicsContextGL subclasses should be able to supply a custom IOSurfacePool
Comment 1 Simon Fraser (smfr) 2022-04-04 16:22:45 PDT
Created attachment 456645 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2022-04-04 16:24:37 PDT
<rdar://problem/91267303>
Comment 3 Tim Horton 2022-04-04 17:54:12 PDT
Comment on attachment 456645 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=456645&action=review

> Source/WebCore/html/canvas/WebGLRenderingContextBase.h:418
> +    IOSurfacePool* ioSurfacePool() const override;

Is this not a teensy bit of a layering violation?
Comment 4 Simon Fraser (smfr) 2022-04-04 17:54:38 PDT
Created attachment 456654 [details]
Patch
Comment 5 Simon Fraser (smfr) 2022-04-04 22:40:22 PDT
(In reply to Tim Horton from comment #3)
> Comment on attachment 456645 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=456645&action=review
> 
> > Source/WebCore/html/canvas/WebGLRenderingContextBase.h:418
> > +    IOSurfacePool* ioSurfacePool() const override;
> 
> Is this not a teensy bit of a layering violation?

Perhaps; ideally we'd have a way to allow all platforms to recycle their buffers, accelerated or not.
Comment 6 Kimmo Kinnunen 2022-04-04 23:49:54 PDT
Comment on attachment 456654 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=456654&action=review

> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:8180
> +IOSurfacePool* WebGLRenderingContextBase::ioSurfacePool() const

I don't think this is a WebGLRenderingContextBase property, especially currently if all it can do is to have global pool.
My mind should, the polymorphism in  be provided at the level where the context is being created, e.g. it would be a GraphicsContextGLCocoa constructor parameter.

> Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:578
> +    auto backing = IOSurface::create(ioSurfacePool, getInternalFramebufferSize(), DestinationColorSpace::SRGB());

If preserving current behaviour is not an explicit goal, I think better first step commit would be to unilaterally just pass nullptr here.

- WebGL-in-WP reuses surfaces internally

- WebGL-in-GPUP does not have pool in this commit

- IOSurfacePool is not entirely correct
Comment 7 Kimmo Kinnunen 2022-04-04 23:53:43 PDT
Comment on attachment 456654 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=456654&action=review

>> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:8180
>> +IOSurfacePool* WebGLRenderingContextBase::ioSurfacePool() const
> 
> I don't think this is a WebGLRenderingContextBase property, especially currently if all it can do is to have global pool.
> My mind should, the polymorphism in  be provided at the level where the context is being created, e.g. it would be a GraphicsContextGLCocoa constructor parameter.

And not a GraphicsContextGL::Client property, either)
Comment 8 Simon Fraser (smfr) 2022-04-05 09:18:37 PDT
I'll just leave the existing code alone.