diff options
author | Matt Roper <matthew.d.roper@intel.com> | 2015-01-21 16:35:41 -0800 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-01-27 09:51:18 +0100 |
commit | 8e7d688b7a8316d514d2fe311b4ef8d6ac091f2d (patch) | |
tree | a4f298220cd75fb99f98769bd09751c3e8203571 /drivers/gpu/drm/i915/intel_atomic_plane.c | |
parent | 7c59a9c133868b0c028a04562a1c2b2dbbad5284 (diff) | |
download | op-kernel-dev-8e7d688b7a8316d514d2fe311b4ef8d6ac091f2d.zip op-kernel-dev-8e7d688b7a8316d514d2fe311b4ef8d6ac091f2d.tar.gz |
drm/i915: Move rotation from intel_plane to drm_plane_state
Runtime state that can be manipulated via properties should now go in
intel_plane_state/drm_plane_state so that it can be tracked as part of
an atomic transaction.
We add a new 'intel_create_plane_state' function so that the proper
initial value for this property (and future properties) doesn't have to
be repeated at each plane initialization site.
v2:
- Stick rotation in common drm_plane_state rather than
intel_plane_state. (Daniel)
- Add intel_create_plane_state() to consolidate the places where we
have to set initial state values. (Ander)
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_atomic_plane.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_atomic_plane.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index 4027fc0..d9d4306 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c @@ -37,31 +37,58 @@ #include "intel_drv.h" /** + * intel_create_plane_state - create plane state object + * @plane: drm plane + * + * Allocates a fresh plane state for the given plane and sets some of + * the state values to sensible initial values. + * + * Returns: A newly allocated plane state, or NULL on failure + */ +struct intel_plane_state * +intel_create_plane_state(struct drm_plane *plane) +{ + struct intel_plane_state *state; + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (!state) + return NULL; + + state->base.plane = plane; + state->base.rotation = BIT(DRM_ROTATE_0); + + return state; +} + +/** * intel_plane_duplicate_state - duplicate plane state * @plane: drm plane * * Allocates and returns a copy of the plane state (both common and * Intel-specific) for the specified plane. * - * Returns: The newly allocated plane state, or NULL or failure. + * Returns: The newly allocated plane state, or NULL on failure. */ struct drm_plane_state * intel_plane_duplicate_state(struct drm_plane *plane) { - struct intel_plane_state *state; + struct drm_plane_state *state; + struct intel_plane_state *intel_state; - if (plane->state) - state = kmemdup(plane->state, sizeof(*state), GFP_KERNEL); + if (WARN_ON(!plane->state)) + intel_state = intel_create_plane_state(plane); else - state = kzalloc(sizeof(*state), GFP_KERNEL); + intel_state = kmemdup(plane->state, sizeof(*intel_state), + GFP_KERNEL); - if (!state) + if (!intel_state) return NULL; - if (state->base.fb) - drm_framebuffer_reference(state->base.fb); + state = &intel_state->base; + if (state->fb) + drm_framebuffer_reference(state->fb); - return &state->base; + return state; } /** |