<?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>98518</bug_id>
          
          <creation_ts>2012-10-05 07:18:12 -0700</creation_ts>
          <short_desc>[Qt][WK2] Plugins are completely broken with a custom device pixel ratio</short_desc>
          <delta_ts>2012-10-29 07:15:01 -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>Plug-ins</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>
          
          <blocked>98528</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Balazs Kelemen">kbalazs</reporter>
          <assigned_to name="Balazs Kelemen">kbalazs</assigned_to>
          <cc>abecsi</cc>
    
    <cc>cmarcelo</cc>
    
    <cc>jesus</cc>
    
    <cc>jturcotte</cc>
    
    <cc>menard</cc>
    
    <cc>webkit.review.bot</cc>
    
    <cc>zoltan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>735620</commentid>
    <comment_count>0</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-05 07:18:12 -0700</bug_when>
    <thetext>Currently this is the case in MiniBrowser because it defines 1.5 as device pixel ratio. My goal currently is just to handle this case. We will probably have to return to this if we want to support plugins not just on the desktop.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>735627</commentid>
    <comment_count>1</comment_count>
      <attachid>167326</attachid>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-05 07:28:10 -0700</bug_when>
    <thetext>Created attachment 167326
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>735670</commentid>
    <comment_count>2</comment_count>
      <attachid>167326</attachid>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-10-05 08:56:26 -0700</bug_when>
    <thetext>Comment on attachment 167326
Patch

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

&gt; Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp:91
&gt; -    // See &lt;https://bugs.webkit.org/show_bug.cgi?id=64663&gt;.
&gt; -    notImplemented();
&gt; +    QImage image = createQImage();
&gt; +    QPainter* painter = context.platformContext();
&gt; +
&gt; +    painter-&gt;save();
&gt; +    painter-&gt;scale(scaleFactor, scaleFactor);
&gt; +    painter-&gt;drawImage(dstPoint, image, QRect(srcRect));
&gt; +    painter-&gt;restore();

why not do a fast path for  scaleFactor == 1.0?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>735698</commentid>
    <comment_count>3</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-05 09:26:41 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 167326 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=167326&amp;action=review
&gt; 
&gt; &gt; Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp:91
&gt; &gt; -    // See &lt;https://bugs.webkit.org/show_bug.cgi?id=64663&gt;.
&gt; &gt; -    notImplemented();
&gt; &gt; +    QImage image = createQImage();
&gt; &gt; +    QPainter* painter = context.platformContext();
&gt; &gt; +
&gt; &gt; +    painter-&gt;save();
&gt; &gt; +    painter-&gt;scale(scaleFactor, scaleFactor);
&gt; &gt; +    painter-&gt;drawImage(dstPoint, image, QRect(srcRect));
&gt; &gt; +    painter-&gt;restore();
&gt; 
&gt; why not do a fast path for  scaleFactor == 1.0?

It&apos;s already there :) (above the changed lines)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>735704</commentid>
    <comment_count>4</comment_count>
      <attachid>167326</attachid>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2012-10-05 09:29:54 -0700</bug_when>
    <thetext>Comment on attachment 167326
Patch

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

&gt;&gt;&gt; Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp:91
&gt;&gt;&gt; +    painter-&gt;restore();
&gt;&gt; 
&gt;&gt; why not do a fast path for  scaleFactor == 1.0?
&gt; 
&gt; It&apos;s already there :) (above the changed lines)

Is it possible somehow to use the GraphicsContext3D to use the hardware for scaling? iguess you are basically scaling an image right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>735716</commentid>
    <comment_count>5</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-05 09:40:02 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; (From update of attachment 167326 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=167326&amp;action=review
&gt; 
&gt; &gt;&gt;&gt; Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp:91
&gt; &gt;&gt;&gt; +    painter-&gt;restore();
&gt; &gt;&gt; 
&gt; &gt;&gt; why not do a fast path for  scaleFactor == 1.0?
&gt; &gt; 
&gt; &gt; It&apos;s already there :) (above the changed lines)
&gt; 
&gt; Is it possible somehow to use the GraphicsContext3D to use the hardware for scaling? iguess you are basically scaling an image right?

Yep, but we do software rendering here by design. The backing store is a shared memory buffer. Probably we could utilize ShareableSurface to make this accelerated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>735724</commentid>
    <comment_count>6</comment_count>
      <attachid>167326</attachid>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-05 09:51:06 -0700</bug_when>
    <thetext>Comment on attachment 167326
Patch

Clearing flags on attachment: 167326

Committed r130519: &lt;http://trac.webkit.org/changeset/130519&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>735725</commentid>
    <comment_count>7</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-05 09:51:11 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>738939</commentid>
    <comment_count>8</comment_count>
    <who name="Andras Becsi">abecsi</who>
    <bug_when>2012-10-10 07:21:23 -0700</bug_when>
    <thetext>Since r130630 applies the device pixel ratio as a UI-side scale in the desktop webview plugins seem to be scaled twice, this issue seems to be fixes if reverting this change.
Can you check, and confirm this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>741504</commentid>
    <comment_count>9</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-13 12:07:31 -0700</bug_when>
    <thetext>*** Bug 94821 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>745258</commentid>
    <comment_count>10</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-18 08:09:31 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; Since r130630 applies the device pixel ratio as a UI-side scale in the desktop webview plugins seem to be scaled twice, this issue seems to be fixes if reverting this change.
&gt; Can you check, and confirm this?

First of all, if I simply revert it than we will not paint at all again, so I think you mean we should ignore the scale factor.

It seems to be more complicated. Now the plugin is overscaled. Actually now I think that my code is wrong, we should scale the image, not the context (or we can emulate scaling the image with coordinate transform on the context to be faster). However, if I change it like that it doesn&apos;t help.

If I ignore the scaleFactor at all, it&apos;s better but still not perfect. I&apos;m not sure about what is wrong in this case, but the buttons at the bottom of the video don&apos;t show up because the video covers that area as well and there are glitches in the video (maybe it&apos;s a missing clip or smg).

If I change PluginProxy::contentScaleFactor to return constant 1, than it&apos;s shown correctly. We should find out what&apos;s the difference between us and mac. Actually by reading the code it seems to me that the scale is really applied twice in PluginProxy, so I will take a look at it on Mac.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>745263</commentid>
    <comment_count>11</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-18 08:14:54 -0700</bug_when>
    <thetext>Filed bug 9722 for the overscaling.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>745276</commentid>
    <comment_count>12</comment_count>
      <attachid>167326</attachid>
    <who name="Jocelyn Turcotte">jturcotte</who>
    <bug_when>2012-10-18 08:28:14 -0700</bug_when>
    <thetext>Comment on attachment 167326
Patch

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

&gt; Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp:89
&gt; +    painter-&gt;scale(scaleFactor, scaleFactor);

What if you just don&apos;t scale it here?
I don&apos;t really understand all this code, but it seems like this shareablebitmap is the backing store of the plugin view and it is already scaled by PluginProxy, no?
Also, does this mean that the plugin backing store isn&apos;t a layer by itself? Does it get re-blitted on every tile of the non-composited content for every update of the plugin?

It&apos;s unlikely that we&apos;ll have a plugin big enough to need tiling, so why not pass the shareablebitmap directly to the ui process like we do for CoordinatedGraphicsLayer::setContentsToImage?

Anyway this is just food for thought, if we can just fix the scaling issue I&apos;d be pretty happy too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>745293</commentid>
    <comment_count>13</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-18 08:50:56 -0700</bug_when>
    <thetext>(In reply to comment #12)
&gt; (From update of attachment 167326 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=167326&amp;action=review
&gt; 
&gt; &gt; Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp:89
&gt; &gt; +    painter-&gt;scale(scaleFactor, scaleFactor);
&gt; 
&gt; What if you just don&apos;t scale it here?

This is the case when the panel at the bottom does not shown up.

&gt; I don&apos;t really understand all this code, but it seems like this shareablebitmap is the backing store of the plugin view and it is already scaled by PluginProxy, no?

PluginProxy has an m_pluginBackingStore, this is the shared memory the plugin process paints onto, and m_backingStore which is shared between the UI and the web process. m_pluginBackingStore is getting blitted to m_backingStore in update. For me it also seems to be that the scaleFactor is applied multiple times: first in the plugin process, than when we blit, than when we blit m_backingStore to the graphicsContext in paint. I have no clue how could this work on mac.

&gt; Also, does this mean that the plugin backing store isn&apos;t a layer by itself? Does it get re-blitted on every tile of the non-composited content for every update of the plugin?

I guess this is the case with the tiles covering the plugin but I&apos;m not sure.

&gt; 
&gt; It&apos;s unlikely that we&apos;ll have a plugin big enough to need tiling, so why not pass the shareablebitmap directly to the ui process like we do for CoordinatedGraphicsLayer::setContentsToImage?

Sounds good but I need to investigate more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>746132</commentid>
    <comment_count>14</comment_count>
    <who name="Jocelyn Turcotte">jturcotte</who>
    <bug_when>2012-10-19 01:45:29 -0700</bug_when>
    <thetext>(In reply to comment #13)
&gt; I have no clue how could this work on mac.

It&apos;s possible that they&apos;re now always using CA layers in their case (just a guess).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>753405</commentid>
    <comment_count>15</comment_count>
    <who name="Balazs Kelemen">kbalazs</who>
    <bug_when>2012-10-29 07:15:01 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; Filed bug 9722 for the overscaling.

it&apos;s bug 99722</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>167326</attachid>
            <date>2012-10-05 07:28:10 -0700</date>
            <delta_ts>2012-10-18 08:28:14 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-98518-20121005162712.patch</filename>
            <type>text/plain</type>
            <size>1776</size>
            <attacher name="Balazs Kelemen">kbalazs</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTMwNTAwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0Mi9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViS2l0Mi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