mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-31 09:10:32 +01:00
ac/uvd: Add ac_uvd_alloc_stream_handle
Cc: mesa-stable
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34807>
(cherry picked from commit 69455e8208)
This commit is contained in:
parent
11385075a2
commit
4cfaede767
4 changed files with 43 additions and 1 deletions
|
|
@ -2994,7 +2994,7 @@
|
|||
"description": "ac/uvd: Add ac_uvd_alloc_stream_handle",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
33
src/amd/common/ac_uvd_dec.c
Normal file
33
src/amd/common/ac_uvd_dec.c
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2025 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ac_uvd_dec.h"
|
||||
#include "util/os_time.h"
|
||||
#include "util/detect_os.h"
|
||||
#include "util/bitpack_helpers.h"
|
||||
|
||||
#if DETECT_OS_POSIX
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
void ac_uvd_init_stream_handle(struct ac_uvd_stream_handle *handle)
|
||||
{
|
||||
#if DETECT_OS_POSIX
|
||||
handle->base = util_bitreverse(getpid() ^ os_time_get());
|
||||
#else
|
||||
handle->base = util_bitreverse(os_time_get());
|
||||
#endif
|
||||
handle->counter = 0;
|
||||
}
|
||||
|
||||
unsigned ac_uvd_alloc_stream_handle(struct ac_uvd_stream_handle *handle)
|
||||
{
|
||||
return handle->base ^ ++handle->counter;
|
||||
}
|
||||
|
|
@ -406,4 +406,12 @@ struct ruvd_msg {
|
|||
} body;
|
||||
};
|
||||
|
||||
struct ac_uvd_stream_handle {
|
||||
uint32_t base;
|
||||
uint32_t counter;
|
||||
};
|
||||
|
||||
void ac_uvd_init_stream_handle(struct ac_uvd_stream_handle *handle);
|
||||
unsigned ac_uvd_alloc_stream_handle(struct ac_uvd_stream_handle *handle);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ amd_common_files = files(
|
|||
'ac_vcn_av1_default.h',
|
||||
'ac_vcn_dec.c',
|
||||
'ac_vcn_enc.c',
|
||||
'ac_uvd_dec.c',
|
||||
'nir/ac_nir.c',
|
||||
'nir/ac_nir.h',
|
||||
'nir/ac_nir_helpers.h',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue