2328,101 → 2328,6 |
return 0; |
} |
|
#ifdef CONFIG_DRM_RADEON_UMS |
|
/** |
* cs_parser_fini() - clean parser states |
* @parser: parser structure holding parsing context. |
* @error: error number |
* |
* If error is set than unvalidate buffer, otherwise just free memory |
* used by parsing context. |
**/ |
static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error) |
{ |
unsigned i; |
|
kfree(parser->relocs); |
for (i = 0; i < parser->nchunks; i++) |
drm_free_large(parser->chunks[i].kdata); |
kfree(parser->chunks); |
kfree(parser->chunks_array); |
} |
|
static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p) |
{ |
if (p->chunk_relocs == NULL) { |
return 0; |
} |
p->relocs = kzalloc(sizeof(struct radeon_bo_list), GFP_KERNEL); |
if (p->relocs == NULL) { |
return -ENOMEM; |
} |
return 0; |
} |
|
int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp, |
unsigned family, u32 *ib, int *l) |
{ |
struct radeon_cs_parser parser; |
struct radeon_cs_chunk *ib_chunk; |
struct r600_cs_track *track; |
int r; |
|
/* initialize tracker */ |
track = kzalloc(sizeof(*track), GFP_KERNEL); |
if (track == NULL) |
return -ENOMEM; |
r600_cs_track_init(track); |
r600_cs_legacy_get_tiling_conf(dev, &track->npipes, &track->nbanks, &track->group_size); |
/* initialize parser */ |
memset(&parser, 0, sizeof(struct radeon_cs_parser)); |
parser.filp = filp; |
parser.dev = &dev->pdev->dev; |
parser.rdev = NULL; |
parser.family = family; |
parser.track = track; |
parser.ib.ptr = ib; |
r = radeon_cs_parser_init(&parser, data); |
if (r) { |
DRM_ERROR("Failed to initialize parser !\n"); |
r600_cs_parser_fini(&parser, r); |
return r; |
} |
r = r600_cs_parser_relocs_legacy(&parser); |
if (r) { |
DRM_ERROR("Failed to parse relocation !\n"); |
r600_cs_parser_fini(&parser, r); |
return r; |
} |
/* Copy the packet into the IB, the parser will read from the |
* input memory (cached) and write to the IB (which can be |
* uncached). */ |
ib_chunk = parser.chunk_ib; |
parser.ib.length_dw = ib_chunk->length_dw; |
*l = parser.ib.length_dw; |
if (copy_from_user(ib, ib_chunk->user_ptr, ib_chunk->length_dw * 4)) { |
r = -EFAULT; |
r600_cs_parser_fini(&parser, r); |
return r; |
} |
r = r600_cs_parse(&parser); |
if (r) { |
DRM_ERROR("Invalid command stream !\n"); |
r600_cs_parser_fini(&parser, r); |
return r; |
} |
r600_cs_parser_fini(&parser, r); |
return r; |
} |
|
void r600_cs_legacy_init(void) |
{ |
r600_nomm = 1; |
} |
|
#endif |
|
/* |
* DMA |
*/ |