<div dir="ltr">Yes please. Thx<div>Julien</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 October 2015 at 19:12, Christian König <span dir="ltr"><<a href="mailto:deathsimple@vodafone.de" target="_blank">deathsimple@vodafone.de</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 29.10.2015 18:40, Julien Isorce wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If formats are not the same vlVaPutImage re-creates the video<br>
buffer with the right format. But if the creation of this new<br>
video buffer fails then the surface looses its current buffer.<br>
Let's just destroy the previous buffer on success.<br>
<br>
Signed-off-by: Julien Isorce <<a href="mailto:j.isorce@samsung.com" target="_blank">j.isorce@samsung.com</a>><br>
</blockquote>
<br></span>
Reviewed-by: Christian König <<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.com</a>><br>
<br>
Should I push the patches already reviewed?<br>
<br>
Regards,<br>
Christian.<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">
---<br>
src/gallium/state_trackers/va/image.c | 19 +++++++++++++------<br>
1 file changed, 13 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c<br>
index 84d94c8..8e64673 100644<br>
--- a/src/gallium/state_trackers/va/image.c<br>
+++ b/src/gallium/state_trackers/va/image.c<br>
@@ -346,13 +346,20 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image,<br>
if (format == PIPE_FORMAT_NONE)<br>
return VA_STATUS_ERROR_OPERATION_FAILED;<br>
- if (surf->buffer == NULL || format != surf->buffer->buffer_format) {<br>
- if (surf->buffer)<br>
- surf->buffer->destroy(surf->buffer);<br>
+ if (format != surf->buffer->buffer_format) {<br>
+ struct pipe_video_buffer *tmp_buf;<br>
+ enum pipe_format old_surf_format = surf->templat.buffer_format;<br>
+<br>
surf->templat.buffer_format = format;<br>
- surf->buffer = drv->pipe->create_video_buffer(drv->pipe, &surf->templat);<br>
- if (!surf->buffer)<br>
- return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
+ tmp_buf = drv->pipe->create_video_buffer(drv->pipe, &surf->templat);<br>
+<br>
+ if (!tmp_buf) {<br>
+ surf->templat.buffer_format = old_surf_format;<br>
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
+ }<br>
+<br>
+ surf->buffer->destroy(surf->buffer);<br>
+ surf->buffer = tmp_buf;<br>
}<br>
views = surf->buffer->get_sampler_view_planes(surf->buffer);<br>
</blockquote>
<br></div></div><div class="HOEnZb"><div class="h5">
_______________________________________________<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="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div>