Add support for VA-API and rocDecode tracing (#92)

- VA API tracing using Timemory gotcha wrappers.
- rocDecode API tracing integration using callback to ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API
- Updated videodecode ctest to validate rocDecode APIs in perfetto trace.
Этот коммит содержится в:
Sajina PK
2025-02-11 13:08:23 -05:00
коммит произвёл GitHub
родитель e437200e9e
Коммит 697d1ac02f
21 изменённых файлов: 6235 добавлений и 22 удалений
+13
Просмотреть файл
@@ -47,6 +47,7 @@
#include "library/components/mpi_gotcha.hpp"
#include "library/components/numa_gotcha.hpp"
#include "library/components/pthread_gotcha.hpp"
#include "library/components/vaapi_gotcha.hpp"
#include "library/coverage.hpp"
#include "library/ompt.hpp"
#include "library/process_sampler.hpp"
@@ -486,6 +487,12 @@ rocprofsys_init_tooling_hidden()
// start these gotchas once settings have been initialized
if(get_init_bundle()) get_init_bundle()->start();
if(get_use_vaapi_tracing())
{
ROCPROFSYS_VERBOSE_F(1, "Setting up VA-API traces...\n");
component::vaapi_gotcha::start();
}
if(get_use_sampling()) sampling::block_signals();
// perfetto initialization
@@ -762,6 +769,12 @@ rocprofsys_finalize_hidden(void)
fini_bundle_t _finalization{};
_finalization.start();
if(get_use_vaapi_tracing())
{
ROCPROFSYS_VERBOSE_F(1, "Shutting down VA-API tracing...\n");
component::vaapi_gotcha::shutdown();
}
if(get_use_rcclp())
{
ROCPROFSYS_VERBOSE_F(1, "Shutting down RCCLP...\n");
+2
Просмотреть файл
@@ -10,6 +10,7 @@ set(component_sources
${CMAKE_CURRENT_LIST_DIR}/fork_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/mpi_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/numa_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp)
@@ -27,6 +28,7 @@ set(component_headers
${CMAKE_CURRENT_LIST_DIR}/fork_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/mpi_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/numa_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/rcclp.hpp
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.hpp
+318
Просмотреть файл
@@ -0,0 +1,318 @@
// MIT License
//
// Copyright (c) 2022-2025 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "library/components/vaapi_gotcha.hpp"
#include "core/common.hpp"
#include "core/config.hpp"
#include "core/debug.hpp"
#include "core/state.hpp"
#include "core/timemory.hpp"
#include "library/components/category_region.hpp"
#include "library/runtime.hpp"
#include <timemory/backends/threading.hpp>
#include <timemory/components/macros.hpp>
#include <timemory/mpl/concepts.hpp>
#include <timemory/utility/types.hpp>
#include <cstddef>
#include <cstdlib>
namespace rocprofsys
{
namespace component
{
namespace
{
auto&
get_vaapi_gotcha()
{
static auto _v = tim::lightweight_tuple<vaapi_gotcha_t>{};
return _v;
}
} // namespace
void
vaapi_gotcha::configure()
{
// don't emit warnings for missing functions unless debug or verbosity >= 3
if(get_verbose_env() < 3 && !get_debug_env())
{
for(size_t i = 0; i < vaapi_gotcha_t::capacity(); ++i)
{
auto* itr = vaapi_gotcha_t::at(i);
if(itr) itr->verbose = -1;
}
}
vaapi_gotcha_t::get_initializer() = []() {
vaapi_gotcha_t::configure<0, VAStatus, VADisplay, VAContextID, VASurfaceID>(
"vaBeginPicture");
vaapi_gotcha_t::configure<1, VAStatus, VADisplay, VAContextID, VABufferType,
unsigned int, unsigned int, void*, VABufferID*>(
"vaCreateBuffer");
vaapi_gotcha_t::configure<2, VAStatus, VADisplay, VAProfile, VAEntrypoint,
VAConfigAttrib*, int, VAConfigID*>("vaCreateConfig");
vaapi_gotcha_t::configure<3, VAStatus, VADisplay, VAConfigID, int, int, int,
VASurfaceID*, int, VAContextID*>("vaCreateContext");
vaapi_gotcha_t::configure<4, VAStatus, VADisplay, unsigned int, unsigned int,
unsigned int, VASurfaceID*, unsigned int,
VASurfaceAttrib*, unsigned int>("vaCreateSurfaces");
vaapi_gotcha_t::configure<5, VAStatus, VADisplay, VASurfaceID*, int>(
"vaDestroySurfaces");
vaapi_gotcha_t::configure<6, VAStatus, VADisplay, VASurfaceID>("vaSyncSurface");
vaapi_gotcha_t::configure<7, VAStatus, VADisplay, VABufferID>("vaDestroyBuffer");
vaapi_gotcha_t::configure<8, VAStatus, VADisplay, VAConfigID>("vaDestroyConfig");
vaapi_gotcha_t::configure<9, VAStatus, VADisplay, VAContextID>(
"vaDestroyContext");
vaapi_gotcha_t::configure<10, VAStatus, VADisplay, VAContextID>("vaEndPicture");
vaapi_gotcha_t::configure<11, VAStatus, VADisplay, VASurfaceID, uint32_t,
uint32_t, void*>("vaExportSurfaceHandle");
vaapi_gotcha_t::configure<12, VAStatus, VADisplay, VAProfile, VAEntrypoint,
VAConfigAttrib*, int>("vaGetConfigAttributes");
vaapi_gotcha_t::configure<13, VAStatus, VADisplay, int*, int*>("vaInitialize");
vaapi_gotcha_t::configure<14, VAStatus, VADisplay, VAProfile, VAEntrypoint*,
int*>("vaQueryConfigEntrypoints");
vaapi_gotcha_t::configure<15, VAStatus, VADisplay, VAConfigID, VASurfaceAttrib*,
unsigned int*>("vaQuerySurfaceAttributes");
vaapi_gotcha_t::configure<16, VAStatus, VADisplay, VASurfaceID, VASurfaceStatus*>(
"vaQuerySurfaceStatus");
vaapi_gotcha_t::configure<17, VAStatus, VADisplay, VAContextID, VABufferID*, int>(
"vaRenderPicture");
vaapi_gotcha_t::configure<18, VAStatus, VADisplay>("vaTerminate");
vaapi_gotcha_t::configure<19, int, VADisplay>("vaDisplayIsValid");
};
}
void
vaapi_gotcha::shutdown()
{
vaapi_gotcha_t::disable();
}
void
vaapi_gotcha::start()
{
if(!get_vaapi_gotcha().get<vaapi_gotcha_t>()->get_is_running())
{
configure();
get_vaapi_gotcha().start();
}
}
void
vaapi_gotcha::stop()
{}
// vaBeginPicture
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAContextID context, VASurfaceID render_target)
{
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"context", context, "render_target",
render_target);
}
// vaCreateBuffer
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAContextID context, VABufferType type, unsigned int size,
unsigned int num_elements, void* data, VABufferID* buf_id)
{
category_region<category::vaapi>::start(
std::string_view{ _data.tool_id }, "dpy", dpy, "context", context, "buffer_type",
type, "size", size, "num_elements", num_elements, "data", data, "buf_id", buf_id);
}
// vaCreateConfig
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAProfile profile, VAEntrypoint entrypoint,
VAConfigAttrib* attrib_list, int num_attribs, VAConfigID* config_id)
{
(void) attrib_list; // unused
category_region<category::vaapi>::start(
std::string_view{ _data.tool_id }, "dpy", dpy, "profile", profile, "entrypoint",
entrypoint, "num_attribs", num_attribs, "config_id", config_id);
}
// vaCreateContext
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAConfigID config_id, int picture_width, int picture_height, int flag,
VASurfaceID* render_targets, int num_render_targets,
VAContextID* context)
{
category_region<category::vaapi>::start(
std::string_view{ _data.tool_id }, "dpy", dpy, "config_id", config_id,
"picture_width", picture_width, "picture_height", picture_height, "flag", flag,
"render_targets", render_targets, "num_render_targets", num_render_targets,
"context", context);
}
// vaCreateSurfaces
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
unsigned int format, unsigned int width, unsigned int height,
VASurfaceID* surfaces, unsigned int num_surfaces,
VASurfaceAttrib* attrib_list, unsigned int num_attribs)
{
(void) attrib_list; // unused
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"format", format, "width", width, "height",
height, "surfaces", surfaces, "num_surfaces",
num_surfaces, "num_attribs", num_attribs);
}
// vaDestroyBuffer
// vaDestroyConfig
// vaDestroyContext
// vaEndPicture
// vaSyncSurface
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAContextID context)
{
if(_data.tool_id == "vaDestroyBuffer")
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
dpy, "buffer_id", context);
else if(_data.tool_id == "vaDestroyConfig")
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
dpy, "config_id", context);
else if(_data.tool_id == "vaDestroyContext")
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
dpy, "context", context);
else if(_data.tool_id == "vaEndPicture")
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
dpy, "context", context);
else if(_data.tool_id == "vaSyncSurface")
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
dpy, "render_target", context);
}
// vaDestroySurfaces
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VASurfaceID* surfaces, int num_surfaces)
{
(void) surfaces; // unused
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"num_surfaces", num_surfaces);
}
// vaExportSurfaceHandle
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VASurfaceID surface_id, uint32_t mem_type, uint32_t flags,
void* descriptor)
{
category_region<category::vaapi>::start(
std::string_view{ _data.tool_id }, "dpy", dpy, "surface_id", surface_id,
"mem_type", mem_type, "flags", flags, "descriptor", descriptor);
}
// vaGetConfigAttributes
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAProfile profile, VAEntrypoint entrypoint,
VAConfigAttrib* attrib_list, int num_attribs)
{
(void) attrib_list; // unused
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"profile", profile, "entrypoint", entrypoint,
"num_attribs", num_attribs);
}
// vaInitialize
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
int* major_version, int* minor_version)
{
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"major_version", major_version,
"minor_version", minor_version);
}
// vaQueryConfigEntrypoints
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAProfile profile, VAEntrypoint* entrypoint_list,
int* num_entrypoints)
{
category_region<category::vaapi>::start(
std::string_view{ _data.tool_id }, "dpy", dpy, "profile", profile,
"entrypoint_list", entrypoint_list, "num_entrypoints", num_entrypoints);
}
// vaQuerySurfaceAttributes
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAConfigID config, VASurfaceAttrib* attrib_list,
unsigned int* num_attribs)
{
(void) attrib_list; // unused
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"config", config, "num_attribs", num_attribs);
}
// vaQuerySurfaceStatus
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VASurfaceID render_target, VASurfaceStatus* status)
{
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"render_target", render_target, "status",
status);
}
// vaRenderPicture
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAContextID context, VABufferID* buffers, int num_buffers)
{
(void) buffers; // unused
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
"context", context, "num_buffers",
num_buffers);
}
// vaTerminate
// vaDisplayIsValid
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy)
{
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
dpy);
}
void
vaapi_gotcha::audit(const gotcha_data& _data, audit::outgoing, VAStatus ret)
{
category_region<category::vaapi>::stop(std::string_view{ _data.tool_id }, "return",
ret);
}
} // namespace component
} // namespace rocprofsys
TIMEMORY_STORAGE_INITIALIZER(rocprofsys::component::vaapi_gotcha)
+122
Просмотреть файл
@@ -0,0 +1,122 @@
// MIT License
//
// Copyright (c) 2022-2025 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include "core/common.hpp"
#include "core/defines.hpp"
#include "core/timemory.hpp"
#if defined(_MSC_VER)
# pragma warning(disable : 4200)
#endif
#if defined(__GNUC__) || defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
// Errors due to anonymous struct/union and flexible array member
#endif
#include "va/va.h"
#include "va/va_drm.h"
#include "va/va_drmcommon.h"
#if defined(__GNUC__) || defined(__clang__)
# pragma GCC diagnostic pop
#endif
#include <timemory/components/base.hpp>
#include <timemory/components/gotcha/backends.hpp>
#include <cstdint>
#include <cstdlib>
namespace rocprofsys
{
namespace component
{
struct vaapi_gotcha : tim::component::base<vaapi_gotcha, void>
{
static constexpr size_t gotcha_capacity = 20;
using gotcha_data = tim::component::gotcha_data;
using exit_func_t = void (*)(int);
using abort_func_t = void (*)();
ROCPROFSYS_DEFAULT_OBJECT(vaapi_gotcha)
// string id for component
static std::string label() { return "vaapi_gotcha"; }
// generate the gotcha wrappers
static void configure();
static void shutdown();
static void start();
static void stop();
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
VAContextID context, VASurfaceID render_target);
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
VAContextID context, VABufferType type, unsigned int size,
unsigned int num_elements, void* data, VABufferID* buf_id);
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
VAProfile profile, VAEntrypoint entrypoint,
VAConfigAttrib* attrib_list, int num_attribs,
VAConfigID* config_id);
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
VAConfigID config_id, int picture_width, int picture_height,
int flag, VASurfaceID* render_targets, int num_render_targets,
VAContextID* context);
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
unsigned int format, unsigned int width, unsigned int height,
VASurfaceID* surfaces, unsigned int num_surfaces,
VASurfaceAttrib* attrib_list, unsigned int num_attribs);
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
VASurfaceID* surfaces, int num_surfaces);
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
VAContextID context);
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
VASurfaceID surface_id, uint32_t mem_type, uint32_t flags,
void* descriptor);
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAProfile profile, VAEntrypoint entrypoint,
VAConfigAttrib* attrib_list, int num_attribs);
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
int* major_version, int* minor_version);
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAProfile profile, VAEntrypoint* entrypoint_list,
int* num_entrypoints);
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAConfigID config, VASurfaceAttrib* attrib_list,
unsigned int* num_attribs);
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VASurfaceID render_target, VASurfaceStatus* status);
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
VAContextID context, VABufferID* buffers, int num_buffers);
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy);
static void audit(const gotcha_data&, audit::outgoing, VAStatus);
};
} // namespace component
using vaapi_bundle_t = tim::component_bundle<category::vaapi, component::vaapi_gotcha>;
using vaapi_gotcha_t = tim::component::gotcha<component::vaapi_gotcha::gotcha_capacity,
vaapi_bundle_t, category::vaapi>;
} // namespace rocprofsys
+32 -8
Просмотреть файл
@@ -473,7 +473,6 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
if(record.phase == ROCPROFILER_CALLBACK_PHASE_ENTER)
{
user_data->value = ts;
switch(record.kind)
{
case ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API:
@@ -498,6 +497,15 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
user_data, ts);
break;
}
#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
ROCPROFILER_VERSION_MAJOR >= 1
case ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API:
{
tool_tracing_callback_start(category::rocm_rocdecode_api{}, record,
user_data, ts);
break;
}
#endif
case ROCPROFILER_CALLBACK_TRACING_NONE:
case ROCPROFILER_CALLBACK_TRACING_LAST:
case ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API:
@@ -523,6 +531,7 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
constexpr bool bt_with_signal_frame = true;
auto _bt_data = std::optional<backtrace_entry_vec_t>{};
if(config::get_use_perfetto() && config::get_perfetto_annotations() &&
tool_data->backtrace_operations.at(record.kind).count(record.operation) > 0)
{
@@ -567,6 +576,15 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
ts, _bt_data);
break;
}
#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
ROCPROFILER_VERSION_MAJOR >= 1
case ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API:
{
tool_tracing_callback_stop(category::rocm_rocdecode_api{}, record,
user_data, ts, _bt_data);
break;
}
#endif
case ROCPROFILER_CALLBACK_TRACING_NONE:
case ROCPROFILER_CALLBACK_TRACING_LAST:
case ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API:
@@ -991,13 +1009,19 @@ tool_init(rocprofiler_client_finalize_t fini_func, void* user_data)
_data->primary_ctx, ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT, nullptr, 0,
tool_code_object_callback, _data));
for(auto itr : { ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API })
for(auto itr : {
ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
ROCPROFILER_VERSION_MAJOR >= 1
ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API,
#endif
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API
})
{
if(_callback_domains.count(itr) > 0)
{
+1
Просмотреть файл
@@ -33,6 +33,7 @@
#include "library/components/mpi_gotcha.hpp"
#include "library/components/numa_gotcha.hpp"
#include "library/components/pthread_gotcha.hpp"
#include "library/components/vaapi_gotcha.hpp"
#include "library/thread_data.hpp"
#include <timemory/backends/threading.hpp>
Разница между файлами не показана из-за своего большого размера Загрузить разницу
+61
Просмотреть файл
@@ -0,0 +1,61 @@
/*
* va_drm.h - Raw DRM API
*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_DRM_H
#define VA_DRM_H
#include <va/va.h>
/**
* \file va_drm.h
* \brief The raw DRM API
*
* This file contains the \ref api_drm "Raw DRM API".
*/
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \brief Returns a VA display derived from the specified DRM connection.
*
* This function returns a (possibly cached) VA display from the
* specified DRM connection @fd.
*
* @param[in] fd the DRM connection descriptor
* @return the VA display
*/
VADisplay vaGetDisplayDRM(int fd);
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DRM_H */
+183
Просмотреть файл
@@ -0,0 +1,183 @@
/*
* va_drmcommon.h - Common utilities for DRM-based drivers
*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_DRM_COMMON_H
#define VA_DRM_COMMON_H
#include <stdint.h>
/** \brief DRM authentication type. */
enum
{
/** \brief Disconnected. */
VA_DRM_AUTH_NONE = 0,
/**
* \brief Connected. Authenticated with DRI1 protocol.
*
* @deprecated
* This is a deprecated authentication type. All DRI-based drivers have
* been migrated to use the DRI2 protocol. Newly written drivers shall
* use DRI2 protocol only, or a custom authentication means. e.g. opt
* for authenticating on the VA driver side, instead of libva side.
*/
VA_DRM_AUTH_DRI1 = 1,
/**
* \brief Connected. Authenticated with DRI2 protocol.
*
* This is only useful to VA/X11 drivers. The libva-x11 library provides
* a helper function VA_DRI2Authenticate() for authenticating the
* connection. However, DRI2 conformant drivers don't need to call that
* function since authentication happens on the libva side, implicitly.
*/
VA_DRM_AUTH_DRI2 = 2,
/**
* \brief Connected. Authenticated with some alternate raw protocol.
*
* This authentication mode is mainly used in non-VA/X11 drivers.
* Authentication happens through some alternative method, at the
* discretion of the VA driver implementation.
*/
VA_DRM_AUTH_CUSTOM = 3
};
/** \brief Base DRM state. */
struct drm_state
{
/** \brief DRM connection descriptor. */
int fd;
/** \brief DRM authentication type. */
int auth_type;
/** \brief Reserved bytes for future use, must be zero */
int va_reserved[8];
};
/** \brief Kernel DRM buffer memory type. */
#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM 0x10000000
/** \brief DRM PRIME memory type (old version)
*
* This supports only single objects with restricted memory layout.
* Used with VASurfaceAttribExternalBuffers.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000
/** \brief DRM PRIME memory type
*
* Used with VADRMPRIMESurfaceDescriptor.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000
/**
* \brief External buffer descriptor for a DRM PRIME surface.
*
* For export, call vaExportSurfaceHandle() with mem_type set to
* VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an
* instance of this structure to fill.
* If VA_EXPORT_SURFACE_SEPARATE_LAYERS is specified on export, each
* layer will contain exactly one plane. For example, an NV12
* surface will be exported as two layers, one of DRM_FORMAT_R8 and
* one of DRM_FORMAT_GR88.
* If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export,
* there will be exactly one layer.
*
* For import, call vaCreateSurfaces() with the MemoryType attribute
* set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the
* ExternalBufferDescriptor attribute set to point to an array of
* num_surfaces instances of this structure.
* The number of planes which need to be provided for a given layer
* is dependent on both the format and the format modifier used for
* the objects containing it. For example, the format DRM_FORMAT_RGBA
* normally requires one plane, but with the format modifier
* I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first
* being the main data plane and the second containing the color
* control surface.
* Note that a given driver may only support a subset of possible
* representations of a particular format. For example, it may only
* support NV12 surfaces when they are contained within a single DRM
* object, and therefore fail to create such surfaces if the two
* planes are in different DRM objects.
* Note that backend driver will retrieve the resource represent by fd,
* and a valid surface ID is generated. Backend driver will not close
* the file descriptor. Application should handle the release of the fd.
* releasing the fd will not impact the existence of the surface.
*/
typedef struct _VADRMPRIMESurfaceDescriptor
{
/** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
uint32_t fourcc;
/** Width of the surface in pixels. */
uint32_t width;
/** Height of the surface in pixels. */
uint32_t height;
/** Number of distinct DRM objects making up the surface. */
uint32_t num_objects;
/** Description of each object. */
struct
{
/** DRM PRIME file descriptor for this object. */
int fd;
/** Total size of this object (may include regions which are
* not part of the surface). */
uint32_t size;
/** Format modifier applied to this object. */
uint64_t drm_format_modifier;
} objects[4];
/** Number of layers making up the surface. */
uint32_t num_layers;
/** Description of each layer in the surface. */
struct
{
/** DRM format fourcc of this layer (DRM_FOURCC_*). */
uint32_t drm_format;
/** Number of planes in this layer. */
uint32_t num_planes;
/** Index in the objects array of the object containing each
* plane. */
uint32_t object_index[4];
/** Offset within the object of each plane. */
uint32_t offset[4];
/** Pitch of each plane. */
uint32_t pitch[4];
} layers[4];
} VADRMPRIMESurfaceDescriptor;
/**
* \brief List of DRM format modifiers.
*
* To allocate surfaces with one of the modifiers specified in the array, call
* vaCreateSurfaces() with the VASurfaceAttribDRMFormatModifiers attribute set
* to point to an array of num_surfaces instances of this structure. The driver
* will select the optimal modifier in the list.
*
* DRM format modifiers are defined in drm_fourcc.h in the Linux kernel.
*/
typedef struct _VADRMFormatModifierList
{
/** Number of modifiers. */
uint32_t num_modifiers;
/** Array of modifiers. */
uint64_t* modifiers;
} VADRMFormatModifierList;
#endif /* VA_DRM_COMMON_H */
+87
Просмотреть файл
@@ -0,0 +1,87 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_VERSION_H
#define VA_VERSION_H
/**
* VA_MAJOR_VERSION:
*
* The major version of VA-API (1, if %VA_VERSION is 1.2.3)
*/
#define VA_MAJOR_VERSION 1
/**
* VA_MINOR_VERSION:
*
* The minor version of VA-API (2, if %VA_VERSION is 1.2.3)
*/
#define VA_MINOR_VERSION 16
/**
* VA_MICRO_VERSION:
*
* The micro version of VA-API (3, if %VA_VERSION is 1.2.3)
*/
#define VA_MICRO_VERSION 0
/**
* VA_VERSION:
*
* The full version of VA-API, like 1.2.3
*/
#define VA_VERSION 1.16.0
/**
* VA_VERSION_S:
*
* The full version of VA-API, in string form (suited for string
* concatenation)
*/
#define VA_VERSION_S "1.16.0"
/**
* VA_VERSION_HEX:
*
* Numerically encoded version of VA-API, like 0x010203
*/
#define VA_VERSION_HEX \
((VA_MAJOR_VERSION << 24) | (VA_MINOR_VERSION << 16) | (VA_MICRO_VERSION << 8))
/**
* VA_CHECK_VERSION:
* @major: major version, like 1 in 1.2.3
* @minor: minor version, like 2 in 1.2.3
* @micro: micro version, like 3 in 1.2.3
*
* Evaluates to %TRUE if the version of VA-API is greater than
* @major, @minor and @micro
*/
#define VA_CHECK_VERSION(major, minor, micro) \
(VA_MAJOR_VERSION > (major) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && \
VA_MICRO_VERSION >= (micro)))
#endif /* VA_VERSION_H */