Lines Matching defs:csg
128 struct cs_gem *csg;
134 csg = (struct cs_gem*)calloc(1, sizeof(struct cs_gem));
135 if (csg == NULL) {
138 csg->base.csm = csm;
139 csg->base.ndw = 64 * 1024 / 4;
140 csg->base.packets = (uint32_t*)calloc(1, 64 * 1024);
141 if (csg->base.packets == NULL) {
142 free(csg);
145 csg->base.relocs_total_size = 0;
146 csg->base.crelocs = 0;
147 csg->base.id = generate_id();
148 csg->nrelocs = 4096 / (4 * 4) ;
149 csg->relocs_bo = (struct radeon_bo_int**)calloc(1,
150 csg->nrelocs*sizeof(void*));
151 if (csg->relocs_bo == NULL) {
152 free(csg->base.packets);
153 free(csg);
156 csg->base.relocs = csg->relocs = (uint32_t*)calloc(1, 4096);
157 if (csg->relocs == NULL) {
158 free(csg->relocs_bo);
159 free(csg->base.packets);
160 free(csg);
163 csg->chunks[0].chunk_id = RADEON_CHUNK_ID_IB;
164 csg->chunks[0].length_dw = 0;
165 csg->chunks[0].chunk_data = (uint64_t)(uintptr_t)csg->base.packets;
166 csg->chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
167 csg->chunks[1].length_dw = 0;
168 csg->chunks[1].chunk_data = (uint64_t)(uintptr_t)csg->relocs;
169 return (struct radeon_cs_int*)csg;
179 struct cs_gem *csg = (struct cs_gem*)cs;
208 reloc = (struct cs_reloc_gem*)&csg->relocs[idx];
241 if (csg->base.crelocs >= csg->nrelocs) {
244 size = ((csg->nrelocs + 1) * sizeof(struct radeon_bo*));
245 tmp = (uint32_t*)realloc(csg->relocs_bo, size);
249 csg->relocs_bo = (struct radeon_bo_int **)tmp;
250 size = ((csg->nrelocs + 1) * RELOC_SIZE * 4);
251 tmp = (uint32_t*)realloc(csg->relocs, size);
255 cs->relocs = csg->relocs = tmp;
256 csg->nrelocs += 1;
257 csg->chunks[1].chunk_data = (uint64_t)(uintptr_t)csg->relocs;
259 csg->relocs_bo[csg->base.crelocs] = boi;
260 idx = (csg->base.crelocs++) * RELOC_SIZE;
261 reloc = (struct cs_reloc_gem*)&csg->relocs[idx];
266 csg->chunks[1].length_dw += RELOC_SIZE;
339 struct cs_gem *csg = (struct cs_gem*)cs;
358 blob = bof_blob(csg->nrelocs * 16, csg->relocs);
377 for (i = 0; i < csg->base.crelocs; i++) {
381 size = bof_int32(csg->relocs_bo[i]->size);
388 handle = bof_int32(csg->relocs_bo[i]->handle);
395 radeon_bo_map((struct radeon_bo*)csg->relocs_bo[i], 0);
396 blob = bof_blob(csg->relocs_bo[i]->size, csg->relocs_bo[i]->ptr);
397 radeon_bo_unmap((struct radeon_bo*)csg->relocs_bo[i]);
426 struct cs_gem *csg = (struct cs_gem*)cs;
437 csg->chunks[0].length_dw = cs->cdw;
439 chunk_array[0] = (uint64_t)(uintptr_t)&csg->chunks[0];
440 chunk_array[1] = (uint64_t)(uintptr_t)&csg->chunks[1];
442 csg->cs.num_chunks = 2;
443 csg->cs.chunks = (uint64_t)(uintptr_t)chunk_array;
446 &csg->cs, sizeof(struct drm_radeon_cs));
447 for (i = 0; i < csg->base.crelocs; i++) {
448 csg->relocs_bo[i]->space_accounted = 0;
450 atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id);
451 radeon_bo_unref((struct radeon_bo *)csg->relocs_bo[i]);
452 csg->relocs_bo[i] = NULL;
463 struct cs_gem *csg = (struct cs_gem*)cs;
466 free(csg->relocs_bo);
475 struct cs_gem *csg = (struct cs_gem*)cs;
478 if (csg->relocs_bo) {
479 for (i = 0; i < csg->base.crelocs; i++) {
480 if (csg->relocs_bo[i]) {
482 atomic_dec((atomic_t *)radeon_gem_get_reloc_in_cs((struct radeon_bo*)csg->relocs_bo[i]), cs->id);
483 radeon_bo_unref((struct radeon_bo *)csg->relocs_bo[i]);
484 csg->relocs_bo[i] = NULL;
492 csg->chunks[0].length_dw = 0;
493 csg->chunks[1].length_dw = 0;