mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-08 18:30:49 +02:00
amd/ds: implement amdgpu_ctx_create
Implement amdgpu_ctx_create to create a context to handle the main process of querying performance counter. Change-Id: Ic6f741436886bdc3ee3023b52d0f582ce7d2b6b6
This commit is contained in:
parent
557fab121e
commit
ede29afcff
2 changed files with 21 additions and 0 deletions
|
|
@ -46,11 +46,20 @@ bool AMDPerf::amd_perf_init(int drm_fd, bool is_virtio)
|
|||
if (!ret)
|
||||
return false;
|
||||
|
||||
ret = amdgpu_ctx_create();
|
||||
if (ret)
|
||||
goto error_ctx_create;
|
||||
|
||||
return true;
|
||||
|
||||
error_ctx_create:
|
||||
amdgpu_device_destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
void AMDPerf::amd_perf_destroy()
|
||||
{
|
||||
amdgpu_ctx_destroy();
|
||||
amdgpu_device_destroy();
|
||||
}
|
||||
|
||||
|
|
@ -71,3 +80,12 @@ void AMDPerf::amdgpu_device_destroy()
|
|||
dev = NULL;
|
||||
}
|
||||
|
||||
bool AMDPerf::amdgpu_ctx_create()
|
||||
{
|
||||
return ac_drm_cs_ctx_create2(dev, AMDGPU_CTX_PRIORITY_NORMAL, &ctx);
|
||||
}
|
||||
|
||||
void AMDPerf::amdgpu_ctx_destroy()
|
||||
{
|
||||
ac_drm_cs_ctx_free(dev, ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,12 @@ private:
|
|||
ac_drm_device *dev;
|
||||
struct radeon_info info;
|
||||
uint32_t drm_major, drm_minor;
|
||||
uint32_t ctx;
|
||||
|
||||
bool amdgpu_device_create(int drm_fd);
|
||||
void amdgpu_device_destroy();
|
||||
bool amdgpu_ctx_create();
|
||||
void amdgpu_ctx_destroy();
|
||||
|
||||
public:
|
||||
AMDPerf();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue