summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-05-14 13:42:51 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-06-02 19:30:43 +0200
commitcffa75273cd367d41019995c2335241b8e349ef1 (patch)
tree2c24404a4c1d9c84bb4fcf1ca5b8ba0553f017fa
parent18d0aee33fd4a32f846475cf31a2be6499b17b4b (diff)
downloadlibva-intel-driver-cffa75273cd367d41019995c2335241b8e349ef1.tar.gz
libva-intel-driver-cffa75273cd367d41019995c2335241b8e349ef1.tar.bz2
libva-intel-driver-cffa75273cd367d41019995c2335241b8e349ef1.zip
surface: factor out release of surface buffer storage.
Introduce a new i965_destroy_surface_storage() helper function to unreference the underlying GEM buffer object, and any associated private data, if any. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r--src/i965_decoder_utils.c6
-rwxr-xr-xsrc/i965_drv_video.c14
-rw-r--r--src/i965_drv_video.h3
-rw-r--r--src/i965_output_dri.c6
4 files changed, 16 insertions, 13 deletions
diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
index f579f91..7ebc3fa 100644
--- a/src/i965_decoder_utils.c
+++ b/src/i965_decoder_utils.c
@@ -387,14 +387,10 @@ intel_update_avc_frame_store_index(VADriverContextP ctx,
obj_surface->flags &= ~SURFACE_REFERENCED;
if ((obj_surface->flags & SURFACE_ALL_MASK) == SURFACE_DISPLAYED) {
- dri_bo_unreference(obj_surface->bo);
- obj_surface->bo = NULL;
obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
+ i965_destroy_surface_storage(obj_surface);
}
- if (obj_surface->free_private_data)
- obj_surface->free_private_data(&obj_surface->private_data);
-
frame_store[i].surface_id = VA_INVALID_ID;
frame_store[i].frame_store_id = -1;
frame_store[i].obj_surface = NULL;
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 7a0320b..eb67f53 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -603,10 +603,11 @@ VAStatus i965_QueryConfigAttributes(VADriverContextP ctx,
return vaStatus;
}
-static void
-i965_destroy_surface(struct object_heap *heap, struct object_base *obj)
+void
+i965_destroy_surface_storage(struct object_surface *obj_surface)
{
- struct object_surface *obj_surface = (struct object_surface *)obj;
+ if (!obj_surface)
+ return;
dri_bo_unreference(obj_surface->bo);
obj_surface->bo = NULL;
@@ -615,7 +616,14 @@ i965_destroy_surface(struct object_heap *heap, struct object_base *obj)
obj_surface->free_private_data(&obj_surface->private_data);
obj_surface->private_data = NULL;
}
+}
+
+static void
+i965_destroy_surface(struct object_heap *heap, struct object_base *obj)
+{
+ struct object_surface *obj_surface = (struct object_surface *)obj;
+ i965_destroy_surface_storage(obj_surface);
object_heap_free(heap, obj);
}
diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
index 900aed9..44f61bf 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -428,4 +428,7 @@ extern VAStatus i965_DestroySurfaces(VADriverContextP ctx,
#define I965_SURFACE_MEM_GEM_FLINK 1
#define I965_SURFACE_MEM_DRM_PRIME 2
+void
+i965_destroy_surface_storage(struct object_surface *obj_surface);
+
#endif /* _I965_DRV_VIDEO_H_ */
diff --git a/src/i965_output_dri.c b/src/i965_output_dri.c
index 717ee9a..fdd69ce 100644
--- a/src/i965_output_dri.c
+++ b/src/i965_output_dri.c
@@ -209,12 +209,8 @@ i965_put_surface_dri(
obj_surface->flags |= SURFACE_DISPLAYED;
if ((obj_surface->flags & SURFACE_ALL_MASK) == SURFACE_DISPLAYED) {
- dri_bo_unreference(obj_surface->bo);
- obj_surface->bo = NULL;
obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
-
- if (obj_surface->free_private_data)
- obj_surface->free_private_data(&obj_surface->private_data);
+ i965_destroy_surface_storage(obj_surface);
}
_i965UnlockMutex(&i965->render_mutex);