mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-27 12:14:10 +08:00
amd/vpelib: Fix duplicate config writer bug
[WHY] Config writer duplicates packets when switching pipes. [HOW] Update config writer to only write new packets if new type is required. [TESTING] Tested with corresponding test cases. Reviewed-by: Roy Chan <Roy.Chan@amd.com> Acked-by: Chih-Wei Chien <Chih-Wei.Chien@amd.com> Signed-off-by: Brendan Leder <breleder@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31693>
This commit is contained in:
parent
8fa10461c9
commit
338dd3b687
@ -51,6 +51,18 @@ void config_writer_set_callback(
|
||||
writer->callback = callback;
|
||||
}
|
||||
|
||||
static void config_writer_reset(struct config_writer *writer)
|
||||
{
|
||||
uint64_t size = writer->buf->cpu_va - writer->base_cpu_va;
|
||||
|
||||
writer->buf->cpu_va -= size;
|
||||
writer->buf->gpu_va -= size;
|
||||
writer->buf->size += size;
|
||||
|
||||
VPE_ASSERT(writer->buf->cpu_va == writer->base_cpu_va);
|
||||
VPE_ASSERT(writer->buf->gpu_va == writer->base_gpu_va);
|
||||
}
|
||||
|
||||
static inline void config_writer_new(struct config_writer *writer)
|
||||
{
|
||||
if (writer->status != VPE_STATUS_OK)
|
||||
@ -91,9 +103,9 @@ void config_writer_set_type(struct config_writer *writer, enum config_type type,
|
||||
if (writer->status != VPE_STATUS_OK)
|
||||
return;
|
||||
|
||||
if (writer->type != type || writer->pipe_idx != pipe_idx) {
|
||||
if (writer->type != type) {
|
||||
if (writer->type == CONFIG_TYPE_UNKNOWN) {
|
||||
// new header. don't need to fill it yet until completion
|
||||
// new header or only pipe change. don't need to fill it yet until completion
|
||||
writer->pipe_idx = pipe_idx;
|
||||
config_writer_new(writer);
|
||||
} else {
|
||||
@ -266,6 +278,11 @@ void config_writer_complete(struct config_writer *writer)
|
||||
uint32_t *cmd_space = (uint32_t *)(uintptr_t)writer->base_cpu_va;
|
||||
uint64_t size = writer->buf->cpu_va - writer->base_cpu_va;
|
||||
|
||||
if (size <= sizeof(uint32_t)) {
|
||||
config_writer_reset(writer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (writer->status != VPE_STATUS_OK)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user