<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 19, 2016 at 1:24 AM, Nicolai Hähnle <span dir="ltr"><<a href="mailto:nhaehnle@gmail.com" target="_blank">nhaehnle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 18.10.2016 19:23, Ian Romanick wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 09/29/2016 01:55 PM, Anutex wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I tried to debug this issue with changing the condition to check only bad magic and Error.<br>
And the test passed.<br>
<br>
Though i am not sure what is the correct behaviour if we are in this condition.<br>
May be we should make some other condition if the Hash Table have the bucket data.<br>
---<br>
src/glx/dri2_glx.c | 3 ++-<br>
1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c<br>
index af388d9..a1fd9ff 100644<br>
--- a/src/glx/dri2_glx.c<br>
+++ b/src/glx/dri2_glx.c<br>
@@ -411,12 +411,13 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable,<br>
return NULL;<br>
}<br>
<br>
- if (__glxHashInsert(pdp->dri2Hash<wbr>, xDrawable, pdraw)) {<br>
+ if (__glxHashInsert(pdp->dri2Hash<wbr>, xDrawable, pdraw) == -1) {<br></blockquote></blockquote></span></blockquote><div><br></div><div>Instead here can we implement some thing like</div><div>if already in table then get drawable and return it (As Ian told)</div><div>else destroy Drawables. (same as default)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote>
<br>
I'm not 100% sure the existing code is wrong. __glxHashInsert returns<br>
-1 for an error, and it returns 1 if the key is already in the hash<br>
table. In that case we'll leak the memory for the new pdraw, right?<br>
That also seems bad.<br>
<br>
It seems like instead the code should look up xDrawable in the hash<br>
table and return the value that's already there. Maybe. I haven't<br>
looked at this code in years, so I may be forgetting some subtlety.<br>
</blockquote>
<br></span>
dri2DestroyDrawable destroys the pdraw though. It also removes the xDrawable entry in the hash table without checking whether it points at pdraw or not, so on the surface that looks pretty bogus if we create a GLXDrawable twice.<br>
<br>
_However_, the real question is what the hash is used for in the first place. It looks to me like the hash is actually pretty pointless in the pixmap case. And it just so happens that the GLX spec forbids creating a GLXDrawable from a Window twice, but it doesn't forbid creating a GLXDrawable from a Pixmap twice.<br>
<br>
Then again, my GLX knowledge is basically zero, so what do I know :)<br>
<br>
Nicolai<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
(*psc->core->destroyDrawable) (pdraw->driDrawable);<br>
DRI2DestroyDrawable(psc-><wbr>base.dpy, xDrawable);<br>
free(pdraw);<br>
return None;<br>
}<br>
+ <br>
<br>
</blockquote>
<br>
Spurious whitespace change.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/*<br>
* Make sure server has the same swap interval we do for the new<br>
<br>
</blockquote>
<br></span>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
<br>
</blockquote>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks,</div><div><span style="font-size:12.8px">Rahul jain</span><br></div></div></div>
</div></div>