i965: Fix reference counting in new basevertex upload code.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 10 Sep 2014 22:41:39 +0000 (15:41 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 12 Sep 2014 23:23:02 +0000 (16:23 -0700)
commite980fe607155c79ccba56ef78854093b7730bef6
treedd80392e991a56599ebc3e8f4ca1c80578f722fa
parent9b6281a7da02759b0e7570d611e27fe541ffebd6
i965: Fix reference counting in new basevertex upload code.

In the non-indirect draw case, we call intel_upload_data to upload
gl_BaseVertex.  It makes brw->draw.draw_params_bo point to the upload
buffer, and increments the upload BO reference count.

So, we need to unreference it when making brw->draw.draw_params_bo point
at something else, or else we'll retain a reference to stale upload
buffers and hold on to them forever.

This also means that the indirect case should increment the reference
count on the indirect draw buffer when making brw->draw.draw_params_bo
point at it.  That way, both paths increment the reference count, so
we can safely unreference it every time.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.3" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_draw.c