<div dir="ltr">Hi Michel,<div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 12, 2016 at 7:02 PM, Leo Liu <span dir="ltr"><<a href="mailto:leo.liu@amd.com" target="_blank">leo.liu@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
On 09/12/2016 04:31 AM, Michel Dänzer wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 10/09/16 12:49 AM, Nayan Deshmukh wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In case of prime when rendering is done on GPU other then the<br>
server GPU, use a seprate linear buffer for each back buffer<br>
which will be displayed using present extension.<br>
<br>
v2: Use a seprate linear buffer for each back buffer (Michel)<br>
v3: change variable names and fix coding style (Leo and Emil)<br>
<br>
Signed-off-by: Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com" target="_blank">nayan26deshmukh@gmail.com</a>><br>
</blockquote>
[...]<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
@@ -226,8 +232,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)<br>
        goto close_fd;<br>
       memset(&templ, 0, sizeof(templ));<br>
-   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW |<br>
-                PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;<br>
+   templ.bind = PIPE_BIND_RENDER_TARGET;<br>
</blockquote>
I suspect PIPE_BIND_SAMPLER_VIEW is needed here as well, for when<br>
resource_copy_region ends up being a textured draw operation.<br>
<br>
<br></blockquote></div></div></blockquote><div>I will add this. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><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">
@@ -485,6 +513,16 @@ vl_dri3_flush_frontbuffer(stru<wbr>ct pipe_screen *screen,<br>
              return;<br>
     }<br>
  +   if (scrn->is_different_gpu) {<br>
+      u_box_origin_2d(scrn->width, scrn->height, &src_box);<br>
+      scrn->pipe->resource_copy_regi<wbr>on(scrn->pipe,<br>
+                                       back->linear_texture,<br>
+                                       0, 0, 0, 0,<br>
+                                       back->texture,<br>
+                                       0, &src_box);<br>
+<br>
+      scrn->pipe->flush(scrn->pipe, NULL, 0);<br>
+   }<br>
     xshmfence_reset(back->shm_fen<wbr>ce);<br>
     back->busy = true;<br>
  @@ -699,6 +733,9 @@ vl_dri3_screen_create(Display *display, int screen)<br>
     if (!scrn->base.pscreen)<br>
        goto release_pipe;<br>
  +   scrn->pipe = scrn->base.pscreen->context_cr<wbr>eate(scrn->base.pscreen,<br>
+                                                   &scrn->base, 0);<br>
</blockquote>
Hmm. AFAICT the callers of vl_dri3_flush_frontbuffer only flush their<br>
own context after calling it. Is there any guarantee that the rendering<br>
to back->texture is flushed before the resource_copy_region call above?<br>
</blockquote></div></div>
No.<br>
<br>
ST will call the flush that is only for copying to back buffer for presentation.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Either the callers need to be changed to flush before calling<br>
flush_frontbuffer, or the flush_frontbuffer hook might need to grow an<br>
optional context parameter for this, similar to resource_get_handle.<br>
<br>
<br></blockquote></span></blockquote><div>vl_winsys_dri3 is used by vdpau and va, so I can make them flush before calling</div><div>flush_frontbuffer. Adding a context argument will involve changes to a </div><div>lot of other files. </div><div><br></div><div>Regards,</div><div>Nayan.</div><div>  </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">
BTW, while looking into this, I noticed that vl_dri3_screen_create<br>
overrides the pipe_screen flush_frontbuffer hook with<br>
vl_dri3_flush_frontbuffer.<br>
</blockquote>
<br></span>
That's inherited from DRI2.<br>
<br>
Regards,<br>
Leo<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  That's a little ugly and would probably break<br>
with drivers whose flush_frontbuffer hook actually does something. At<br>
the very least, the vl_winsys_dri3.c code should save any previous hook<br>
and call down to it from vl_dri3_flush_frontbuffer.<br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>