Commit 45f6cc09 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Generalise deduplication

parent 4c3633c9
......@@ -95,17 +95,26 @@ static inline char *panwrap_decode_fbd_type(enum mali_fbd_type type)
else return "WTF!?";
}
static void panwrap_replay_sfbd(uint64_t gpu_va, int job_no)
static bool
panwrap_deduplicate(struct panwrap_mapped_memory *mem, uint64_t gpu_va, const char *name, int number)
{
if (mem->touched[(gpu_va - mem->gpu_va) / sizeof(uint32_t)]) {
/* XXX: Is this correct? */
panwrap_log("mali_ptr %s_%d_p = %s_%d_p;\n", name, number, name, number - 1);
return true;
}
return false;
}
static void
panwrap_replay_sfbd(uint64_t gpu_va, int job_no)
{
struct panwrap_mapped_memory *mem = panwrap_find_mapped_gpu_mem_containing(gpu_va);
const struct mali_tentative_sfbd *PANWRAP_PTR_VAR(s, mem, (mali_ptr) gpu_va);
/* FBDs are frequently duplicated, so watch for this */
if (mem->touched[(gpu_va - mem->gpu_va) / sizeof(uint32_t)]) {
/* XXX: Is this correct? */
panwrap_log("mali_ptr fbd_%d_p = fbd_%d_p;\n", job_no, job_no - 1);
return;
}
if (panwrap_deduplicate(mem, gpu_va, "fbd", job_no)) return;
panwrap_log("struct mali_tentative_sfbd fbd_%d = {\n", job_no);
panwrap_indent++;
......@@ -178,13 +187,12 @@ static void panwrap_replay_sfbd(uint64_t gpu_va, int job_no)
void panwrap_replay_attributes(const struct panwrap_mapped_memory *mem,
mali_ptr addr, int job_no, int count, bool varying)
{
/* Varyings in particlar get duplicated between parts of the job */
/* TODO: Deduplification */
//if (mem->touched[(addr - mem->gpu_va) / sizeof(uint32_t)]) return;
char *prefix = varying ? "varyings" : "attributes";
struct mali_attr *attr = panwrap_fetch_gpu_mem(mem, addr, sizeof(struct mali_attr) * count);
/* Varyings in particular get duplicated between parts of the job */
if (panwrap_deduplicate(mem, addr, prefix, job_no)) return;
char *prefix = varying ? "varyings" : "attributes";
struct mali_attr *attr = panwrap_fetch_gpu_mem(mem, addr, sizeof(struct mali_attr) * count);
char base[128];
snprintf(base, sizeof(base), "%s_data_%d", prefix, job_no);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment