freedreno: add fd_device_new_dup()
authorRob Clark <robclark@freedesktop.org>
Sun, 12 Jan 2014 13:27:36 +0000 (08:27 -0500)
committerRob Clark <robclark@freedesktop.org>
Sun, 12 Jan 2014 14:00:51 +0000 (09:00 -0500)
commit8279c8fb498785ea2700c6cc4a3456d7e1134665
tree3c18768a0b69bf294fd0bc3db5d59d3dbacdbc07
parentde0970203091618834e4753c14d5169770797800
freedreno: add fd_device_new_dup()

There seem to be some cases (I've noticed this switching resolution in
some games, for example) where the fd can get closed() before the device
and all it's bo's are destroyed.  Which, if the drm device is opened
again and bo's are allocated with the same handles, results that when
the first pipe_screen/pipe_context is destroyed causes the first dev to
close handles for bo's allocated by the second device.

The easy solution to that is to add a mode where the fd_device creates
it's own private fd (a dup()).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
freedreno/freedreno_device.c
freedreno/freedreno_drmif.h
freedreno/freedreno_priv.h