-static struct pipe_context *
-nouveau_drm_create_context(struct drm_api *api, struct pipe_screen *pscreen)
-{
- struct nouveau_winsys *nvws = nouveau_winsys_screen(pscreen);
- struct pipe_context *(*init)(struct pipe_screen *, unsigned);
- unsigned chipset = nouveau_screen(pscreen)->device->chipset;
- int i;
-
- switch (chipset & 0xf0) {
- case 0x00:
- init = nv04_create;
- break;
- case 0x10:
- init = nv10_create;
- break;
- case 0x20:
- init = nv20_create;
- break;
- case 0x30:
- init = nv30_create;
- break;
- case 0x40:
- case 0x60:
- init = nv40_create;
- break;
- case 0x80:
- case 0x90:
- case 0xa0:
- init = nv50_create;
- break;
- default:
- debug_printf("%s: unknown chipset nv%02x\n", __func__, chipset);
- return NULL;
- }
-
- /* Find a free slot for a pipe context, allocate a new one if needed */
- for (i = 0; i < nvws->nr_pctx; i++) {
- if (nvws->pctx[i] == NULL)
- break;
- }
-
- if (i == nvws->nr_pctx) {
- nvws->nr_pctx++;
- nvws->pctx = realloc(nvws->pctx,
- sizeof(*nvws->pctx) * nvws->nr_pctx);
- }
-
- nvws->pctx[i] = init(pscreen, i);
- return nvws->pctx[i];
-}
-
-typedef struct pipe_video_context* (*nouveau_video_create)(struct pipe_context *pipe,
- enum pipe_video_profile profile,
- enum pipe_video_chroma_format chroma_format,
- unsigned width, unsigned height,
- unsigned pvctx);
-
-static struct pipe_video_context *
-nouveau_drm_create_video_context(struct drm_api *api, struct pipe_screen *pscreen,
- enum pipe_video_profile profile,
- enum pipe_video_chroma_format chroma_format,
- unsigned width, unsigned height)
-{
- struct nouveau_winsys *nvws = nouveau_winsys_screen(pscreen);
- nouveau_video_create init;
- unsigned chipset = nouveau_screen(pscreen)->device->chipset;
- struct pipe_context *pipe;
- int i;
-
- switch (chipset & 0xf0) {
- case 0x40:
- case 0x60:
- init = nv40_video_create;
- break;
- default:
- debug_printf("%s: unknown chipset nv%02x\n", __func__, chipset);
- return NULL;
- }
-
- /* Find a free slot for a pipe video context, allocate a new one if needed */
- for (i = 0; i < nvws->nr_pvctx; i++) {
- if (nvws->pvctx[i] == NULL)
- break;
- }
-
- if (i == nvws->nr_pvctx) {
- nvws->nr_pvctx++;
- nvws->pvctx = realloc(nvws->pvctx,
- sizeof(*nvws->pvctx) * nvws->nr_pvctx);
- }
-
- pipe = nouveau_drm_create_context(api, pscreen);
- if (!pipe)
- return NULL;
-
- nvws->pvctx[i] = init(pipe, profile, chroma_format, width, height, i);
- return nvws->pvctx[i];
-}
-