diff options
author | Christian König <[email protected]> | 2011-04-25 11:39:41 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-04-25 11:39:41 +0200 |
commit | 5aa26412432dbdb3b1677d6d2f74bba010f443ae (patch) | |
tree | 5e5da42fff8a67102c1305a6ee2ce86121996297 /src/gallium/state_trackers/vdpau | |
parent | 7cde6722b01732e5a897771b56bf8d13719153ec (diff) |
vdpau: implement and cleanup PresentationQueueTarget destruction
Diffstat (limited to 'src/gallium/state_trackers/vdpau')
-rw-r--r-- | src/gallium/state_trackers/vdpau/device.c | 29 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/htab.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/presentation.c | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/vdpau_private.h | 2 |
4 files changed, 39 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c index 7906757ec1b..b3de0f29305 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -27,9 +27,12 @@ #include <pipe/p_compiler.h> #include <pipe/p_video_context.h> -#include <vl_winsys.h> + #include <util/u_memory.h> #include <util/u_debug.h> + +#include <vl_winsys.h> + #include "vdpau_private.h" PUBLIC VdpStatus @@ -94,8 +97,8 @@ PUBLIC VdpStatus vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable, VdpPresentationQueueTarget *target) { - VdpStatus ret; - vlVdpPresentationQueueTarget *pqt = NULL; + vlVdpPresentationQueueTarget *pqt; + VdpStatus ret; debug_printf("[VDPAU] Creating PresentationQueueTarget\n"); @@ -122,11 +125,28 @@ vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable, return VDP_STATUS_OK; no_handle: - FREE(dev); + FREE(pqt); return ret; } VdpStatus +vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queue_target) +{ + vlVdpPresentationQueueTarget *pqt; + + debug_printf("[VDPAU] Destroying PresentationQueueTarget\n"); + + pqt = vlGetDataHTAB(presentation_queue_target); + if (!pqt) + return VDP_STATUS_INVALID_HANDLE; + + vlRemoveDataHTAB(presentation_queue_target); + FREE(pqt); + + return VDP_STATUS_OK; +} + +VdpStatus vlVdpDeviceDestroy(VdpDevice device) { debug_printf("[VDPAU] Destroying destroy\n"); @@ -134,6 +154,7 @@ vlVdpDeviceDestroy(VdpDevice device) vlVdpDevice *dev = vlGetDataHTAB(device); if (!dev) return VDP_STATUS_INVALID_HANDLE; + FREE(dev); vlDestroyHTAB(); diff --git a/src/gallium/state_trackers/vdpau/htab.c b/src/gallium/state_trackers/vdpau/htab.c index 0c958055374..20f5a171f19 100644 --- a/src/gallium/state_trackers/vdpau/htab.c +++ b/src/gallium/state_trackers/vdpau/htab.c @@ -92,3 +92,13 @@ void* vlGetDataHTAB(vlHandle handle) return (void*)handle; #endif } + +void vlRemoveDataHTAB(vlHandle handle) +{ +#ifdef VL_HANDLES + pipe_mutex_lock(htab_lock); + if (htab) + handle_table_remove(htab, handle); + pipe_mutex_unlock(htab_lock); +#endif +} diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 063c63fb4ee..2837e7a306f 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -27,16 +27,12 @@ #include <stdio.h> -#include "vdpau_private.h" #include <vdpau/vdpau.h> + #include <util/u_debug.h> #include <util/u_memory.h> -VdpStatus -vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queue_target) -{ - return VDP_STATUS_NO_IMPLEMENTATION; -} +#include "vdpau_private.h" VdpStatus vlVdpPresentationQueueCreate(VdpDevice device, diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index bd77507567f..ac1f9ccef99 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -222,6 +222,8 @@ boolean vlCreateHTAB(void); void vlDestroyHTAB(void); vlHandle vlAddDataHTAB(void *data); void* vlGetDataHTAB(vlHandle handle); +void vlRemoveDataHTAB(vlHandle handle); + boolean vlGetFuncFTAB(VdpFuncId function_id, void **func); /* Public functions */ |