Bug 163439 - [Cairo] REGRESSION(r206481): GraphicsContext3D::ImageExtractor fails to extract images
Summary: [Cairo] REGRESSION(r206481): GraphicsContext3D::ImageExtractor fails to extra...
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords: Regression
Depends on:
Blocks:
 
Reported: 2016-10-14 01:58 PDT by Zan Dobersek
Modified: 2017-03-11 10:46 PST (History)
6 users (show)

See Also:


Attachments
Patch (1.99 KB, patch)
2016-10-14 02:04 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch for landing (2.06 KB, patch)
2016-10-14 02:16 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2016-10-14 01:58:47 PDT
[Cairo] GraphicsContext3D::ImageExtractor fails to extract images
Comment 1 Zan Dobersek 2016-10-14 02:04:31 PDT
Created attachment 291597 [details]
Patch
Comment 2 Carlos Garcia Campos 2016-10-14 02:06:56 PDT
Comment on attachment 291597 [details]
Patch

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

> Source/WebCore/ChangeLog:14
> +        In the Cairo implementation of GraphicsContext3D::ImageExtractor,
> +        don't check for frame completeness at index 0. This information
> +        is now cached only after the frame for that index is decoded and
> +        marked as completed, which is done after this check.
> +
> +        Becuase of this the current check forces extractImage() to return
> +        early and abort WebGL texture uploads from image sources.

If this a recent regression after the image decoder refactorings? it would be great to mention a revision in the commit message, so that I'll know in the future that I don't need this in any stable branch.
Comment 3 Zan Dobersek 2016-10-14 02:13:39 PDT
It was probably introduced in r206481.
https://trac.webkit.org/changeset/206481
Comment 4 Zan Dobersek 2016-10-14 02:16:55 PDT
Created attachment 291600 [details]
Patch for landing
Comment 5 Zan Dobersek 2016-10-14 02:20:34 PDT
Comment on attachment 291600 [details]
Patch for landing

Clearing flags on attachment: 291600

Committed r207332: <http://trac.webkit.org/changeset/207332>
Comment 6 Zan Dobersek 2016-10-14 02:20:42 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Said Abou-Hallawa 2016-10-14 09:58:02 PDT
(In reply to comment #3)
> It was probably introduced in r206481.
> https://trac.webkit.org/changeset/206481

Yes this is true. In this change I made frameIsCompleteAtIndex() reads whatever in the cache without having to ask the decoder about the completeness of the frame and without trying to cache a new frame.

The reason for this change is this information is mainly useful to the ImageFrameCache. It can be sued to decide whether we can use the current frame or we need to try recaching a new one. For other places of the code like GraphicsContext3D::ImageExtractor, it should not matter whether the frame is complete or not. The completeness of a frame represents whether the frame image can fully or partially displayed. And we need to display it even if it is partially decoded.
Comment 8 Said Abou-Hallawa 2016-10-14 10:00:11 PDT
Comment on attachment 291597 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        marked as completed, which is done after this check.

What are the repro steps of this bug? Can't we include a test case in this patch?
Comment 9 Said Abou-Hallawa 2016-10-14 10:11:32 PDT
Comment on attachment 291597 [details]
Patch

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

> Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp:226
> -        if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
> +        if (!decoder.frameCount())

The function GraphicsContext3D::ImageExtractor::extractImage() in WebCore/platform/graphics/cg/GraphicsContext3D.cpp does not have the check decoder.frameIsCompleteAtIndex(). 

But the function GraphicsContext3D::ImageExtractor::extractImage() in WebCore/platform/graphics/efl/GraphicsContext3D.cpp does have the check decoder.frameIsCompleteAtIndex(). 

        if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
            return false;

I think we need to apply the same fix there as well. Maybe we need to move some of the code of this function to the cross platform file: WebCore/platform/graphics/GraphicsContext3D.cpp to avoid repeating the code and avoid fixing the same bug in different places.
Comment 10 Said Abou-Hallawa 2016-10-14 10:15:41 PDT
Reopening the bug to apply the same fix to the elf port and to add a test if possible.
Comment 11 Zan Dobersek 2016-10-18 00:05:07 PDT
(In reply to comment #8)
> Comment on attachment 291597 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=291597&action=review
> 
> > Source/WebCore/ChangeLog:11
> > +        marked as completed, which is done after this check.
> 
> What are the repro steps of this bug? Can't we include a test case in this
> patch?

This is reproducible by running any WebGL example that does texture uploads from an image source (specifically image, canvas or video elements). There's plenty of tests for that, but the EFL and GTK+ ports probably didn't catch them because they either don't run those tests, or don't compare pixel results from these tests.

This problem should have stored a relevant error on the GraphicsContext3D object, but I suppose again the ports don't run a test which would propagate this problem into a test failure.