Lines Matching defs:csg

131     struct cs_gem *csg;
137 csg = (struct cs_gem*)calloc(1, sizeof(struct cs_gem));
138 if (csg == NULL) {
141 csg->base.csm = csm;
142 csg->base.ndw = 64 * 1024 / 4;
143 csg->base.packets = (uint32_t*)calloc(1, 64 * 1024);
144 if (csg->base.packets == NULL) {
145 free(csg);
148 csg->base.relocs_total_size = 0;
149 csg->base.crelocs = 0;
150 csg->base.id = generate_id();
151 csg->nrelocs = 4096 / (4 * 4) ;
152 csg->relocs_bo = (struct radeon_bo_int**)calloc(1,
153 csg->nrelocs*sizeof(void*));
154 if (csg->relocs_bo == NULL) {
155 free(csg->base.packets);
156 free(csg);
159 csg->base.relocs = csg->relocs = (uint32_t*)calloc(1, 4096);
160 if (csg->relocs == NULL) {
161 free(csg->relocs_bo);
162 free(csg->base.packets);
163 free(csg);
166 csg->chunks[0].chunk_id = RADEON_CHUNK_ID_IB;
167 csg->chunks[0].length_dw = 0;
168 csg->chunks[0].chunk_data = (uint64_t)(uintptr_t)csg->base.packets;
169 csg->chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
170 csg->chunks[1].length_dw = 0;
171 csg->chunks[1].chunk_data = (uint64_t)(uintptr_t)csg->relocs;
172 return (struct radeon_cs_int*)csg;
182 struct cs_gem *csg = (struct cs_gem*)cs;
211 reloc = (struct cs_reloc_gem*)&csg->relocs[idx];
244 if (csg->base.crelocs >= csg->nrelocs) {
247 size = ((csg->nrelocs + 1) * sizeof(struct radeon_bo*));
248 tmp = (uint32_t*)realloc(csg->relocs_bo, size);
252 csg->relocs_bo = (struct radeon_bo_int **)tmp;
253 size = ((csg->nrelocs + 1) * RELOC_SIZE * 4);
254 tmp = (uint32_t*)realloc(csg->relocs, size);
258 cs->relocs = csg->relocs = tmp;
259 csg->nrelocs += 1;
260 csg->chunks[1].chunk_data = (uint64_t)(uintptr_t)csg->relocs;
262 csg->relocs_bo[csg->base.crelocs] = boi;
263 idx = (csg->base.crelocs++) * RELOC_SIZE;
264 reloc = (struct cs_reloc_gem*)&csg->relocs[idx];
269 csg->chunks[1].length_dw += RELOC_SIZE;
342 struct cs_gem *csg = (struct cs_gem*)cs;
361 blob = bof_blob(csg->nrelocs * 16, csg->relocs);
380 for (i = 0; i < csg->base.crelocs; i++) {
384 size = bof_int32(csg->relocs_bo[i]->size);
391 handle = bof_int32(csg->relocs_bo[i]->handle);
398 radeon_bo_map((struct radeon_bo*)csg->relocs_bo[i], 0);
399 blob = bof_blob(csg->relocs_bo[i]->size, csg->relocs_bo[i]->ptr);
400 radeon_bo_unmap((struct radeon_bo*)csg->relocs_bo[i]);
429 struct cs_gem *csg = (struct cs_gem*)cs;
440 csg->chunks[0].length_dw = cs->cdw;
442 chunk_array[0] = (uint64_t)(uintptr_t)&csg->chunks[0];
443 chunk_array[1] = (uint64_t)(uintptr_t)&csg->chunks[1];
445 csg->cs.num_chunks = 2;
446 csg->cs.chunks = (uint64_t)(uintptr_t)chunk_array;
449 &csg->cs, sizeof(struct drm_radeon_cs));
450 for (i = 0; i < csg->base.crelocs; i++) {
451 csg->relocs_bo[i]->space_accounted = 0;
453 atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id);
454 radeon_bo_unref((struct radeon_bo *)csg->relocs_bo[i]);
455 csg->relocs_bo[i] = NULL;
466 struct cs_gem *csg = (struct cs_gem*)cs;
469 free(csg->relocs_bo);
478 struct cs_gem *csg = (struct cs_gem*)cs;
481 if (csg->relocs_bo) {
482 for (i = 0; i < csg->base.crelocs; i++) {
483 if (csg->relocs_bo[i]) {
485 atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id);
486 radeon_bo_unref((struct radeon_bo *)csg->relocs_bo[i]);
487 csg->relocs_bo[i] = NULL;
495 csg->chunks[0].length_dw = 0;
496 csg->chunks[1].length_dw = 0;