<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>56414</bug_id>
          
          <creation_ts>2011-03-15 14:04:29 -0700</creation_ts>
          <short_desc>texImage2D gets old contents of canvas</short_desc>
          <delta_ts>2011-03-16 22:55:13 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="John Bauman">jbauman</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cmarrin</cc>
    
    <cc>commit-queue</cc>
    
    <cc>hyatt</cc>
    
    <cc>jamesr</cc>
    
    <cc>jbauman</cc>
    
    <cc>kbr</cc>
    
    <cc>senorblanco</cc>
    
    <cc>zmo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>367934</commentid>
    <comment_count>0</comment_count>
    <who name="John Bauman">jbauman</who>
    <bug_when>2011-03-15 14:04:29 -0700</bug_when>
    <thetext>Currently we don&apos;t seem to be marking the copied image of a canvas as dirty when we&apos;re doing accelerated rendering, causing a texImage2D on the canvas to possibly get old data.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368018</commentid>
    <comment_count>1</comment_count>
    <who name="John Bauman">jbauman</who>
    <bug_when>2011-03-15 16:13:01 -0700</bug_when>
    <thetext>Looks like we&apos;re checking paintsIntoCanvasBuffer to see if we should do paintRenderingResultsToCanvas to update the image. This is true on chromium with accelerated compositing disabled (like in this test), so the paint doesn&apos;t happen.

I&apos;m not sure what exactly paintsIntoCanvasBuffer is supposed to mean, but removing the check for it in HTMLCanvasElement::copiedImage seems to work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368058</commentid>
    <comment_count>2</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2011-03-15 17:11:00 -0700</bug_when>
    <thetext>Do you happen to know whether it&apos;s broken when passing a 2D-rendered Canvas to WebGL via texImage2D, when passing a WebGL-rendered Canvas to WebGL via texImage2D, or both?

For the WebGL case, https://bugs.webkit.org/show_bug.cgi?id=56431 will affect the behavior here, though we can fix this bug independently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368064</commentid>
    <comment_count>3</comment_count>
    <who name="John Bauman">jbauman</who>
    <bug_when>2011-03-15 17:16:51 -0700</bug_when>
    <thetext>I haven&apos;t tested reading from 2D-rendered Canvas, but I think that may be broken when the canvas is GPU-accelerated. An unaccelerated canvas should work fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368582</commentid>
    <comment_count>4</comment_count>
      <attachid>85986</attachid>
    <who name="John Bauman">jbauman</who>
    <bug_when>2011-03-16 15:23:37 -0700</bug_when>
    <thetext>Created attachment 85986
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368590</commentid>
    <comment_count>5</comment_count>
      <attachid>85986</attachid>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-03-16 15:30:50 -0700</bug_when>
    <thetext>Comment on attachment 85986
Patch

This seems correct to me.  Should we have a more direct test for this? fast/canvas/webgl/premultiplyalpha-test.html seems to test a bunch of other stuff as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368591</commentid>
    <comment_count>6</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-03-16 15:31:23 -0700</bug_when>
    <thetext>It looks like this will never change behavior for the Mac port since paintsIntoCanvasBuffer() always returns false on mac for WebGL content.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368595</commentid>
    <comment_count>7</comment_count>
    <who name="John Bauman">jbauman</who>
    <bug_when>2011-03-16 15:37:28 -0700</bug_when>
    <thetext>Right, the test already passes on Macs. The patch might change something on Qt, but hopefully it will change it to do the right thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368640</commentid>
    <comment_count>8</comment_count>
    <who name="Stephen White">senorblanco</who>
    <bug_when>2011-03-16 16:48:09 -0700</bug_when>
    <thetext>Is it possible this fix would break (or slow down) accelerated canvas2D -&gt; canvas2D draws?  (the amazon shelf demo used to be a good test of this, but unfortunately it&apos;s not available anymore).

This seems to end up here:

bool GraphicsContext3DInternal::paintsIntoCanvasBuffer() const
{
    // If the gpu compositor is on then skip the readback and software rendering path.
    return !m_webViewImpl-&gt;isAcceleratedCompositingActive();
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368650</commentid>
    <comment_count>9</comment_count>
    <who name="John Bauman">jbauman</who>
    <bug_when>2011-03-16 16:54:04 -0700</bug_when>
    <thetext>HTMLCanvasElement::paint still checks paintsIntoCanvasBuffer, so that won&apos;t be affected. canvas2D-&gt;canvas2D drawImages go down a different path (not using copiedImage, but instead manually doing makeRenderingResultsAvailable if the canvas isn&apos;t accelerated), so they shouldn&apos;t change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368658</commentid>
    <comment_count>10</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-03-16 17:05:05 -0700</bug_when>
    <thetext>canvas2d-&gt;canvas2d on chromium/skia uses this:
http://trac.webkit.org/browser/trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp#L1267

which does the readback if needed and then does this:
http://trac.webkit.org/browser/trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp#L118

which should still do the right thing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368669</commentid>
    <comment_count>11</comment_count>
    <who name="Stephen White">senorblanco</who>
    <bug_when>2011-03-16 17:20:45 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; canvas2d-&gt;canvas2d on chromium/skia uses this:
&gt; http://trac.webkit.org/browser/trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp#L1267
&gt; 
&gt; which does the readback if needed and then does this:
&gt; http://trac.webkit.org/browser/trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp#L118
&gt; 
&gt; which should still do the right thing

Right, thanks.  This change makes more sense to me now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368795</commentid>
    <comment_count>12</comment_count>
      <attachid>85986</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-03-16 20:56:28 -0700</bug_when>
    <thetext>Comment on attachment 85986
Patch

Clearing flags on attachment: 85986

Committed r81317: &lt;http://trac.webkit.org/changeset/81317&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368796</commentid>
    <comment_count>13</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-03-16 20:56:34 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>368842</commentid>
    <comment_count>14</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-03-16 22:55:13 -0700</bug_when>
    <thetext>The commit-queue encountered the following flaky tests while processing attachment 85986:

fast/workers/storage/use-same-database-in-page-and-workers.html bug 50995 (author: dumi@chromium.org)
The commit-queue is continuing to process your patch.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>85986</attachid>
            <date>2011-03-16 15:23:37 -0700</date>
            <delta_ts>2011-03-16 20:56:28 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-56414-20110316152336.patch</filename>
            <type>text/plain</type>
            <size>3158</size>
            <attacher name="John Bauman">jbauman</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogODEyMTMKZGlmZiAtLWdpdCBhL0xheW91dFRlc3RzL0NoYW5n
ZUxvZyBiL0xheW91dFRlc3RzL0NoYW5nZUxvZwppbmRleCBlNzkxNzIxMTAyMDkyNmI1MWI4Njc2
NWQzNjgzMDIxN2M4YjcyZDlhLi4yZjg0NzVjMDEwYjE1NDg1OTNiOWEyNmU0YmQ0ZjEyYzk0ZTIx
ZGNjIDEwMDY0NAotLS0gYS9MYXlvdXRUZXN0cy9DaGFuZ2VMb2cKKysrIGIvTGF5b3V0VGVzdHMv
Q2hhbmdlTG9nCkBAIC0xLDMgKzEsMTIgQEAKKzIwMTEtMDMtMTYgIEpvaG4gQmF1bWFuICA8amJh
dW1hbkBjaHJvbWl1bS5vcmc+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISku
CisKKyAgICAgICAgdGV4SW1hZ2UyRCBnZXRzIG9sZCBjb250ZW50cyBvZiBjYW52YXMKKyAgICAg
ICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTU2NDE0CisKKyAgICAg
ICAgKiBwbGF0Zm9ybS9jaHJvbWl1bS90ZXN0X2V4cGVjdGF0aW9ucy50eHQ6IHByZW11bHRpcGx5
LWFscGhhIHRlc3Qgbm93IHdvcmtzCisKIDIwMTEtMDMtMTUgIEpvaG4gQmF1bWFuICA8amJhdW1h
bkBjaHJvbWl1bS5vcmc+CiAKICAgICAgICAgUmV2aWV3ZWQgYnkgS2VubmV0aCBSdXNzZWxsLgpk
aWZmIC0tZ2l0IGEvTGF5b3V0VGVzdHMvcGxhdGZvcm0vY2hyb21pdW0vdGVzdF9leHBlY3RhdGlv
bnMudHh0IGIvTGF5b3V0VGVzdHMvcGxhdGZvcm0vY2hyb21pdW0vdGVzdF9leHBlY3RhdGlvbnMu
dHh0CmluZGV4IGFiZ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fQogICAgIHJldHVy
biBtX2NvcGllZEltYWdlLmdldCgpOwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>