diff options
author | Kenneth Graunke <[email protected]> | 2017-05-03 19:24:32 -0700 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-05-08 11:33:00 +0100 |
commit | 0eaab97f2196d171f542d3fdab446e3aeb62d3dd (patch) | |
tree | be9440867fd0164bda9c9b38c7595c5e5a80d176 /src/mesa | |
parent | b0394dfe2f8df8fbc748a5d181e1511d68e84afc (diff) |
i965: Don't try to unmap NULL program cache BO.
When running shader-db with intel_stub and recent Mesa, context creation
fails when making a logical hardware context. In this case, we call
intelDestroyContext(), which gets here and tries to unmap the cache BO.
But there isn't one - we haven't made it yet. So we try to unmap a
NULL pointer, which used to be safe (it did nothing), but crashes
after commit 7c3b8ed87859bfdfb985d21685115a729f9cd138.
The result is that we crash rather than failing context creation with
a nice message. Either way nothing works, but this is more polite.
Cc: "17.1" <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
(cherry picked from commit bc074a45180eddf30ea723bbdf89895e2c7684ca)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program_cache.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c index c06ee23781c..b0e2962f88f 100644 --- a/src/mesa/drivers/dri/i965/brw_program_cache.c +++ b/src/mesa/drivers/dri/i965/brw_program_cache.c @@ -485,10 +485,13 @@ brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache) DBG("%s\n", __func__); - if (brw->has_llc) - brw_bo_unmap(cache->bo); - brw_bo_unreference(cache->bo); - cache->bo = NULL; + /* This can be NULL if context creation failed early on */ + if (cache->bo) { + if (brw->has_llc) + brw_bo_unmap(cache->bo); + brw_bo_unreference(cache->bo); + cache->bo = NULL; + } brw_clear_cache(brw, cache); free(cache->items); cache->items = NULL; |