Hi Zhao,<div><br></div><div>Thx for the answer. Here are the reason why I moved the safety to app handling:</div><div><br></div><div>Use case is gstreamer-vaapi:</div><div>Ex: gstvaapipostproc ! dmabuf_rgbx ! glimagesink</div><div><br></div><div>Vpp output a rgbx va surface and export it as dmabuf with vaAcquireBufferHandle. As it manages a pool of gst buffers, it exports N surface only one time when starting. So that when processing (feeding output va surfaces) they are already exported. Which means derived first.</div><div> </div><div>II think it is more efficient than releasing/ re-exporting each time. And it seems this is how gstreamer-vaapi is designed. </div><div>I can try to see if I can still free the derived image + calling vaReleaseBufferHandle but keep the FD valid in the gst buffer for usage along the run . And still be able to import it through eglcreateimage in glimagesink.</div><div><br></div><div>Cheers</div><div>Julien</div><div><br><br>On Tuesday, 29 September 2015, Zhao Yakui <<a href="mailto:yakui.zhao@intel.com">yakui.zhao@intel.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 09/29/2015 06:05 AM, Julien Isorce wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
is_surface_busy looks for locked or derived.<br>
If VPP and surface is not locked it should only check fail<br>
for derived if it is not exported to dmabuf.<br>
<br>
XXX: maybe checking CODEC_PROC + not locked is enough<br>
to allow processing.<br>
</blockquote>
<br>
Hi, Julien<br>
<br>
What is the main concern of checking the surface_busy for VPP? what is the usage scenario?<br>
<br>
When one surface is exported or derived, maybe other components are using them. In such case it is difficult to synchronize between multiple components. So currently it uses the safe mode to assure that the surface is not accessed.<br>
<br>
If you want to use the derived surface for the further VPP, I suggest that you can free the derived image.<br>
<br>
thanks.<br>
Yakui<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Signed-off-by: Julien Isorce<<a>j.isorce@samsung.com</a>><br>
---<br>
src/i965_drv_video.c | 24 ++++++++++++++++++++++--<br>
1 file changed, 22 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c<br>
index bf599d6..0d6f513 100644<br>
--- a/src/i965_drv_video.c<br>
+++ b/src/i965_drv_video.c<br>
@@ -2610,8 +2610,28 @@ i965_BeginPicture(VADriverContextP ctx,<br>
obj_config = obj_context->obj_config;<br>
ASSERT_RET(obj_config, VA_STATUS_ERROR_INVALID_CONFIG);<br>
<br>
- if (is_surface_busy(i965, obj_surface))<br>
- return VA_STATUS_ERROR_SURFACE_BUSY;<br>
+ if (obj_context->codec_type == CODEC_PROC) {<br>
+ if (obj_surface->locked_image_id != VA_INVALID_ID)<br>
+ return VA_STATUS_ERROR_SURFACE_BUSY;<br>
+<br>
+ if (obj_surface->derived_image_id != VA_INVALID_ID) {<br>
+ /* Allow derived surface exported to dmabuf. */<br>
+ struct object_buffer *obj_buffer = NULL;<br>
+ struct object_image *obj_image = IMAGE(obj_surface->derived_image_id);<br>
+ if (!obj_image)<br>
+ return VA_STATUS_ERROR_INVALID_IMAGE;<br>
+<br>
+ obj_buffer = BUFFER(obj_image->image.buf);<br>
+ if (!obj_buffer)<br>
+ return VA_STATUS_ERROR_INVALID_BUFFER;<br>
+<br>
+ if (obj_buffer->export_state.mem_type != VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME)<br>
+ return VA_STATUS_ERROR_SURFACE_BUSY;<br>
+ }<br>
+ } else {<br>
+ if (is_surface_busy(i965, obj_surface))<br>
+ return VA_STATUS_ERROR_SURFACE_BUSY;<br>
+ }<br>
<br>
if (obj_context->codec_type == CODEC_PROC) {<br>
obj_context->codec_state.proc.current_render_target = render_target;<br>
</blockquote>
<br>
</blockquote></div>