]> git.baikalelectronics.ru Git - kernel.git/commit
drm/qxl: Move main reference counter to GEM object instead of TTM ones
authorFrediano Ziglio <fziglio@redhat.com>
Wed, 3 Jun 2015 11:09:17 +0000 (12:09 +0100)
committerDave Airlie <airlied@redhat.com>
Fri, 5 Jun 2015 01:00:51 +0000 (11:00 +1000)
commit3a822f5abd1ec2d94ca54635aa853c46511d3f0b
treea3a566b77ad1db29f87be44eb98433cdcbf6f411
parentd85d85f2d7ffe5cecc16e07236c9c4bad045110e
drm/qxl: Move main reference counter to GEM object instead of TTM ones

qxl_bo structure has two reference counters, one in the GEM object and
another in the TTM object. The GEM object keep a counter to the TTM object
so when GEM counter reached zero the TTM counter (using qxl_bo_unref) was
decremented. The qxl object is fully freed (both GEM and TTM part are cleaned)
when the TTM counter reach zero.
One issue was that surface idr structure has no owning on qxl_bo objects however
it contains a pointer to qxl_bo object. This caused some nasty race condition
for instance qxl_bo object was reaped even after counter was already zero.
This patch fix these races moving main counter (the one used by qxl_bo_(un)ref)
to GEM object which cleanup routine (qxl_gem_object_free) remove the idr pointer
(using qxl_surface_evict) when the counters are still valid.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/qxl/qxl_gem.c
drivers/gpu/drm/qxl/qxl_object.c