[PATCH RFC 093/111] staging: etnaviv: take gpu instead of pipe as input to fence wait function

Lucas Stach l.stach at pengutronix.de
Thu Apr 2 08:30:35 PDT 2015


Other users may only have the gpu pointer available and it's easy to convert
from pipe to gpu in the ioctl path.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 drivers/staging/etnaviv/etnaviv_drv.c | 24 +++++++++++++-----------
 drivers/staging/etnaviv/etnaviv_drv.h |  5 +++--
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/etnaviv/etnaviv_drv.c b/drivers/staging/etnaviv/etnaviv_drv.c
index 83cab36170f3..30896f9afa1a 100644
--- a/drivers/staging/etnaviv/etnaviv_drv.c
+++ b/drivers/staging/etnaviv/etnaviv_drv.c
@@ -301,20 +301,13 @@ static void etnaviv_debugfs_cleanup(struct drm_minor *minor)
 /*
  * Fences:
  */
-int etnaviv_wait_fence_interruptable(struct drm_device *dev, uint32_t pipe,
-		uint32_t fence, struct timespec *timeout)
+int etnaviv_wait_fence_interruptable(struct drm_device *dev,
+		struct etnaviv_gpu *gpu, uint32_t fence,
+		struct timespec *timeout)
 {
 	struct etnaviv_drm_private *priv = dev->dev_private;
-	struct etnaviv_gpu *gpu;
 	int ret;
 
-	if (pipe >= ETNA_MAX_PIPES)
-		return -EINVAL;
-
-	gpu = priv->gpu[pipe];
-	if (!gpu)
-		return -ENXIO;
-
 	if (fence_after(fence, gpu->submitted_fence)) {
 		DRM_ERROR("waiting on invalid fence: %u (of %u)\n",
 				fence, gpu->submitted_fence);
@@ -458,9 +451,18 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data,
 static int etnaviv_ioctl_wait_fence(struct drm_device *dev, void *data,
 		struct drm_file *file)
 {
+	struct etnaviv_drm_private *priv = dev->dev_private;
+	struct etnaviv_gpu *gpu;
 	struct drm_etnaviv_wait_fence *args = data;
 
-	return etnaviv_wait_fence_interruptable(dev, args->pipe, args->fence,
+	if (args->pipe >= ETNA_MAX_PIPES)
+		return -EINVAL;
+
+	gpu = priv->gpu[args->pipe];
+	if (!gpu)
+		return -ENODEV;
+
+	return etnaviv_wait_fence_interruptable(dev, gpu, args->fence,
 						&TS(args->timeout));
 }
 
diff --git a/drivers/staging/etnaviv/etnaviv_drv.h b/drivers/staging/etnaviv/etnaviv_drv.h
index 4c848afab876..5c3250b772cc 100644
--- a/drivers/staging/etnaviv/etnaviv_drv.h
+++ b/drivers/staging/etnaviv/etnaviv_drv.h
@@ -68,8 +68,9 @@ struct etnaviv_drm_private {
 
 void etnaviv_register_mmu(struct drm_device *dev, struct etnaviv_iommu *mmu);
 
-int etnaviv_wait_fence_interruptable(struct drm_device *dev, uint32_t pipe,
-		uint32_t fence,	struct timespec *timeout);
+int etnaviv_wait_fence_interruptable(struct drm_device *dev,
+		struct etnaviv_gpu *gpu, uint32_t fence,
+		struct timespec *timeout);
 void etnaviv_update_fence(struct drm_device *dev, uint32_t fence);
 
 int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
-- 
2.1.4



More information about the dri-devel mailing list