OSDN Git Service

drm/vc4: Allocate binner bo when starting to use the V3D
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Thu, 16 May 2019 14:55:44 +0000 (16:55 +0200)
committerPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Thu, 23 May 2019 15:32:21 +0000 (17:32 +0200)
commit35c8b4b2c0fed637d2b30a8ec8e5d7f4c19c8d9d
treed8503e093574d4465205c69e54b5383b7c11557a
parente43fe02fe4fde417b40f6e70b56a30190edabb2e
drm/vc4: Allocate binner bo when starting to use the V3D

The binner BO is not required until the V3D is in use, so avoid
allocating it at probe and do it on the first non-dumb BO allocation.

Keep track of which clients are using the V3D and liberate the buffer
when there is none left, using a kref. Protect the logic with a
mutex to avoid race conditions.

The binner BO is created at the time of the first render ioctl and is
destroyed when there is no client and no exec job using it left.

The Out-Of-Memory (OOM) interrupt also gets some tweaking, to avoid
enabling it before having allocated a binner bo.

We also want to keep the BO alive during runtime suspend/resume to avoid
failing to allocate it at resume. This happens when the CMA pool is
full at that point and results in a hard crash.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190516145544.29051-5-paul.kocialkowski@bootlin.com
drivers/gpu/drm/vc4/vc4_bo.c
drivers/gpu/drm/vc4/vc4_drv.c
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_gem.c
drivers/gpu/drm/vc4/vc4_irq.c
drivers/gpu/drm/vc4/vc4_v3d.c