Lines Matching refs:cs
77 struct drm_radeon_cs cs; member
175 static int cs_gem_write_reloc(struct radeon_cs_int *cs, in cs_gem_write_reloc() argument
182 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_write_reloc()
204 if ((atomic_read((atomic_t *)radeon_gem_get_reloc_in_cs(bo)) & cs->id)) { in cs_gem_write_reloc()
208 for(i = cs->crelocs; i != 0;) { in cs_gem_write_reloc()
237 radeon_cs_write_dword((struct radeon_cs *)cs, 0xc0001000); in cs_gem_write_reloc()
238 radeon_cs_write_dword((struct radeon_cs *)cs, idx); in cs_gem_write_reloc()
258 cs->relocs = csg->relocs = tmp; in cs_gem_write_reloc()
272 atomic_add((atomic_t *)radeon_gem_get_reloc_in_cs(bo), cs->id); in cs_gem_write_reloc()
273 cs->relocs_total_size += boi->size; in cs_gem_write_reloc()
274 radeon_cs_write_dword((struct radeon_cs *)cs, 0xc0001000); in cs_gem_write_reloc()
275 radeon_cs_write_dword((struct radeon_cs *)cs, idx); in cs_gem_write_reloc()
279 static int cs_gem_begin(struct radeon_cs_int *cs, in cs_gem_begin() argument
286 if (cs->section_ndw) { in cs_gem_begin()
288 cs->section_file, cs->section_func, cs->section_line); in cs_gem_begin()
293 cs->section_ndw = ndw; in cs_gem_begin()
294 cs->section_cdw = 0; in cs_gem_begin()
295 cs->section_file = file; in cs_gem_begin()
296 cs->section_func = func; in cs_gem_begin()
297 cs->section_line = line; in cs_gem_begin()
299 if (cs->cdw + ndw > cs->ndw) { in cs_gem_begin()
303 tmp = (cs->cdw + ndw + 0x3FF) & (~0x3FF); in cs_gem_begin()
304 ptr = (uint32_t*)realloc(cs->packets, 4 * tmp); in cs_gem_begin()
308 cs->packets = ptr; in cs_gem_begin()
309 cs->ndw = tmp; in cs_gem_begin()
314 static int cs_gem_end(struct radeon_cs_int *cs, in cs_gem_end() argument
320 if (!cs->section_ndw) { in cs_gem_end()
325 if (cs->section_ndw != cs->section_cdw) { in cs_gem_end()
327 … cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw); in cs_gem_end()
332 cs->section_ndw = 0; in cs_gem_end()
335 cs->section_ndw = 0; in cs_gem_end()
340 static void cs_gem_dump_bof(struct radeon_cs_int *cs) in cs_gem_dump_bof() argument
342 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_dump_bof()
348 csm = (struct radeon_cs_manager_gem *)cs->csm; in cs_gem_dump_bof()
369 blob = bof_blob(cs->cdw * 4, cs->packets); in cs_gem_dump_bof()
427 static int cs_gem_emit(struct radeon_cs_int *cs) in cs_gem_emit() argument
429 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_emit()
434 while (cs->cdw & 7) in cs_gem_emit()
435 radeon_cs_write_dword((struct radeon_cs *)cs, 0x80000000); in cs_gem_emit()
438 cs_gem_dump_bof(cs); in cs_gem_emit()
440 csg->chunks[0].length_dw = cs->cdw; in cs_gem_emit()
445 csg->cs.num_chunks = 2; in cs_gem_emit()
446 csg->cs.chunks = (uint64_t)(uintptr_t)chunk_array; in cs_gem_emit()
448 r = drmCommandWriteRead(cs->csm->fd, DRM_RADEON_CS, in cs_gem_emit()
449 &csg->cs, sizeof(struct drm_radeon_cs)); in cs_gem_emit()
453 … atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id); in cs_gem_emit()
458 cs->csm->read_used = 0; in cs_gem_emit()
459 cs->csm->vram_write_used = 0; in cs_gem_emit()
460 cs->csm->gart_write_used = 0; in cs_gem_emit()
464 static int cs_gem_destroy(struct radeon_cs_int *cs) in cs_gem_destroy() argument
466 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_destroy()
468 free_id(cs->id); in cs_gem_destroy()
470 free(cs->relocs); in cs_gem_destroy()
471 free(cs->packets); in cs_gem_destroy()
472 free(cs); in cs_gem_destroy()
476 static int cs_gem_erase(struct radeon_cs_int *cs) in cs_gem_erase() argument
478 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_erase()
485 … atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id); in cs_gem_erase()
491 cs->relocs_total_size = 0; in cs_gem_erase()
492 cs->cdw = 0; in cs_gem_erase()
493 cs->section_ndw = 0; in cs_gem_erase()
494 cs->crelocs = 0; in cs_gem_erase()
500 static int cs_gem_need_flush(struct radeon_cs_int *cs) in cs_gem_need_flush() argument
505 static void cs_gem_print(struct radeon_cs_int *cs, FILE *file) in cs_gem_print() argument
510 csm = (struct radeon_cs_manager_gem *)cs->csm; in cs_gem_print()
512 for (i = 0; i < cs->cdw; i++) { in cs_gem_print()
513 fprintf(file, "0x%08X\n", cs->packets[i]); in cs_gem_print()