mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
amd/vpelib: Use uint64 for buffer size
Reviewed-by: Roy Chan <Roy.Chan@amd.com> Acked-by: Alan Liu <haoping.liu@amd.com> Signed-off-by: Navid Assadian <navid.assadian@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26841>
This commit is contained in:
parent
4a48896a0d
commit
b354ceebaa
8 changed files with 25 additions and 23 deletions
|
|
@ -614,7 +614,7 @@ struct vpe_bufs_req {
|
|||
struct vpe_buf {
|
||||
uint64_t gpu_va; /**< GPU start address of the buffer */
|
||||
uint64_t cpu_va;
|
||||
int64_t size;
|
||||
uint64_t size;
|
||||
bool tmz; /**< allocated from tmz */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -655,7 +655,7 @@ static void build_clamping_params(
|
|||
}
|
||||
|
||||
static void frontend_config_callback(
|
||||
void *ctx, uint64_t cfg_base_gpu, uint64_t cfg_base_cpu, int64_t size)
|
||||
void *ctx, uint64_t cfg_base_gpu, uint64_t cfg_base_cpu, uint64_t size)
|
||||
{
|
||||
struct config_frontend_cb_ctx *cb_ctx = (struct config_frontend_cb_ctx *)ctx;
|
||||
struct vpe_priv *vpe_priv = cb_ctx->vpe_priv;
|
||||
|
|
@ -781,7 +781,7 @@ int32_t vpe10_program_frontend(struct vpe_priv *vpe_priv, uint32_t pipe_idx, uin
|
|||
}
|
||||
|
||||
static void backend_config_callback(
|
||||
void *ctx, uint64_t cfg_base_gpu, uint64_t cfg_base_cpu, int64_t size)
|
||||
void *ctx, uint64_t cfg_base_gpu, uint64_t cfg_base_cpu, uint64_t size)
|
||||
{
|
||||
struct config_backend_cb_ctx *cb_ctx = (struct config_backend_cb_ctx *)ctx;
|
||||
struct vpe_priv *vpe_priv = cb_ctx->vpe_priv;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static inline void config_writer_new(struct config_writer *writer)
|
|||
return;
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (writer->buf->size < (int64_t)sizeof(uint32_t)) {
|
||||
if (writer->buf->size < sizeof(uint32_t)) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ void config_writer_fill(struct config_writer *writer, uint32_t value)
|
|||
}
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (writer->buf->size < (int64_t)sizeof(uint32_t)) {
|
||||
if (writer->buf->size < sizeof(uint32_t)) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
@ -138,6 +138,7 @@ void config_writer_fill_direct_config_packet_header(
|
|||
{
|
||||
uint32_t *cmd_space;
|
||||
uint64_t size = writer->buf->cpu_va - writer->base_cpu_va;
|
||||
uint64_t w_size = sizeof(uint32_t);
|
||||
|
||||
VPE_ASSERT(writer->type == CONFIG_TYPE_DIRECT);
|
||||
|
||||
|
|
@ -155,16 +156,16 @@ void config_writer_fill_direct_config_packet_header(
|
|||
}
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (writer->buf->size < (int64_t)sizeof(uint32_t)) {
|
||||
if (writer->buf->size < w_size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
||||
cmd_space = (uint32_t *)(uintptr_t)writer->buf->cpu_va;
|
||||
*cmd_space++ = packet->u32all;
|
||||
writer->buf->cpu_va += sizeof(uint32_t);
|
||||
writer->buf->gpu_va += sizeof(uint32_t);
|
||||
writer->buf->size -= sizeof(uint32_t);
|
||||
writer->buf->cpu_va += w_size;
|
||||
writer->buf->gpu_va += w_size;
|
||||
writer->buf->size -= w_size;
|
||||
}
|
||||
|
||||
void config_writer_fill_direct_config_packet(
|
||||
|
|
@ -172,6 +173,7 @@ void config_writer_fill_direct_config_packet(
|
|||
{
|
||||
uint32_t *cmd_space;
|
||||
uint64_t size = writer->buf->cpu_va - writer->base_cpu_va;
|
||||
uint64_t w_size = 2 * sizeof(uint32_t);
|
||||
|
||||
VPE_ASSERT(writer->type == CONFIG_TYPE_DIRECT);
|
||||
VPE_ASSERT(packet->bits.VPEP_CONFIG_DATA_SIZE == 0);
|
||||
|
|
@ -188,7 +190,7 @@ void config_writer_fill_direct_config_packet(
|
|||
config_writer_new(writer);
|
||||
}
|
||||
|
||||
if (writer->buf->size < (int64_t)(2 * sizeof(uint32_t))) {
|
||||
if (writer->buf->size < w_size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
@ -228,7 +230,7 @@ void config_writer_fill_indirect_destination(struct config_writer *writer,
|
|||
void config_writer_complete(struct config_writer *writer)
|
||||
{
|
||||
uint32_t *cmd_space = (uint32_t *)(uintptr_t)writer->base_cpu_va;
|
||||
uint32_t size = (uint32_t)(writer->buf->cpu_va - writer->base_cpu_va);
|
||||
uint64_t size = writer->buf->cpu_va - writer->base_cpu_va;
|
||||
|
||||
if (writer->status != VPE_STATUS_OK)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ enum config_type {
|
|||
};
|
||||
|
||||
typedef void (*config_callback_t)(
|
||||
void *ctx, uint64_t cfg_base_gpu, uint64_t cfg_base_cpu, int64_t size);
|
||||
void *ctx, uint64_t cfg_base_gpu, uint64_t cfg_base_cpu, uint64_t size);
|
||||
|
||||
#define MAX_CONFIG_PACKET_DATA_SIZE_DWORD 0x01000
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ struct vpe_cmd_info {
|
|||
|
||||
struct config_record {
|
||||
uint64_t config_base_addr;
|
||||
int64_t config_size;
|
||||
uint64_t config_size;
|
||||
};
|
||||
|
||||
/** represents a stream input, i.e. common to all segments */
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void plane_desc_writer_init(struct plane_desc_writer *writer, struct vpe_buf *bu
|
|||
writer->num_dst = 0;
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (buf->size < (int64_t)size) {
|
||||
if (buf->size < size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ void plane_desc_writer_add_source(
|
|||
return;
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (writer->buf->size < (int64_t)size) {
|
||||
if (writer->buf->size < size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ void plane_desc_writer_add_destination(
|
|||
return;
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (writer->buf->size < (int64_t)size) {
|
||||
if (writer->buf->size < size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void vpe_desc_writer_init(struct vpe_desc_writer *writer, struct vpe_buf *buf, i
|
|||
writer->plane_desc_added = false;
|
||||
writer->status = VPE_STATUS_OK;
|
||||
|
||||
if (buf->size < (int64_t)size) {
|
||||
if (buf->size < size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ void vpe_desc_writer_add_plane_desc(
|
|||
return;
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (writer->buf->size < (int64_t)size) {
|
||||
if (writer->buf->size < size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ void vpe_desc_writer_add_config_desc(
|
|||
return;
|
||||
|
||||
/* Buffer does not have enough space to write */
|
||||
if (writer->buf->size < (int64_t)size) {
|
||||
if (writer->buf->size < size) {
|
||||
writer->status = VPE_STATUS_BUFFER_OVERFLOW;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -549,11 +549,11 @@ enum vpe_status vpe_build_commands(
|
|||
* becaues the supported check is already passed
|
||||
* and the caller can come again with correct buffer size.
|
||||
*/
|
||||
bufs->cmd_buf.size = (int64_t)vpe_priv->bufs_required.cmd_buf_size;
|
||||
bufs->emb_buf.size = (int64_t)vpe_priv->bufs_required.emb_buf_size;
|
||||
bufs->cmd_buf.size = vpe_priv->bufs_required.cmd_buf_size;
|
||||
bufs->emb_buf.size = vpe_priv->bufs_required.emb_buf_size;
|
||||
return VPE_STATUS_OK;
|
||||
} else if ((bufs->cmd_buf.size < (int32_t)vpe_priv->bufs_required.cmd_buf_size) ||
|
||||
(bufs->emb_buf.size < (int32_t)vpe_priv->bufs_required.emb_buf_size)) {
|
||||
} else if ((bufs->cmd_buf.size < vpe_priv->bufs_required.cmd_buf_size) ||
|
||||
(bufs->emb_buf.size < vpe_priv->bufs_required.emb_buf_size)) {
|
||||
status = VPE_STATUS_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue