Commit db8f4d5d authored by Sean Paul's avatar Sean Paul Committed by Rob Clark

drm/msm: Move implicit sync handling to prepare_fb

In preparation for moving to atomic helpers, move the implicit sync
fence handling out of atomic commit and into the plane->prepare_fb()
hook. While we're at it, de-duplicate the mdp*_prepare_fb functions.

Changes in v4:
- Added
Reported-by: default avatarRob Clark <robdclark@gmail.com>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 347b90b4
...@@ -98,21 +98,6 @@ static const struct drm_plane_funcs mdp4_plane_funcs = { ...@@ -98,21 +98,6 @@ static const struct drm_plane_funcs mdp4_plane_funcs = {
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
}; };
static int mdp4_plane_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *new_state)
{
struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane);
struct mdp4_kms *mdp4_kms = get_kms(plane);
struct msm_kms *kms = &mdp4_kms->base.base;
struct drm_framebuffer *fb = new_state->fb;
if (!fb)
return 0;
DBG("%s: prepare: FB[%u]", mdp4_plane->name, fb->base.id);
return msm_framebuffer_prepare(fb, kms->aspace);
}
static void mdp4_plane_cleanup_fb(struct drm_plane *plane, static void mdp4_plane_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
...@@ -152,7 +137,7 @@ static void mdp4_plane_atomic_update(struct drm_plane *plane, ...@@ -152,7 +137,7 @@ static void mdp4_plane_atomic_update(struct drm_plane *plane,
} }
static const struct drm_plane_helper_funcs mdp4_plane_helper_funcs = { static const struct drm_plane_helper_funcs mdp4_plane_helper_funcs = {
.prepare_fb = mdp4_plane_prepare_fb, .prepare_fb = msm_atomic_prepare_fb,
.cleanup_fb = mdp4_plane_cleanup_fb, .cleanup_fb = mdp4_plane_cleanup_fb,
.atomic_check = mdp4_plane_atomic_check, .atomic_check = mdp4_plane_atomic_check,
.atomic_update = mdp4_plane_atomic_update, .atomic_update = mdp4_plane_atomic_update,
......
...@@ -245,20 +245,6 @@ static const struct drm_plane_funcs mdp5_plane_funcs = { ...@@ -245,20 +245,6 @@ static const struct drm_plane_funcs mdp5_plane_funcs = {
.atomic_print_state = mdp5_plane_atomic_print_state, .atomic_print_state = mdp5_plane_atomic_print_state,
}; };
static int mdp5_plane_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *new_state)
{
struct mdp5_kms *mdp5_kms = get_kms(plane);
struct msm_kms *kms = &mdp5_kms->base.base;
struct drm_framebuffer *fb = new_state->fb;
if (!new_state->fb)
return 0;
DBG("%s: prepare: FB[%u]", plane->name, fb->base.id);
return msm_framebuffer_prepare(fb, kms->aspace);
}
static void mdp5_plane_cleanup_fb(struct drm_plane *plane, static void mdp5_plane_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
...@@ -543,7 +529,7 @@ static void mdp5_plane_atomic_async_update(struct drm_plane *plane, ...@@ -543,7 +529,7 @@ static void mdp5_plane_atomic_async_update(struct drm_plane *plane,
} }
static const struct drm_plane_helper_funcs mdp5_plane_helper_funcs = { static const struct drm_plane_helper_funcs mdp5_plane_helper_funcs = {
.prepare_fb = mdp5_plane_prepare_fb, .prepare_fb = msm_atomic_prepare_fb,
.cleanup_fb = mdp5_plane_cleanup_fb, .cleanup_fb = mdp5_plane_cleanup_fb,
.atomic_check = mdp5_plane_atomic_check, .atomic_check = mdp5_plane_atomic_check,
.atomic_update = mdp5_plane_atomic_update, .atomic_update = mdp5_plane_atomic_update,
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include "msm_drv.h" #include "msm_drv.h"
#include "msm_gem.h"
#include "msm_kms.h" #include "msm_kms.h"
#include "msm_gem.h" #include "msm_gem.h"
#include "msm_fence.h" #include "msm_fence.h"
...@@ -97,6 +98,27 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev, ...@@ -97,6 +98,27 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
} }
} }
int msm_atomic_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *new_state)
{
struct msm_drm_private *priv = plane->dev->dev_private;
struct msm_kms *kms = priv->kms;
struct drm_gem_object *obj;
struct msm_gem_object *msm_obj;
struct dma_fence *fence;
if (!new_state->fb)
return 0;
obj = msm_framebuffer_bo(new_state->fb, 0);
msm_obj = to_msm_bo(obj);
fence = reservation_object_get_excl_rcu(msm_obj->resv);
drm_atomic_set_fence_for_plane(new_state, fence);
return msm_framebuffer_prepare(new_state->fb, kms->aspace);
}
static void msm_atomic_commit_tail(struct drm_atomic_state *state) static void msm_atomic_commit_tail(struct drm_atomic_state *state)
{ {
struct drm_device *dev = state->dev; struct drm_device *dev = state->dev;
......
...@@ -160,6 +160,8 @@ struct msm_format { ...@@ -160,6 +160,8 @@ struct msm_format {
uint32_t pixel_format; uint32_t pixel_format;
}; };
int msm_atomic_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *new_state);
int msm_atomic_commit(struct drm_device *dev, int msm_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state, bool nonblock); struct drm_atomic_state *state, bool nonblock);
struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev); struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment