mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
BACKPORT: drm/fence: add drm_crtc_create_fence()
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
(cherry picked from commit 35f8cc3b9a)
Signed-off-by: Marissa Wall <marissaw@google.com>
Change-Id: Ia127dc391cb0b6e8adb283a12009466f86e9df1b
This commit is contained in:
committed by
Marissa Wall
parent
50696b306d
commit
34e0b7db8c
@@ -1708,20 +1708,6 @@ EXPORT_SYMBOL(drm_atomic_clean_old_fb);
|
||||
* helpers and for the DRM event handling for existing userspace.
|
||||
*/
|
||||
|
||||
static struct fence *get_crtc_fence(struct drm_crtc *crtc)
|
||||
{
|
||||
struct fence *fence;
|
||||
|
||||
fence = kzalloc(sizeof(*fence), GFP_KERNEL);
|
||||
if (!fence)
|
||||
return NULL;
|
||||
|
||||
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;
|
||||
@@ -1803,7 +1789,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;
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ static void drm_crtc_unregister_all(struct drm_device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static const struct fence_ops drm_crtc_fence_ops;
|
||||
|
||||
static struct drm_crtc *fence_to_crtc(struct fence *fence)
|
||||
{
|
||||
BUG_ON(fence->ops != &drm_crtc_fence_ops);
|
||||
@@ -167,13 +169,27 @@ static bool drm_crtc_fence_enable_signaling(struct fence *fence)
|
||||
return true;
|
||||
}
|
||||
|
||||
const struct fence_ops drm_crtc_fence_ops = {
|
||||
static const struct 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 = fence_default_wait,
|
||||
};
|
||||
|
||||
struct fence *drm_crtc_create_fence(struct drm_crtc *crtc)
|
||||
{
|
||||
struct fence *fence;
|
||||
|
||||
fence = kzalloc(sizeof(*fence), GFP_KERNEL);
|
||||
if (!fence)
|
||||
return NULL;
|
||||
|
||||
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.
|
||||
|
||||
@@ -41,7 +41,7 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_framebuffer *fb);
|
||||
|
||||
extern const struct fence_ops drm_crtc_fence_ops;
|
||||
struct fence *drm_crtc_create_fence(struct drm_crtc *crtc);
|
||||
|
||||
void drm_fb_release(struct drm_file *file_priv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user