diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build index 089eb72bf81..3db9ab8fd2f 100644 --- a/src/amd/vulkan/meson.build +++ b/src/amd/vulkan/meson.build @@ -153,6 +153,7 @@ libradv_files = files( 'radv_sqtt.c', 'radv_query.c', 'radv_video.c', + 'radv_video.h', 'radv_wsi.c', 'si_cmd_buffer.c', ) diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 74f7fcb3a55..60a9c813047 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -34,6 +34,7 @@ #include "radv_formats.h" #include "radv_private.h" #include "radv_radeon_winsys.h" +#include "radv_video.h" #include "sid.h" #include "vk_format.h" #include "vk_render_pass.h" diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index 8fb68b4e817..5bef605345e 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -36,6 +36,7 @@ #include "util/u_debug.h" #include "radv_debug.h" #include "radv_private.h" +#include "radv_video.h" #ifdef _WIN32 typedef void *drmDevicePtr; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 08d7f7c9ad5..f43f2758720 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -70,7 +70,6 @@ #include "vk_texcompress_astc.h" #include "vk_texcompress_etc2.h" #include "vk_util.h" -#include "vk_video.h" #include "vk_ycbcr_conversion.h" #include "rmv/vk_rmv_common.h" @@ -3078,34 +3077,6 @@ void radv_pc_begin_query(struct radv_cmd_buffer *cmd_buffer, struct radv_pc_quer void radv_pc_end_query(struct radv_cmd_buffer *cmd_buffer, struct radv_pc_query_pool *pool, uint64_t va); void radv_pc_get_results(const struct radv_pc_query_pool *pc_pool, const uint64_t *data, void *out); -#define VL_MACROBLOCK_WIDTH 16 -#define VL_MACROBLOCK_HEIGHT 16 - -struct radv_vid_mem { - struct radv_device_memory *mem; - VkDeviceSize offset; - VkDeviceSize size; -}; - -struct radv_video_session { - struct vk_video_session vk; - - uint32_t stream_handle; - unsigned stream_type; - bool interlaced; - enum { DPB_MAX_RES = 0, DPB_DYNAMIC_TIER_1, DPB_DYNAMIC_TIER_2 } dpb_type; - unsigned db_alignment; - - struct radv_vid_mem sessionctx; - struct radv_vid_mem ctx; - - unsigned dbg_frame_cnt; -}; - -struct radv_video_session_params { - struct vk_video_session_parameters vk; -}; - bool radv_queue_internal_submit(struct radv_queue *queue, struct radeon_cmdbuf *cs); int radv_queue_init(struct radv_device *device, struct radv_queue *queue, int idx, @@ -3700,10 +3671,6 @@ radv_queue_ring(const struct radv_queue *queue) return radv_queue_family_to_ring(pdev, queue->state.qf); } -/* radv_video */ -void radv_init_physical_device_decoder(struct radv_physical_device *pdev); -void radv_video_get_profile_alignments(struct radv_physical_device *pdev, const VkVideoProfileListInfoKHR *profile_list, - uint32_t *width_align_out, uint32_t *height_align_out); /** * Helper used for debugging compiler issues by enabling/disabling LLVM for a * specific shader stage (developers only). @@ -3808,10 +3775,6 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(radv_pipeline, base, VkPipeline, VK_OBJECT_TYPE_P VK_DEFINE_NONDISP_HANDLE_CASTS(radv_query_pool, vk.base, VkQueryPool, VK_OBJECT_TYPE_QUERY_POOL) VK_DEFINE_NONDISP_HANDLE_CASTS(radv_shader_object, base, VkShaderEXT, VK_OBJECT_TYPE_SHADER_EXT); -VK_DEFINE_NONDISP_HANDLE_CASTS(radv_video_session, vk.base, VkVideoSessionKHR, VK_OBJECT_TYPE_VIDEO_SESSION_KHR) -VK_DEFINE_NONDISP_HANDLE_CASTS(radv_video_session_params, vk.base, VkVideoSessionParametersKHR, - VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR) - static inline uint64_t radv_get_tdr_timeout_for_ip(enum amd_ip_type ip_type) { diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c index a9d88117529..9f50f0ba408 100644 --- a/src/amd/vulkan/radv_video.c +++ b/src/amd/vulkan/radv_video.c @@ -40,6 +40,7 @@ #include "radv_buffer.h" #include "radv_cs.h" #include "radv_debug.h" +#include "radv_video.h" #define NUM_H2645_REFS 16 #define FB_BUFFER_OFFSET 0x1000 diff --git a/src/amd/vulkan/radv_video.h b/src/amd/vulkan/radv_video.h new file mode 100644 index 00000000000..15a38155acc --- /dev/null +++ b/src/amd/vulkan/radv_video.h @@ -0,0 +1,73 @@ +/* + * Copyright © 2016 Red Hat. + * Copyright © 2016 Bas Nieuwenhuizen + * + * based in part on anv driver which is: + * Copyright © 2015 Intel Corporation + * + * 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 (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 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. + */ + +#ifndef RADV_VIDEO_H +#define RADV_VIDEO_H + +#include "vk_video.h" + +#define VL_MACROBLOCK_WIDTH 16 +#define VL_MACROBLOCK_HEIGHT 16 + +struct radv_physical_device; + +struct radv_vid_mem { + struct radv_device_memory *mem; + VkDeviceSize offset; + VkDeviceSize size; +}; + +struct radv_video_session { + struct vk_video_session vk; + + uint32_t stream_handle; + unsigned stream_type; + bool interlaced; + enum { DPB_MAX_RES = 0, DPB_DYNAMIC_TIER_1, DPB_DYNAMIC_TIER_2 } dpb_type; + unsigned db_alignment; + + struct radv_vid_mem sessionctx; + struct radv_vid_mem ctx; + + unsigned dbg_frame_cnt; +}; + +VK_DEFINE_NONDISP_HANDLE_CASTS(radv_video_session, vk.base, VkVideoSessionKHR, VK_OBJECT_TYPE_VIDEO_SESSION_KHR) + +struct radv_video_session_params { + struct vk_video_session_parameters vk; +}; + +VK_DEFINE_NONDISP_HANDLE_CASTS(radv_video_session_params, vk.base, VkVideoSessionParametersKHR, + VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR) + +void radv_init_physical_device_decoder(struct radv_physical_device *pdev); + +void radv_video_get_profile_alignments(struct radv_physical_device *pdev, const VkVideoProfileListInfoKHR *profile_list, + uint32_t *width_align_out, uint32_t *height_align_out); + +#endif /* RADV_VIDEO_H */