mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 04:10:09 +01:00
winsys/amdgpu: use DMA_BUF_SET_NAME_B if available
Give a name to dma-buf. This name appears in /sys/kernel/debug/dma_buf/bufinfo and could be useful to debug dma-buf: Dma-buf Objects: size flags mode count exp_name ino name 00606208 00000002 00080007 00000003 drm 00192014 2321705-glxgears The name is only added to non-shared buffer, to avoid overwriting an existing name when exporting an imported buffer (otherwise all dma-buf will pretend to be created by XWayland). Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20728>
This commit is contained in:
parent
3ed75027b7
commit
f2ef663d08
1 changed files with 13 additions and 0 deletions
|
|
@ -25,13 +25,17 @@
|
|||
* of the Software.
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "amdgpu_cs.h"
|
||||
|
||||
#include "util/hash_table.h"
|
||||
#include "util/os_time.h"
|
||||
#include "util/u_hash_table.h"
|
||||
#include "util/u_process.h"
|
||||
#include "frontend/drm_driver.h"
|
||||
#include "drm-uapi/amdgpu_drm.h"
|
||||
#include "drm-uapi/dma-buf.h"
|
||||
#include <xf86drm.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
|
@ -1636,6 +1640,15 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
|
|||
if (r)
|
||||
return false;
|
||||
|
||||
#if defined(DMA_BUF_SET_NAME_B)
|
||||
if (whandle->type == WINSYS_HANDLE_TYPE_FD &&
|
||||
!bo->u.real.is_shared) {
|
||||
char dmabufname[32];
|
||||
snprintf(dmabufname, 32, "%d-%s", getpid(), util_get_process_name());
|
||||
r = ioctl(whandle->handle, DMA_BUF_SET_NAME_B, (uint64_t)(uintptr_t)dmabufname);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (whandle->type == WINSYS_HANDLE_TYPE_KMS) {
|
||||
int dma_fd = whandle->handle;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue