<?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>71057</bug_id>
          
          <creation_ts>2011-10-27 13:19:50 -0700</creation_ts>
          <short_desc>[chromium] webkit_gpu_tests are flaky with --accelerated-drawing</short_desc>
          <delta_ts>2011-10-31 12:11:44 -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>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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>
          
          <blocked>70822</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Alok Priyadarshi">alokp</reporter>
          <assigned_to name="Alok Priyadarshi">alokp</assigned_to>
          <cc>jamesr</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>491861</commentid>
    <comment_count>0</comment_count>
    <who name="Alok Priyadarshi">alokp</who>
    <bug_when>2011-10-27 13:19:50 -0700</bug_when>
    <thetext>Accelerated drawing path does not reset the framebuffer state. It just deletes the temporary framebuffer. According to OpenGL spec, deleting a bound framebuffer should set the default frame buffer as current, but at least Mesa does not seem to do so. I think it is better to explicitly reset the framebuffer state.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492014</commentid>
    <comment_count>1</comment_count>
      <attachid>112767</attachid>
    <who name="Alok Priyadarshi">alokp</who>
    <bug_when>2011-10-27 15:24:28 -0700</bug_when>
    <thetext>Created attachment 112767
proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492983</commentid>
    <comment_count>2</comment_count>
    <who name="Alok Priyadarshi">alokp</who>
    <bug_when>2011-10-29 15:10:00 -0700</bug_when>
    <thetext>ping!

This needs to be committed before https://bugs.webkit.org/show_bug.cgi?id=70822.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492984</commentid>
    <comment_count>3</comment_count>
      <attachid>112767</attachid>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-10-29 15:15:28 -0700</bug_when>
    <thetext>Comment on attachment 112767
proposed patch

I don&apos;t think this is right. If there is a bug with our implementation of GraphicsContext3D we should fix that, no?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492985</commentid>
    <comment_count>4</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-10-29 15:15:49 -0700</bug_when>
    <thetext>I would suspect that this sort of things would be handled by the command buffer code, not osmesa.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492987</commentid>
    <comment_count>5</comment_count>
    <who name="Alok Priyadarshi">alokp</who>
    <bug_when>2011-10-29 15:35:17 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; I would suspect that this sort of things would be handled by the command buffer code, not osmesa.

I should have been clearer. According to the OpenGL spec, if a currently-bound FBO is deleted, the default framebuffer (id = 0) is bound. So it is the job of the underlying GL implementation (osmesa) in this case to implement the spec. I do not this GraphicsContext3D or command-buffer should do anything extra.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492988</commentid>
    <comment_count>6</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-10-29 15:38:34 -0700</bug_when>
    <thetext>I&apos;m not sure what point you are trying to make. I see code to handle deleting the currently bound framebuffer in GLES2DecoderImpl::DeleteFramebuffersHelper() and am pretty sure it&apos;s relevant here.

Whatever the issue, we shouldn&apos;t be working around it in WebKit we should fix it wherever the bug actually lies.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492992</commentid>
    <comment_count>7</comment_count>
    <who name="Alok Priyadarshi">alokp</who>
    <bug_when>2011-10-29 15:59:58 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; I&apos;m not sure what point you are trying to make. I see code to handle deleting the currently bound framebuffer in GLES2DecoderImpl::DeleteFramebuffersHelper() and am pretty sure it&apos;s relevant here.
&gt; 
&gt; Whatever the issue, we shouldn&apos;t be working around it in WebKit we should fix it wherever the bug actually lies.

If you read the OpenGL spec for glDeleteFrameBuffers (http://www.opengl.org/sdk/docs/man3/xhtml/glDeleteFramebuffers.xml), it says:

&quot;If a framebuffer that is currently bound to one or more of the targets GL_DRAW_FRAMEBUFFER or GL_READ_FRAMEBUFFER is deleted, it is as though glBindFramebuffer had been executed with the corresponding target and framebuffer zero.&quot;

Anyways my point is that the accelerated drawing path and Ganesh modify the currently bound framebuffer and do not restore it. We either restore it here or like other GL states do it in the LayerRendererChromium at the beginning of each frame. Doing it in LayerRendererChromium would be consistent with other GL states but unnecessary for the software path.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>492993</commentid>
    <comment_count>8</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-10-29 16:12:17 -0700</bug_when>
    <thetext>I still don&apos;t quite get it. Is the scenario you are concerned with that ganesh will think FB #3 is bound, this code will delete FB #4, which binds FB #0 and confuses ganesh? If so then your patch doesn&apos;t make much sense since it binds FB #0 explicitly. Is there some other failure scenario? An example would help.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>493417</commentid>
    <comment_count>9</comment_count>
    <who name="Alok Priyadarshi">alokp</who>
    <bug_when>2011-10-31 11:08:30 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; I&apos;m not sure what point you are trying to make. I see code to handle deleting the currently bound framebuffer in GLES2DecoderImpl::DeleteFramebuffersHelper() and am pretty sure it&apos;s relevant here.
&gt; 
&gt; Whatever the issue, we shouldn&apos;t be working around it in WebKit we should fix it wherever the bug actually lies.

I think you are right. Command buffer is internally using FBO=1 as the default render-surface for off-screen contexts, which it should bind when currently bound FBO is deleted. I have filed a bug here - crbug.com/102391

The reason this bug was only visible in layout tests and not chrome because layout-tests use an off-screen render surface. It was also not visible when render-to-texture was enabled because that code path explicitly binds FBO=0 when doing the final paint to the window.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>493438</commentid>
    <comment_count>10</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-10-31 12:11:44 -0700</bug_when>
    <thetext>OK, then when that&apos;s fixed we should be good to go without this patch. Thanks for tracing this down to the root cause.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>112767</attachid>
            <date>2011-10-27 15:24:28 -0700</date>
            <delta_ts>2011-10-29 15:15:28 -0700</delta_ts>
            <desc>proposed patch</desc>
            <filename>71057.patch</filename>
            <type>text/plain</type>
            <size>1590</size>
            <attacher name="Alok Priyadarshi">alokp</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDk4NjQ3KQorKysgU291cmNlL1dlYkNvcmUvQ2hhbmdl
TG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTUgQEAKKzIwMTEtMTAtMjcgIEFsb2sgUHJp
eWFkYXJzaGkgIDxhbG9rcEBjaHJvbWl1bS5vcmc+CisKKyAgICAgICAgW2Nocm9taXVtXSB3ZWJr
aXRfZ3B1X3Rlc3RzIGFyZSBmbGFreSB3aXRoIC0tYWNjZWxlcmF0ZWQtZHJhd2luZworICAgICAg
ICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9NzEwNTcKKworICAgICAg
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5mcmFtZWJ1ZmZlclRleHR1cmUyRChHcmFwaGljc0NvbnRleHQzRDo6
RlJBTUVCVUZGRVIsIEdyYXBoaWNzQ29udGV4dDNEOjpDT0xPUl9BVFRBQ0hNRU5UMCwgR3JhcGhp
Y3NDb250ZXh0M0Q6OlRFWFRVUkVfMkQsIDAsIDApOworICAgICAgICBtX2NvbnRleHQtPmJpbmRG
cmFtZWJ1ZmZlcihHcmFwaGljc0NvbnRleHQzRDo6RlJBTUVCVUZGRVIsIDApOwogICAgICAgICBt
X2NvbnRleHQtPmRlbGV0ZUZyYW1lYnVmZmVyKG1fZmJvKTsKKyAgICB9CiB9CiAKIFNrQ2FudmFz
KiBGcmFtZUJ1ZmZlcjo6aW5pdGlhbGl6ZShHcmFwaGljc0NvbnRleHQzRCogY29udGV4dCwgVGV4
dHVyZUFsbG9jYXRvciogYWxsb2NhdG9yLCBNYW5hZ2VkVGV4dHVyZSogdGV4dHVyZSkK
</data>
<flag name="review"
          id="110917"
          type_id="1"
          status="-"
          setter="jamesr"
    />
          </attachment>
      

    </bug>

</bugzilla>