pctx = &fd2_ctx->base.base;
+ fd2_ctx->base.dev = fd_device_ref(screen->dev);
+
pctx->destroy = fd2_context_destroy;
pctx->create_blend_state = fd2_blend_state_create;
pctx->create_rasterizer_state = fd2_rasterizer_state_create;
pctx = &fd3_ctx->base.base;
+ fd3_ctx->base.dev = fd_device_ref(screen->dev);
fd3_ctx->base.screen = fd_screen(pscreen);
pctx->destroy = fd3_context_destroy;
struct fd_vsc_pipe *pipe = &ctx->pipe[i];
if (!pipe->bo) {
- pipe->bo = fd_bo_new(ctx->screen->dev, 0x40000,
+ pipe->bo = fd_bo_new(ctx->dev, 0x40000,
DRM_FREEDRENO_GEM_TYPE_KMEM);
}
bin = ir3_shader_assemble(so->ir, &so->info);
sz = so->info.sizedwords * 4;
- so->bo = fd_bo_new(ctx->screen->dev, sz,
+ so->bo = fd_bo_new(ctx->dev, sz,
DRM_FREEDRENO_GEM_CACHE_WCOMBINE |
DRM_FREEDRENO_GEM_TYPE_KMEM);
fd_bo_del(pipe->bo);
}
+ fd_device_del(ctx->dev);
+
FREE(ctx);
}
struct fd_context {
struct pipe_context base;
+ struct fd_device *dev;
struct fd_screen *screen;
struct blitter_context *blitter;
struct primconvert_context *primconvert;
struct pipe_screen *
fd_drm_screen_create(int fd)
{
- struct fd_device *dev = fd_device_new(fd);
+ struct fd_device *dev = fd_device_new_dup(fd);
if (!dev)
return NULL;
return fd_screen_create(dev);