On Saturday, May 5, 2018 12:49:18 AM PDT Chris Wilson wrote: > Quoting Chris Wilson (2018-05-04 22:27:27) > > Quoting Kenneth Graunke (2018-05-04 02:12:36) > > > + if (brw_using_softpin(bufmgr) && bo->gtt_offset == 0ull) { > > > + bo->gtt_offset = vma_alloc(bufmgr, memzone, bo->size, 1); > > > + > > > + if (bo->gtt_offset == 0ull) > > > + goto err_free; > > > + } > > > + > > > bo->name = name; > > > p_atomic_set(&bo->refcount, 1); > > > bo->reusable = true; > > > @@ -545,6 +792,9 @@ brw_bo_gem_create_from_name(struct brw_bufmgr *bufmgr, > > > bo->external = true; > > > bo->kflags = bufmgr->initial_kflags; > > > > > > + if (brw_using_softpin(bufmgr)) > > > + bo->gtt_offset = vma_alloc(bufmgr, BRW_MEMZONE_OTHER, bo->size, 1); > > > > At this point, I think you want bo_using_softpoin() and pull it from the > > kflags. Not any different today, but I think more defensive, especially > > on the free paths. > > In particular, err_free: is suspect in that it may try to free an > unassigned address. (Fortunately, it should be non-existent, but it > should throw a few errors!) > -Chris
Good catch. If vma_alloc fails, we would indeed try to vma_free(0ull). I'm reserving 0ull for NULL pointers, so I just made vma_free early return when passed 0ull to handle this case. Thanks!
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev