diff --git a/.pick_status.json b/.pick_status.json index 676321478b6..c72cd6eb686 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -64,7 +64,7 @@ "description": "radeonsi/video: Avoid stream handle duplicates in PID namespace", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/radeonsi/radeon_video.c b/src/gallium/drivers/radeonsi/radeon_video.c index 2a2799d3659..f985b364fdc 100644 --- a/src/gallium/drivers/radeonsi/radeon_video.c +++ b/src/gallium/drivers/radeonsi/radeon_video.c @@ -21,15 +21,12 @@ unsigned si_vid_alloc_stream_handle() { static unsigned counter = 0; - unsigned stream_handle = 0; - unsigned pid = getpid(); - int i; + static unsigned handle_base = 0; - for (i = 0; i < 32; ++i) - stream_handle |= ((pid >> i) & 1) << (31 - i); + if (!handle_base) + handle_base = util_bitreverse(getpid() ^ os_time_get()); - stream_handle ^= ++counter; - return stream_handle; + return handle_base ^ ++counter; } /* create a buffer in the winsys */