Lines Matching refs:cs

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