<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<small>Hello Everyone, 2D-Dev Group<br>
<br>
I continued to inspect the bug : JDK-8044788: [D3D] Clip is
ignored during Surface > Sw Blit issue.<br>
Link : <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://bugs.openjdk.java.net/browse/JDK-8044788">https://bugs.openjdk.java.net/browse/JDK-8044788</a><br>
<br>
Here is a quick brief on root cause, solutions experimented and
the webrev link for review.<br>
Kindly go through each of these items and provide your review so
that we could check-in the bug fix.<br>
<br>
Root Cause:<br>
1. D3DSurfaceToSw Blit does not pass clip value to the native cpp
interface<br>
2. Even if the clip were to be passed through JNI, the native
interface ignores the clip because it uses d3d's StretRect API.<br>
3. Henceforth, in the current implementation, clipping in
SurfaceToSw usecase will work ' only ' for Rect bounds provided
proper src(x, y), dst(x, y), width and height are provided.<br>
4. It can be noted that : the proper src(x, y), dst(x, y) are also
not calculated considering the intersection of these rectangles
with the clip bounds.<br>
<br>
Different Solutions & Results<br>
1. Three solutions are feasible to fix this issue:<br>
a. Solution 1: Convert the input Surface to Sysmem image,
followed by regular Blit. To optimize this further, the conversion
can be taken up only for Shape clips.<br>
b. Solution 2: Using existing classes in D3DBlitLoops,
execute SwToSurface (copy dest to accel Surface), SurfaceToSurface
(supports clip), SurfaceToSw (full copy) in order.<br>
c. Solution 3: Modify the native side interfaces to accept
clip and execute Solution2 's logic in native code.<br>
2. Upon various experiments, Solution 1 has been found to be
faster than the rest.<br>
a. This can be attributed to fewer draw /or copy
iterations compared to the other two solutions.<br>
b. In addition to the above fact, the code retains the
same approach as used by the OGL pipeline making it easier to
understand.<br>
<br>
Webrev Link: <font color="#000099"><a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~psadhukhan/prahlad/webrev.00/">http://cr.openjdk.java.net/~psadhukhan/prahlad/webrev.00/</a></font><br>
Sufficient comments have been added so that developers could
easily get understanding of the issue and solution checked in.<br>
<br>
Thank you<br>
Have a great day<br>
<br>
Prahalad N.<br>
<br>
</small><br>
<br>
<div class="moz-forward-container">
<div class="moz-forward-container">
<div class="moz-forward-container">
<table class="moz-email-headers-table" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
</th>
<td>Re: [OpenJDK 2D-Dev] Review Request: (JDK-8044788)
[D3D] clip is ignored during surface->sw blit</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date:
</th>
<td>Wed, 15 Apr 2015 16:17:37 +0300</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">From:
</th>
<td>Sergey Bylokhov <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:Sergey.Bylokhov@oracle.com"><Sergey.Bylokhov@oracle.com></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">To:
</th>
<td>prasanta sadhukhan <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:prasanta.sadhukhan@oracle.com"><prasanta.sadhukhan@oracle.com></a>,
<a moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:2d-dev@openjdk.java.net">2d-dev@openjdk.java.net</a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Hi, Prasanta.
The same approach was used in OGL pipeline for the reason. Because we
use glReadPixels and there is no way to apply the clip. So we read
pixels to the temporary buffer and apply the clip later. Can you
additionaly investigate is it possible to apply the clip in d3d directly
or not?
Note that this [1] comment is not correct in d3d, because d3d have only
one direct blit D3d surface -> SW which is D3DSurfaceToSwBlit(IntArgb,
ST_INT_ARGB), all other blits will be done via temporary buffer in
D3DGeneralBlit.
[1]
> 523 // We can convert argb_pre data from D3d surface in two
> places:
> 524 // - During D3d surface -> SW blit
> 525 // - During SW -> SW blit
> 526 // The first one is faster when we use opaque D3d
> surface, because in
> 527 // this case we simply skip conversion and use color
> components as is.
> 528 // Because of this we align intermediate buffer type with
> type of
> 529 // destination not source.
On 15.04.15 11:57, prasanta sadhukhan wrote:
> Hi,
>
> I would like a review for a solution of this bug in jdk9.
> The clip was ignored during surface->sw blit in d3d pipeline. The fix
> is to use the clip parameter to calculate the blit coordinates correctly.
>
> Bug: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-8044788">https://bugs.openjdk.java.net/browse/JDK-8044788</a>
> webrev: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/%7Epsadhukhan/8044788/webrev.00/">http://cr.openjdk.java.net/~psadhukhan/8044788/webrev.00/</a>
>
> Regards
> Prasanta
--
Best regards, Sergey.
</pre>
<br>
</div>
<br>
<br>
</div>
<br>
<br>
</div>
<br>
</body>
</html>