radv: add radv_video.h

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28510>
This commit is contained in:
Samuel Pitoiset 2024-04-01 16:09:37 +02:00 committed by Marge Bot
parent c925f03712
commit ce54440af3
6 changed files with 77 additions and 37 deletions

View file

@ -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',
)

View file

@ -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"

View file

@ -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;

View file

@ -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)
{

View file

@ -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

View file

@ -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 */