diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2015-03-20 10:18:01 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-26 10:09:59 -0400 |
commit | 10f81c194a78915f47aa5a17756b6492be133251 (patch) | |
tree | f44d97fd37c024c43fb8312b4df31249538a5fa8 /drivers/gpu/drm/i915/intel_drv.h | |
parent | 88595ac9ad199fc2e09270ec92e1ff0806033b83 (diff) |
drm/i915: Add intel_atomic_get_crtc_state() helper function
The pattern of getting the crtc state with drm_atomic_get_crtc_state()
and then converting it to intel_crtc_state will repeat quite often in
the following patches, so add a helper function to save some typing.
v2: Fix upcasting so that crtc_state base field could be moved. (Daniel)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_drv.h')
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 811a1db8b6ed..267bcfc32f13 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <drm/drm_fb_helper.h> | 35 | #include <drm/drm_fb_helper.h> |
36 | #include <drm/drm_dp_mst_helper.h> | 36 | #include <drm/drm_dp_mst_helper.h> |
37 | #include <drm/drm_rect.h> | 37 | #include <drm/drm_rect.h> |
38 | #include <drm/drm_atomic.h> | ||
38 | 39 | ||
39 | #define DIV_ROUND_CLOSEST_ULL(ll, d) \ | 40 | #define DIV_ROUND_CLOSEST_ULL(ll, d) \ |
40 | ({ unsigned long long _tmp = (ll)+(d)/2; do_div(_tmp, d); _tmp; }) | 41 | ({ unsigned long long _tmp = (ll)+(d)/2; do_div(_tmp, d); _tmp; }) |
@@ -562,6 +563,7 @@ struct cxsr_latency { | |||
562 | }; | 563 | }; |
563 | 564 | ||
564 | #define to_intel_crtc(x) container_of(x, struct intel_crtc, base) | 565 | #define to_intel_crtc(x) container_of(x, struct intel_crtc, base) |
566 | #define to_intel_crtc_state(x) container_of(x, struct intel_crtc_state, base) | ||
565 | #define to_intel_connector(x) container_of(x, struct intel_connector, base) | 567 | #define to_intel_connector(x) container_of(x, struct intel_connector, base) |
566 | #define to_intel_encoder(x) container_of(x, struct intel_encoder, base) | 568 | #define to_intel_encoder(x) container_of(x, struct intel_encoder, base) |
567 | #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) | 569 | #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) |
@@ -1303,6 +1305,17 @@ int intel_connector_atomic_get_property(struct drm_connector *connector, | |||
1303 | struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc); | 1305 | struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc); |
1304 | void intel_crtc_destroy_state(struct drm_crtc *crtc, | 1306 | void intel_crtc_destroy_state(struct drm_crtc *crtc, |
1305 | struct drm_crtc_state *state); | 1307 | struct drm_crtc_state *state); |
1308 | static inline struct intel_crtc_state * | ||
1309 | intel_atomic_get_crtc_state(struct drm_atomic_state *state, | ||
1310 | struct intel_crtc *crtc) | ||
1311 | { | ||
1312 | struct drm_crtc_state *crtc_state; | ||
1313 | crtc_state = drm_atomic_get_crtc_state(state, &crtc->base); | ||
1314 | if (IS_ERR(crtc_state)) | ||
1315 | return ERR_PTR(PTR_ERR(crtc_state)); | ||
1316 | |||
1317 | return to_intel_crtc_state(crtc_state); | ||
1318 | } | ||
1306 | 1319 | ||
1307 | /* intel_atomic_plane.c */ | 1320 | /* intel_atomic_plane.c */ |
1308 | struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane); | 1321 | struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane); |