mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 21:54:06 +08:00
drm/msm: subclass drm_atomic_state
This will give the kms backends a slot to stash their own hw specific global state. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
c056b55dc6
commit
870d738acb
@ -241,6 +241,10 @@ int msm_atomic_commit(struct drm_device *dev,
|
|||||||
|
|
||||||
drm_atomic_helper_swap_state(state, true);
|
drm_atomic_helper_swap_state(state, true);
|
||||||
|
|
||||||
|
/* swap driver private state while still holding state_lock */
|
||||||
|
if (to_kms_state(state)->state)
|
||||||
|
priv->kms->funcs->swap_state(priv->kms, state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Everything below can be run asynchronously without the need to grab
|
* Everything below can be run asynchronously without the need to grab
|
||||||
* any modeset locks at all under one conditions: It must be guaranteed
|
* any modeset locks at all under one conditions: It must be guaranteed
|
||||||
@ -271,3 +275,30 @@ error:
|
|||||||
drm_atomic_helper_cleanup_planes(dev, state);
|
drm_atomic_helper_cleanup_planes(dev, state);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev)
|
||||||
|
{
|
||||||
|
struct msm_kms_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
|
||||||
|
|
||||||
|
if (!state || drm_atomic_state_init(dev, &state->base) < 0) {
|
||||||
|
kfree(state);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &state->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
void msm_atomic_state_clear(struct drm_atomic_state *s)
|
||||||
|
{
|
||||||
|
struct msm_kms_state *state = to_kms_state(s);
|
||||||
|
drm_atomic_state_default_clear(&state->base);
|
||||||
|
kfree(state->state);
|
||||||
|
state->state = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void msm_atomic_state_free(struct drm_atomic_state *state)
|
||||||
|
{
|
||||||
|
kfree(to_kms_state(state)->state);
|
||||||
|
drm_atomic_state_default_release(state);
|
||||||
|
kfree(state);
|
||||||
|
}
|
||||||
|
@ -46,6 +46,9 @@ static const struct drm_mode_config_funcs mode_config_funcs = {
|
|||||||
.output_poll_changed = msm_fb_output_poll_changed,
|
.output_poll_changed = msm_fb_output_poll_changed,
|
||||||
.atomic_check = msm_atomic_check,
|
.atomic_check = msm_atomic_check,
|
||||||
.atomic_commit = msm_atomic_commit,
|
.atomic_commit = msm_atomic_commit,
|
||||||
|
.atomic_state_alloc = msm_atomic_state_alloc,
|
||||||
|
.atomic_state_clear = msm_atomic_state_clear,
|
||||||
|
.atomic_state_free = msm_atomic_state_free,
|
||||||
};
|
};
|
||||||
|
|
||||||
int msm_register_address_space(struct drm_device *dev,
|
int msm_register_address_space(struct drm_device *dev,
|
||||||
|
@ -179,6 +179,9 @@ int msm_atomic_check(struct drm_device *dev,
|
|||||||
struct drm_atomic_state *state);
|
struct drm_atomic_state *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);
|
||||||
|
void msm_atomic_state_clear(struct drm_atomic_state *state);
|
||||||
|
void msm_atomic_state_free(struct drm_atomic_state *state);
|
||||||
|
|
||||||
int msm_register_address_space(struct drm_device *dev,
|
int msm_register_address_space(struct drm_device *dev,
|
||||||
struct msm_gem_address_space *aspace);
|
struct msm_gem_address_space *aspace);
|
||||||
|
@ -40,6 +40,8 @@ struct msm_kms_funcs {
|
|||||||
irqreturn_t (*irq)(struct msm_kms *kms);
|
irqreturn_t (*irq)(struct msm_kms *kms);
|
||||||
int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
|
int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
|
||||||
void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
|
void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
|
||||||
|
/* swap global atomic state: */
|
||||||
|
void (*swap_state)(struct msm_kms *kms, struct drm_atomic_state *state);
|
||||||
/* modeset, bracketing atomic_commit(): */
|
/* modeset, bracketing atomic_commit(): */
|
||||||
void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
|
void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
|
||||||
void (*complete_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
|
void (*complete_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
|
||||||
@ -65,6 +67,18 @@ struct msm_kms {
|
|||||||
int irq;
|
int irq;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subclass of drm_atomic_state, to allow kms backend to have driver
|
||||||
|
* private global state. The kms backend can do whatever it wants
|
||||||
|
* with the ->state ptr. On ->atomic_state_clear() the ->state ptr
|
||||||
|
* is kfree'd and set back to NULL.
|
||||||
|
*/
|
||||||
|
struct msm_kms_state {
|
||||||
|
struct drm_atomic_state base;
|
||||||
|
void *state;
|
||||||
|
};
|
||||||
|
#define to_kms_state(x) container_of(x, struct msm_kms_state, base)
|
||||||
|
|
||||||
static inline void msm_kms_init(struct msm_kms *kms,
|
static inline void msm_kms_init(struct msm_kms *kms,
|
||||||
const struct msm_kms_funcs *funcs)
|
const struct msm_kms_funcs *funcs)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user