summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <Rob Clark [email protected]>2013-04-22 13:42:55 -0400
committerRob Clark <[email protected]>2013-04-24 21:09:46 -0400
commit38d8b02eba9aea5b1ce61e8fc949163debda5cd7 (patch)
tree8a61e51d613292beb752009d0d61c2c729eedd74 /src/gallium/drivers/freedreno
parenta64e2d9d9fc111c709d91bbad174b5a29b882245 (diff)
freedreno: implement fd_screen_destroy()
Opps, didn't notice that I had left it stubbed out. Also, make things fail a bit more gracefully when things go wrong. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 4a9a54e3aea..336d0306ec9 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -111,8 +111,15 @@ fd_screen_fence_finish(struct pipe_screen *screen,
static void
fd_screen_destroy(struct pipe_screen *pscreen)
{
- // TODO
- DBG("TODO");
+ struct fd_screen *screen = fd_screen(pscreen);
+
+ if (screen->pipe)
+ fd_pipe_del(screen->pipe);
+
+ if (screen->dev)
+ fd_device_del(screen->dev);
+
+ free(screen);
}
/*
@@ -445,20 +452,29 @@ fd_screen_create(struct fd_device *dev)
if (!screen)
return NULL;
- DBG("");
+ pscreen = &screen->base;
screen->dev = dev;
// maybe this should be in context?
screen->pipe = fd_pipe_new(screen->dev, FD_PIPE_3D);
+ if (!screen->pipe) {
+ DBG("could not create 3d pipe");
+ goto fail;
+ }
- fd_pipe_get_param(screen->pipe, FD_GMEM_SIZE, &val);
+ if (fd_pipe_get_param(screen->pipe, FD_GMEM_SIZE, &val)) {
+ DBG("could not get GMEM size");
+ goto fail;
+ }
screen->gmemsize_bytes = val;
- fd_pipe_get_param(screen->pipe, FD_DEVICE_ID, &val);
+ if (fd_pipe_get_param(screen->pipe, FD_DEVICE_ID, &val)) {
+ DBG("could not get device-id");
+ goto fail;
+ }
screen->device_id = val;
- pscreen = &screen->base;
pscreen->destroy = fd_screen_destroy;
pscreen->get_param = fd_screen_get_param;
@@ -481,4 +497,8 @@ fd_screen_create(struct fd_device *dev)
util_format_s3tc_init();
return pscreen;
+
+fail:
+ fd_screen_destroy(pscreen);
+ return NULL;
}