drm/fence: add drm_crtc_create_fence()
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Tue, 6 Dec 2016 17:47:17 +0000 (15:47 -0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 7 Dec 2016 13:16:55 +0000 (11:16 -0200)
Instead of dealing with crtc details inside drm_atomic.c we should
just export a function that creates a new crtc fence for us and
use that.

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1481046437-18778-1-git-send-email-gustavo@padovan.org
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_crtc_internal.h

index 19d7bcb882177795f941f7898decba22ac7cb9e9..72fa5b20baf1ad675865a90a79d8a36671b2c307 100644 (file)
@@ -1864,20 +1864,6 @@ EXPORT_SYMBOL(drm_atomic_clean_old_fb);
  *     helpers and for the DRM event handling for existing userspace.
  */
 
-static struct dma_fence *get_crtc_fence(struct drm_crtc *crtc)
-{
-       struct dma_fence *fence;
-
-       fence = kzalloc(sizeof(*fence), GFP_KERNEL);
-       if (!fence)
-               return NULL;
-
-       dma_fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock,
-                      crtc->fence_context, ++crtc->fence_seqno);
-
-       return fence;
-}
-
 struct drm_out_fence_state {
        s64 __user *out_fence_ptr;
        struct sync_file *sync_file;
@@ -1959,7 +1945,7 @@ static int prepare_crtc_signaling(struct drm_device *dev,
                        f[*num_fences].out_fence_ptr = fence_ptr;
                        *fence_state = f;
 
-                       fence = get_crtc_fence(crtc);
+                       fence = drm_crtc_create_fence(crtc);
                        if (!fence)
                                return -ENOMEM;
 
index 90931e03973136fd9a82c6ae3775e5875011906a..e75f62cd8a65f96afbd3d06d27deeb72c495e465 100644 (file)
@@ -152,6 +152,8 @@ static void drm_crtc_crc_fini(struct drm_crtc *crtc)
 #endif
 }
 
+static const struct dma_fence_ops drm_crtc_fence_ops;
+
 static struct drm_crtc *fence_to_crtc(struct dma_fence *fence)
 {
        BUG_ON(fence->ops != &drm_crtc_fence_ops);
@@ -177,13 +179,27 @@ static bool drm_crtc_fence_enable_signaling(struct dma_fence *fence)
        return true;
 }
 
-const struct dma_fence_ops drm_crtc_fence_ops = {
+static const struct dma_fence_ops drm_crtc_fence_ops = {
        .get_driver_name = drm_crtc_fence_get_driver_name,
        .get_timeline_name = drm_crtc_fence_get_timeline_name,
        .enable_signaling = drm_crtc_fence_enable_signaling,
        .wait = dma_fence_default_wait,
 };
 
+struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc)
+{
+       struct dma_fence *fence;
+
+       fence = kzalloc(sizeof(*fence), GFP_KERNEL);
+       if (!fence)
+               return NULL;
+
+       dma_fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock,
+                      crtc->fence_context, ++crtc->fence_seqno);
+
+       return fence;
+}
+
 /**
  * drm_crtc_init_with_planes - Initialise a new CRTC object with
  *    specified primary and cursor planes.
index 33b17d0b127e732ca749e0de4c02e521ba640cd4..cdf6860c9d2297a40acae8684296b067d35dd7d4 100644 (file)
@@ -43,7 +43,7 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
 int drm_crtc_register_all(struct drm_device *dev);
 void drm_crtc_unregister_all(struct drm_device *dev);
 
-extern const struct dma_fence_ops drm_crtc_fence_ops;
+struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
 
 /* IOCTLs */
 int drm_mode_getcrtc(struct drm_device *dev,