Lines Matching refs:cs
74 struct drm_radeon_cs cs; member
172 static int cs_gem_write_reloc(struct radeon_cs_int *cs, in cs_gem_write_reloc() argument
179 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_write_reloc()
201 if ((atomic_read((atomic_t *)radeon_gem_get_reloc_in_cs(bo)) & cs->id)) { in cs_gem_write_reloc()
205 for(i = cs->crelocs; i != 0;) { in cs_gem_write_reloc()
234 radeon_cs_write_dword((struct radeon_cs *)cs, 0xc0001000); in cs_gem_write_reloc()
235 radeon_cs_write_dword((struct radeon_cs *)cs, idx); in cs_gem_write_reloc()
255 cs->relocs = csg->relocs = tmp; in cs_gem_write_reloc()
269 atomic_add((atomic_t *)radeon_gem_get_reloc_in_cs(bo), cs->id); in cs_gem_write_reloc()
270 cs->relocs_total_size += boi->size; in cs_gem_write_reloc()
271 radeon_cs_write_dword((struct radeon_cs *)cs, 0xc0001000); in cs_gem_write_reloc()
272 radeon_cs_write_dword((struct radeon_cs *)cs, idx); in cs_gem_write_reloc()
276 static int cs_gem_begin(struct radeon_cs_int *cs, in cs_gem_begin() argument
283 if (cs->section_ndw) { in cs_gem_begin()
285 cs->section_file, cs->section_func, cs->section_line); in cs_gem_begin()
290 cs->section_ndw = ndw; in cs_gem_begin()
291 cs->section_cdw = 0; in cs_gem_begin()
292 cs->section_file = file; in cs_gem_begin()
293 cs->section_func = func; in cs_gem_begin()
294 cs->section_line = line; in cs_gem_begin()
296 if (cs->cdw + ndw > cs->ndw) { in cs_gem_begin()
300 tmp = (cs->cdw + ndw + 0x3FF) & (~0x3FF); in cs_gem_begin()
301 ptr = (uint32_t*)realloc(cs->packets, 4 * tmp); in cs_gem_begin()
305 cs->packets = ptr; in cs_gem_begin()
306 cs->ndw = tmp; in cs_gem_begin()
311 static int cs_gem_end(struct radeon_cs_int *cs, in cs_gem_end() argument
317 if (!cs->section_ndw) { in cs_gem_end()
322 if (cs->section_ndw != cs->section_cdw) { in cs_gem_end()
324 … cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw); in cs_gem_end()
329 cs->section_ndw = 0; in cs_gem_end()
332 cs->section_ndw = 0; in cs_gem_end()
337 static void cs_gem_dump_bof(struct radeon_cs_int *cs) in cs_gem_dump_bof() argument
339 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_dump_bof()
345 csm = (struct radeon_cs_manager_gem *)cs->csm; in cs_gem_dump_bof()
366 blob = bof_blob(cs->cdw * 4, cs->packets); in cs_gem_dump_bof()
424 static int cs_gem_emit(struct radeon_cs_int *cs) in cs_gem_emit() argument
426 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_emit()
431 while (cs->cdw & 7) in cs_gem_emit()
432 radeon_cs_write_dword((struct radeon_cs *)cs, 0x80000000); in cs_gem_emit()
435 cs_gem_dump_bof(cs); in cs_gem_emit()
437 csg->chunks[0].length_dw = cs->cdw; in cs_gem_emit()
442 csg->cs.num_chunks = 2; in cs_gem_emit()
443 csg->cs.chunks = (uint64_t)(uintptr_t)chunk_array; in cs_gem_emit()
445 r = drmCommandWriteRead(cs->csm->fd, DRM_RADEON_CS, in cs_gem_emit()
446 &csg->cs, sizeof(struct drm_radeon_cs)); in cs_gem_emit()
450 … atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id); in cs_gem_emit()
455 cs->csm->read_used = 0; in cs_gem_emit()
456 cs->csm->vram_write_used = 0; in cs_gem_emit()
457 cs->csm->gart_write_used = 0; in cs_gem_emit()
461 static int cs_gem_destroy(struct radeon_cs_int *cs) in cs_gem_destroy() argument
463 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_destroy()
465 free_id(cs->id); in cs_gem_destroy()
467 free(cs->relocs); in cs_gem_destroy()
468 free(cs->packets); in cs_gem_destroy()
469 free(cs); in cs_gem_destroy()
473 static int cs_gem_erase(struct radeon_cs_int *cs) in cs_gem_erase() argument
475 struct cs_gem *csg = (struct cs_gem*)cs; in cs_gem_erase()
482 … atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id); in cs_gem_erase()
488 cs->relocs_total_size = 0; in cs_gem_erase()
489 cs->cdw = 0; in cs_gem_erase()
490 cs->section_ndw = 0; in cs_gem_erase()
491 cs->crelocs = 0; in cs_gem_erase()
497 static int cs_gem_need_flush(struct radeon_cs_int *cs) in cs_gem_need_flush() argument
502 static void cs_gem_print(struct radeon_cs_int *cs, FILE *file) in cs_gem_print() argument
507 csm = (struct radeon_cs_manager_gem *)cs->csm; in cs_gem_print()
509 for (i = 0; i < cs->cdw; i++) { in cs_gem_print()
510 fprintf(file, "0x%08X\n", cs->packets[i]); in cs_gem_print()