Current implementation of event handling keeps an extra reference to
the hardware event, in addition to the reference returned via the OpenCL
API. This additional reference is internal and should not be counted
when queried via the clGetEventInfo() function.

Fixes Piglit's cl/api/retain_release-event test.

Signed-off-by: Vedran Miletić <ved...@miletic.net>
---
 src/gallium/state_trackers/clover/api/event.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/api/event.cpp 
b/src/gallium/state_trackers/clover/api/event.cpp
index 5d1a0e5..74bc4d9 100644
--- a/src/gallium/state_trackers/clover/api/event.cpp
+++ b/src/gallium/state_trackers/clover/api/event.cpp
@@ -107,7 +107,9 @@ clGetEventInfo(cl_event d_ev, cl_event_info param,
       break;
 
    case CL_EVENT_REFERENCE_COUNT:
-      buf.as_scalar<cl_uint>() = ev.ref_count();
+      // Current implementation of event handling keeps an extra reference to
+      // the hardware event, which is internal and should not be counted.
+      buf.as_scalar<cl_uint>() = ev.ref_count() - 1;
       break;
 
    default:
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to