<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
There are a couple of other issues from a brief test:<br>
<br>
1. Compile warnings for presentation.c.<br>
<br>
2. When window resized, it's showing corruption, and sometimes
corruption will stay.<br>
<br>
Regards,<br>
Leo<br>
<br>
<br>
<div class="moz-cite-prefix">On 10/24/2016 11:27 AM, Nayan Deshmukh
wrote:<br>
</div>
<blockquote
cite="mid:CAFd4ddz4Dygvq0GS7YsKWNLUkWBH5DgvFu1VJnu69Jr_042Okw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Oct 24, 2016 at 8:48 PM,
Christian König <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:deathsimple@vodafone.de" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:deathsimple@vodafone.de">deathsimple@vodafone.de</a></a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Nice
work, have you been able to fix all the issues you
mentioned on your last mail?<br>
<br>
</blockquote>
<div>Yes, it fixes all the known issues. But I have only
tested it on my system. </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Additional to that make sure that this set also keeps DRI2
working, in patch #2 it looks like you call the new
function without checking if it's available or not. </blockquote>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>
</blockquote>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Keep in
mind that we possible compile both DRI2 and DRI3 into the
driver, but it can happen that we fallback to DRI2 on
runtime.<br>
<br>
</blockquote>
<div>I missed this case, it will won't work if we fallback
to DRI2 on runtime I will send a v2 to take care of this. </div>
<div><br>
</div>
<div>Regards,</div>
<div>Nayan.</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Regards,<br>
Christian.
<div class="HOEnZb">
<div class="h5"><br>
<br>
Am 24.10.2016 um 15:55 schrieb Nayan Deshmukh:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Suggested-by: Leo Liu <<a moz-do-not-send="true"
href="mailto:leo.liu@amd.com" target="_blank">leo.liu@amd.com</a>><br>
Signed-off-by: Nayan Deshmukh <<a
moz-do-not-send="true"
href="mailto:nayan26deshmukh@gmail.com"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:nayan26deshmukh@gmail.com">nayan26deshmukh@gmail.com</a></a>><br>
---<br>
src/gallium/auxiliary/vl/vl_wi<wbr>nsys.h |
4 ++<br>
src/gallium/auxiliary/vl/vl_wi<wbr>nsys_dri3.c |
89 +++++++++++++++++++++++++++---<wbr>-<br>
2 files changed, 83 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/gallium/auxiliary/vl/vl_<wbr>winsys.h
b/src/gallium/auxiliary/vl/vl_<wbr>winsys.h<br>
index 26db9f2..7c56b48 100644<br>
--- a/src/gallium/auxiliary/vl/vl_<wbr>winsys.h<br>
+++ b/src/gallium/auxiliary/vl/vl_<wbr>winsys.h<br>
@@ -59,6 +59,10 @@ struct vl_screen<br>
void *<br>
(*get_private)(struct vl_screen *vscreen);<br>
+ void<br>
+ (*set_output_texture)(struct vl_screen *vscreen,
struct pipe_resource *buffer,<br>
+ uint32_t width, uint32_t
height);<br>
+<br>
struct pipe_screen *pscreen;<br>
struct pipe_loader_device *dev;<br>
};<br>
diff --git a/src/gallium/auxiliary/vl/vl_<wbr>winsys_dri3.c
b/src/gallium/auxiliary/vl/vl_<wbr>winsys_dri3.c<br>
index 2929928..44d6f4c 100644<br>
--- a/src/gallium/auxiliary/vl/vl_<wbr>winsys_dri3.c<br>
+++ b/src/gallium/auxiliary/vl/vl_<wbr>winsys_dri3.c<br>
@@ -56,6 +56,7 @@ struct vl_dri3_buffer<br>
struct xshmfence *shm_fence;<br>
bool busy;<br>
+ bool is_external_texture;<br>
uint32_t width, height, pitch;<br>
};<br>
@@ -71,6 +72,9 @@ struct vl_dri3_screen<br>
xcb_special_event_t *special_event;<br>
struct pipe_context *pipe;<br>
+ struct pipe_resource *output_texture;<br>
+ uint32_t output_texture_width;<br>
+ uint32_t output_texture_height;<br>
struct vl_dri3_buffer
*back_buffers[BACK_BUFFER_NUM]<wbr>;<br>
int cur_back;<br>
@@ -105,7 +109,8 @@ dri3_free_back_buffer(struct
vl_dri3_screen *scrn,<br>
xcb_free_pixmap(scrn->conn,
buffer->pixmap);<br>
xcb_sync_destroy_fence(scrn-><wbr>conn,
buffer->sync_fence);<br>
xshmfence_unmap_shm(buffer->s<wbr>hm_fence);<br>
- pipe_resource_reference(&buff<wbr>er->texture,
NULL);<br>
+ if (!buffer->is_external_texture)<br>
+ pipe_resource_reference(&buffe<wbr>r->texture,
NULL);<br>
if (buffer->linear_texture)<br>
pipe_resource_reference(&buff<wbr>er->linear_texture,
NULL);<br>
FREE(buffer);<br>
@@ -236,13 +241,24 @@ dri3_alloc_back_buffer(struct
vl_dri3_screen *scrn)<br>
templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;<br>
templ.target = PIPE_TEXTURE_2D;<br>
templ.last_level = 0;<br>
- templ.width0 = scrn->width;<br>
- templ.height0 = scrn->height;<br>
+ if (scrn->output_texture) {<br>
+ templ.width0 =
(scrn->output_texture_width) ?<br>
+ scrn->output_texture_width
:<br>
+
scrn->output_texture->width0;<br>
+ templ.height0 =
(scrn->output_texture_height) ?<br>
+
scrn->output_texture_height :<br>
+
scrn->output_texture->height0;<br>
+ } else {<br>
+ templ.width0 = scrn->width;<br>
+ templ.height0 = scrn->height;<br>
+ }<br>
templ.depth0 = 1;<br>
templ.array_size = 1;<br>
if (scrn->is_different_gpu) {<br>
- buffer->texture =
scrn->base.pscreen->resource_c<wbr>reate(scrn->base.pscreen,<br>
+ buffer->texture =
(scrn->output_texture) ?<br>
+ scrn->output_texture :<br>
+
scrn->base.pscreen->resource_c<wbr>reate(scrn->base.pscreen,<br>
&templ);<br>
if (!buffer->texture)<br>
goto unmap_shm;<br>
@@ -257,7 +273,9 @@ dri3_alloc_back_buffer(struct
vl_dri3_screen *scrn)<br>
goto no_linear_texture;<br>
} else {<br>
templ.bind |= PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED;<br>
- buffer->texture =
scrn->base.pscreen->resource_c<wbr>reate(scrn->base.pscreen,<br>
+ buffer->texture =
(scrn->output_texture) ?<br>
+ scrn->output_texture :<br>
+
scrn->base.pscreen->resource_c<wbr>reate(scrn->base.pscreen,<br>
&templ);<br>
if (!buffer->texture)<br>
goto unmap_shm;<br>
@@ -271,11 +289,20 @@ dri3_alloc_back_buffer(struct
vl_dri3_screen *scrn)<br>
usage);<br>
buffer_fd = whandle.handle;<br>
buffer->pitch = whandle.stride;<br>
+ buffer->width = templ.width0;<br>
+ buffer->height = templ.height0;<br>
+ buffer->is_external_texture =
(scrn->output_texture) ?<br>
+ true :<br>
+ false;<br>
+ scrn->output_texture = NULL;<br>
+ scrn->output_texture_width = 0;<br>
+ scrn->output_texture_height = 0;<br>
+<br>
xcb_dri3_pixmap_from_buffer(s<wbr>crn->conn,<br>
(pixmap =
xcb_generate_id(scrn->conn)),<br>
scrn->drawable,<br>
0,<br>
- scrn->width,
scrn->height, buffer->pitch,<br>
+ buffer->width,
buffer->height, buffer->pitch,<br>
scrn->depth, 32,<br>
buffer_fd);<br>
xcb_dri3_fence_from_fd(scrn-><wbr>conn,<br>
@@ -287,8 +314,6 @@ dri3_alloc_back_buffer(struct
vl_dri3_screen *scrn)<br>
buffer->pixmap = pixmap;<br>
buffer->sync_fence = sync_fence;<br>
buffer->shm_fence = shm_fence;<br>
- buffer->width = scrn->width;<br>
- buffer->height = scrn->height;<br>
xshmfence_trigger(buffer-><wbr>shm_fence);<br>
@@ -310,6 +335,7 @@ dri3_get_back_buffer(struct
vl_dri3_screen *scrn)<br>
{<br>
struct vl_dri3_buffer *buffer;<br>
struct pipe_resource *texture = NULL;<br>
+ bool allocate_new_buffer = false;<br>
assert(scrn);<br>
@@ -318,8 +344,30 @@ dri3_get_back_buffer(struct
vl_dri3_screen *scrn)<br>
return NULL;<br>
buffer = scrn->back_buffers[scrn->cur_b<wbr>ack];<br>
- if (!buffer || buffer->width !=
scrn->width ||<br>
- buffer->height != scrn->height) {<br>
+ /* This is normal case when our buffer is
smaller<br>
+ * than the screen this will be same for
external<br>
+ * texture<br>
+ */<br>
+ if (!buffer || buffer->width <
scrn->width ||<br>
+ buffer->height < scrn->height)<br>
+ allocate_new_buffer = true;<br>
+<br>
+ /* If we were using a external texture buffer
and<br>
+ * the texture is not provided then we need a
new<br>
+ * buffer<br>
+ */<br>
+ if (buffer &&
buffer->is_external_texture &&<br>
+ !scrn->output_texture)<br>
+ allocate_new_buffer = true;<br>
+<br>
+ /* In case of a single gpu we need to get the<br>
+ * handle and pixmap for the texture that is set<br>
+ */<br>
+ if (buffer &&
buffer->is_external_texture &&<br>
+ !scrn->is_different_gpu)<br>
+ allocate_new_buffer = true;<br>
+<br>
+ if (allocate_new_buffer) {<br>
struct vl_dri3_buffer *new_buffer;<br>
new_buffer = dri3_alloc_back_buffer(scrn);<br>
@@ -332,6 +380,13 @@ dri3_get_back_buffer(struct
vl_dri3_screen *scrn)<br>
vl_compositor_reset_dirty_area<wbr>(&scrn->dirty_areas[scrn->cur_<wbr>back]);<br>
buffer = new_buffer;<br>
scrn->back_buffers[scrn->cur_b<wbr>ack]
= buffer;<br>
+ } else if (buffer->is_external_texture) {<br>
+ /* In case of different gpu we can reuse the
linear<br>
+ * texture so we only need to set the
external<br>
+ * texture for copying<br>
+ */<br>
+ buffer->texture = scrn->output_texture;<br>
+ scrn->output_texture = NULL;<br>
}<br>
pipe_resource_reference(&text<wbr>ure,
buffer->texture);<br>
@@ -627,6 +682,19 @@ vl_dri3_screen_get_private(str<wbr>uct
vl_screen *vscreen)<br>
}<br>
static void<br>
+vl_dri3_screen_set_output_tex<wbr>ture(struct
vl_screen *vscreen, struct pipe_resource *buffer,<br>
+ uint32_t width, uint32_t
height)<br>
+{<br>
+ struct vl_dri3_screen *scrn = (struct
vl_dri3_screen *)vscreen;<br>
+<br>
+ assert(scrn);<br>
+<br>
+ scrn->output_texture = buffer;<br>
+ scrn->output_texture_width = width;<br>
+ scrn->output_texture_height = height;<br>
+}<br>
+<br>
+static void<br>
vl_dri3_screen_destroy(struct vl_screen *vscreen)<br>
{<br>
struct vl_dri3_screen *scrn = (struct
vl_dri3_screen *)vscreen;<br>
@@ -744,6 +812,7 @@ vl_dri3_screen_create(Display
*display, int screen)<br>
scrn->base.set_next_timestamp =
vl_dri3_screen_set_next_timest<wbr>amp;<br>
scrn->base.get_private =
vl_dri3_screen_get_private;<br>
scrn->base.pscreen->flush_fro<wbr>ntbuffer
= vl_dri3_flush_frontbuffer;<br>
+ scrn->base.set_output_texture =
vl_dri3_screen_set_output_text<wbr>ure;<br>
return &scrn->base;<br>
<br>
</blockquote>
<br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>