blob: 4541aa3f2943dabc2f05b5ee69465e5e3470bdf9 [file] [log] [blame]
Jesse Barnes79e53942008-11-07 14:24:08 -08001/*
2 * Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
3 * Copyright (c) 2007-2008 Intel Corporation
4 * Jesse Barnes <jesse.barnes@intel.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 * IN THE SOFTWARE.
24 */
25#ifndef __INTEL_DRV_H__
26#define __INTEL_DRV_H__
27
Jesse Barnesd1d70672014-05-28 14:39:03 -070028#include <linux/async.h>
Jesse Barnes79e53942008-11-07 14:24:08 -080029#include <linux/i2c.h>
Damien Lespiau178f7362013-08-06 20:32:18 +010030#include <linux/hdmi.h>
David Howells760285e2012-10-02 18:01:07 +010031#include <drm/i915_drm.h>
Jesse Barnes80824002009-09-10 15:28:06 -070032#include "i915_drv.h"
David Howells760285e2012-10-02 18:01:07 +010033#include <drm/drm_crtc.h>
34#include <drm/drm_crtc_helper.h>
35#include <drm/drm_fb_helper.h>
Ville Syrjäläb1ba1242016-05-02 22:08:23 +030036#include <drm/drm_dp_dual_mode_helper.h>
Dave Airlie0e32b392014-05-02 14:02:48 +100037#include <drm/drm_dp_mst_helper.h>
Gustavo Padovaneeca7782014-09-05 17:04:46 -030038#include <drm/drm_rect.h>
Ander Conselvan de Oliveira10f81c12015-03-20 16:18:01 +020039#include <drm/drm_atomic.h>
Chris Wilson913d8d12010-08-07 11:01:35 +010040
Daniel Vetter1d5bfac2013-03-28 00:03:25 +010041/**
42 * _wait_for - magic (register) wait macro
43 *
44 * Does the right thing for modeset paths when run under kdgb or similar atomic
45 * contexts. Note that it's important that we check the condition again after
46 * having timed out, since the timeout could be due to preemption or similar and
47 * we've never had a chance to check the condition before the timeout.
Tvrtko Ursulin0351b932016-03-03 16:21:27 +000048 *
49 * TODO: When modesetting has fully transitioned to atomic, the below
50 * drm_can_sleep() can be removed and in_atomic()/!in_atomic() asserts
51 * added.
Daniel Vetter1d5bfac2013-03-28 00:03:25 +010052 */
Tvrtko Ursulin3f177622016-03-03 14:36:41 +000053#define _wait_for(COND, US, W) ({ \
54 unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \
Chris Wilson913d8d12010-08-07 11:01:35 +010055 int ret__ = 0; \
Akshay Joshi0206e352011-08-16 15:34:10 -040056 while (!(COND)) { \
Chris Wilson913d8d12010-08-07 11:01:35 +010057 if (time_after(jiffies, timeout__)) { \
Daniel Vetter1d5bfac2013-03-28 00:03:25 +010058 if (!(COND)) \
59 ret__ = -ETIMEDOUT; \
Chris Wilson913d8d12010-08-07 11:01:35 +010060 break; \
61 } \
Ville Syrjälä9848de02015-03-20 21:28:08 +020062 if ((W) && drm_can_sleep()) { \
Tvrtko Ursulin3f177622016-03-03 14:36:41 +000063 usleep_range((W), (W)*2); \
Ben Widawsky0cc27642012-09-01 22:59:48 -070064 } else { \
65 cpu_relax(); \
66 } \
Chris Wilson913d8d12010-08-07 11:01:35 +010067 } \
68 ret__; \
69})
70
Tvrtko Ursulin3f177622016-03-03 14:36:41 +000071#define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 1000)
72#define wait_for_us(COND, US) _wait_for((COND), (US), 1)
73
Tvrtko Ursulin0351b932016-03-03 16:21:27 +000074/* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */
75#if defined(CONFIG_DRM_I915_DEBUG) && defined(CONFIG_PREEMPT_COUNT)
76# define _WAIT_FOR_ATOMIC_CHECK WARN_ON_ONCE(!in_atomic())
77#else
78# define _WAIT_FOR_ATOMIC_CHECK do { } while (0)
79#endif
80
81#define _wait_for_atomic(COND, US) ({ \
82 unsigned long end__; \
83 int ret__ = 0; \
84 _WAIT_FOR_ATOMIC_CHECK; \
85 BUILD_BUG_ON((US) > 50000); \
86 end__ = (local_clock() >> 10) + (US) + 1; \
87 while (!(COND)) { \
88 if (time_after((unsigned long)(local_clock() >> 10), end__)) { \
89 /* Unlike the regular wait_for(), this atomic variant \
90 * cannot be preempted (and we'll just ignore the issue\
91 * of irq interruptions) and so we know that no time \
92 * has passed since the last check of COND and can \
93 * immediately report the timeout. \
94 */ \
95 ret__ = -ETIMEDOUT; \
96 break; \
97 } \
98 cpu_relax(); \
99 } \
100 ret__; \
101})
102
103#define wait_for_atomic(COND, MS) _wait_for_atomic((COND), (MS) * 1000)
104#define wait_for_atomic_us(COND, US) _wait_for_atomic((COND), (US))
Chris Wilson481b6af2010-08-23 17:43:35 +0100105
Jani Nikula49938ac2014-01-10 17:10:20 +0200106#define KHz(x) (1000 * (x))
107#define MHz(x) KHz(1000 * (x))
Chris Wilson021357a2010-09-07 20:54:59 +0100108
Jesse Barnes79e53942008-11-07 14:24:08 -0800109/*
110 * Display related stuff
111 */
112
113/* store information about an Ixxx DVO */
114/* The i830->i865 use multiple DVOs with multiple i2cs */
115/* the i915, i945 have a single sDVO i2c bus - which is different */
116#define MAX_OUTPUTS 6
117/* maximum connectors per crtcs in the mode set */
Jesse Barnes79e53942008-11-07 14:24:08 -0800118
Sagar Kamble4726e0b2014-03-10 17:06:23 +0530119/* Maximum cursor sizes */
120#define GEN2_CURSOR_WIDTH 64
121#define GEN2_CURSOR_HEIGHT 64
Damien Lespiau068be562014-03-28 14:17:49 +0000122#define MAX_CURSOR_WIDTH 256
123#define MAX_CURSOR_HEIGHT 256
Sagar Kamble4726e0b2014-03-10 17:06:23 +0530124
Jesse Barnes79e53942008-11-07 14:24:08 -0800125#define INTEL_I2C_BUS_DVO 1
126#define INTEL_I2C_BUS_SDVO 2
127
128/* these are outputs from the chip - integrated only
129 external chips are via DVO or SDVO output */
Paulo Zanoni6847d71b2014-10-27 17:47:52 -0200130enum intel_output_type {
131 INTEL_OUTPUT_UNUSED = 0,
132 INTEL_OUTPUT_ANALOG = 1,
133 INTEL_OUTPUT_DVO = 2,
134 INTEL_OUTPUT_SDVO = 3,
135 INTEL_OUTPUT_LVDS = 4,
136 INTEL_OUTPUT_TVOUT = 5,
137 INTEL_OUTPUT_HDMI = 6,
138 INTEL_OUTPUT_DISPLAYPORT = 7,
139 INTEL_OUTPUT_EDP = 8,
140 INTEL_OUTPUT_DSI = 9,
141 INTEL_OUTPUT_UNKNOWN = 10,
142 INTEL_OUTPUT_DP_MST = 11,
143};
Jesse Barnes79e53942008-11-07 14:24:08 -0800144
145#define INTEL_DVO_CHIP_NONE 0
146#define INTEL_DVO_CHIP_LVDS 1
147#define INTEL_DVO_CHIP_TMDS 2
148#define INTEL_DVO_CHIP_TVOUT 4
149
Shobhit Kumardfba2e22014-04-14 11:18:24 +0530150#define INTEL_DSI_VIDEO_MODE 0
151#define INTEL_DSI_COMMAND_MODE 1
Jani Nikula72ffa332013-08-27 15:12:17 +0300152
Jesse Barnes79e53942008-11-07 14:24:08 -0800153struct intel_framebuffer {
154 struct drm_framebuffer base;
Chris Wilson05394f32010-11-08 19:18:58 +0000155 struct drm_i915_gem_object *obj;
Ville Syrjälä2d7a2152016-02-15 22:54:47 +0200156 struct intel_rotation_info rot_info;
Jesse Barnes79e53942008-11-07 14:24:08 -0800157};
158
Chris Wilson37811fc2010-08-25 22:45:57 +0100159struct intel_fbdev {
160 struct drm_fb_helper helper;
Jesse Barnes8bcd4552014-02-07 12:10:38 -0800161 struct intel_framebuffer *fb;
Jesse Barnesd978ef12014-03-07 08:57:51 -0800162 int preferred_bpp;
Chris Wilson37811fc2010-08-25 22:45:57 +0100163};
Jesse Barnes79e53942008-11-07 14:24:08 -0800164
Eric Anholt21d40d32010-03-25 11:11:14 -0700165struct intel_encoder {
Chris Wilson4ef69c72010-09-09 15:14:28 +0100166 struct drm_encoder base;
Daniel Vetter9a935852012-07-05 22:34:27 +0200167
Paulo Zanoni6847d71b2014-10-27 17:47:52 -0200168 enum intel_output_type type;
Ville Syrjäläbc079e82014-03-03 16:15:28 +0200169 unsigned int cloneable;
Eric Anholt21d40d32010-03-25 11:11:14 -0700170 void (*hot_plug)(struct intel_encoder *);
Daniel Vetter7ae89232013-03-27 00:44:52 +0100171 bool (*compute_config)(struct intel_encoder *,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +0200172 struct intel_crtc_state *);
Daniel Vetterdafd2262012-11-26 17:22:07 +0100173 void (*pre_pll_enable)(struct intel_encoder *);
Daniel Vetterbf49ec82012-09-06 22:15:40 +0200174 void (*pre_enable)(struct intel_encoder *);
Daniel Vetteref9c3ae2012-06-29 22:40:09 +0200175 void (*enable)(struct intel_encoder *);
Daniel Vetter6cc5f342013-03-27 00:44:53 +0100176 void (*mode_set)(struct intel_encoder *intel_encoder);
Daniel Vetteref9c3ae2012-06-29 22:40:09 +0200177 void (*disable)(struct intel_encoder *);
Daniel Vetterbf49ec82012-09-06 22:15:40 +0200178 void (*post_disable)(struct intel_encoder *);
Ville Syrjäläd6db9952015-07-08 23:45:49 +0300179 void (*post_pll_disable)(struct intel_encoder *);
Daniel Vetterf0947c32012-07-02 13:10:34 +0200180 /* Read out the current hw state of this connector, returning true if
181 * the encoder is active. If the encoder is enabled it also set the pipe
182 * it is connected to in the pipe parameter. */
183 bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe);
Jesse Barnes045ac3b2013-05-14 17:08:26 -0700184 /* Reconstructs the equivalent mode flags for the current hardware
Daniel Vetterfdafa9e2013-06-12 11:47:24 +0200185 * state. This must be called _after_ display->get_pipe_config has
Xiong Zhang63000ef2013-06-28 12:59:06 +0800186 * pre-filled the pipe config. Note that intel_encoder->base.crtc must
187 * be set correctly before calling this function. */
Jesse Barnes045ac3b2013-05-14 17:08:26 -0700188 void (*get_config)(struct intel_encoder *,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +0200189 struct intel_crtc_state *pipe_config);
Imre Deak07f9cd02014-08-18 14:42:45 +0300190 /*
191 * Called during system suspend after all pending requests for the
192 * encoder are flushed (for example for DP AUX transactions) and
193 * device interrupts are disabled.
194 */
195 void (*suspend)(struct intel_encoder *);
Ma Lingf8aed702009-08-24 13:50:24 +0800196 int crtc_mask;
Egbert Eich1d843f92013-02-25 12:06:49 -0500197 enum hpd_pin hpd_pin;
Jesse Barnes79e53942008-11-07 14:24:08 -0800198};
199
Jani Nikula1d508702012-10-19 14:51:49 +0300200struct intel_panel {
Jani Nikuladd06f902012-10-19 14:51:50 +0300201 struct drm_display_mode *fixed_mode;
Vandana Kannanec9ed192013-12-10 13:37:36 +0530202 struct drm_display_mode *downclock_mode;
Jani Nikula4d891522012-10-26 12:03:59 +0300203 int fitting_mode;
Jani Nikula58c68772013-11-08 16:48:54 +0200204
205 /* backlight */
206 struct {
Jani Nikulac91c9f32013-11-08 16:48:55 +0200207 bool present;
Jani Nikula58c68772013-11-08 16:48:54 +0200208 u32 level;
Jani Nikula6dda7302014-06-24 18:27:40 +0300209 u32 min;
Jani Nikula7bd688c2013-11-08 16:48:56 +0200210 u32 max;
Jani Nikula58c68772013-11-08 16:48:54 +0200211 bool enabled;
Jani Nikula636baeb2013-11-08 16:49:02 +0200212 bool combination_mode; /* gen 2/4 only */
213 bool active_low_pwm;
Shobhit Kumarb029e662015-06-26 14:32:10 +0530214
215 /* PWM chip */
Sunil Kamath022e4e52015-09-30 22:34:57 +0530216 bool util_pin_active_low; /* bxt+ */
217 u8 controller; /* bxt+ only */
Shobhit Kumarb029e662015-06-26 14:32:10 +0530218 struct pwm_device *pwm;
219
Jani Nikula58c68772013-11-08 16:48:54 +0200220 struct backlight_device *device;
Jani Nikulaab656bb2014-08-13 12:10:12 +0300221
Jani Nikula5507fae2015-09-14 14:03:48 +0300222 /* Connector and platform specific backlight functions */
223 int (*setup)(struct intel_connector *connector, enum pipe pipe);
224 uint32_t (*get)(struct intel_connector *connector);
225 void (*set)(struct intel_connector *connector, uint32_t level);
226 void (*disable)(struct intel_connector *connector);
227 void (*enable)(struct intel_connector *connector);
228 uint32_t (*hz_to_pwm)(struct intel_connector *connector,
229 uint32_t hz);
230 void (*power)(struct intel_connector *, bool enable);
231 } backlight;
Jani Nikula1d508702012-10-19 14:51:49 +0300232};
233
Zhenyu Wang5daa55e2010-03-30 14:39:28 +0800234struct intel_connector {
235 struct drm_connector base;
Daniel Vetter9a935852012-07-05 22:34:27 +0200236 /*
237 * The fixed encoder this connector is connected to.
238 */
Chris Wilsondf0e9242010-09-09 16:20:55 +0100239 struct intel_encoder *encoder;
Daniel Vetter9a935852012-07-05 22:34:27 +0200240
Daniel Vetterf0947c32012-07-02 13:10:34 +0200241 /* Reads out the current hw, returning true if the connector is enabled
242 * and active (i.e. dpms ON state). */
243 bool (*get_hw_state)(struct intel_connector *);
Jani Nikula1d508702012-10-19 14:51:49 +0300244
Imre Deak4932e2c2014-02-11 17:12:48 +0200245 /*
246 * Removes all interfaces through which the connector is accessible
247 * - like sysfs, debugfs entries -, so that no new operations can be
248 * started on the connector. Also makes sure all currently pending
249 * operations finish before returing.
250 */
251 void (*unregister)(struct intel_connector *);
252
Jani Nikula1d508702012-10-19 14:51:49 +0300253 /* Panel info for eDP and LVDS */
254 struct intel_panel panel;
Jani Nikula9cd300e2012-10-19 14:51:52 +0300255
256 /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
257 struct edid *edid;
Chris Wilsonbeb60602014-09-02 20:04:00 +0100258 struct edid *detect_edid;
Egbert Eich821450c2013-04-16 13:36:55 +0200259
260 /* since POLL and HPD connectors may use the same HPD line keep the native
261 state of connector->polled in case hotplug storm detection changes it */
262 u8 polled;
Dave Airlie0e32b392014-05-02 14:02:48 +1000263
264 void *port; /* store this opaque as its illegal to dereference it */
265
266 struct intel_dp *mst_port;
Zhenyu Wang5daa55e2010-03-30 14:39:28 +0800267};
268
Ander Conselvan de Oliveira9e2c8472016-05-04 12:11:57 +0300269struct dpll {
Ville Syrjälä80ad9202013-04-19 14:36:51 +0300270 /* given values */
271 int n;
272 int m1, m2;
273 int p1, p2;
274 /* derived values */
275 int dot;
276 int vco;
277 int m;
278 int p;
Ander Conselvan de Oliveira9e2c8472016-05-04 12:11:57 +0300279};
Ville Syrjälä80ad9202013-04-19 14:36:51 +0300280
Maarten Lankhorstde419ab2015-06-04 10:21:28 +0200281struct intel_atomic_state {
282 struct drm_atomic_state base;
283
Maarten Lankhorst27c329e2015-06-15 12:33:56 +0200284 unsigned int cdclk;
Maarten Lankhorst565602d2015-12-10 12:33:57 +0100285
Maarten Lankhorst1a617b72015-12-03 14:31:06 +0100286 /*
287 * Calculated device cdclk, can be different from cdclk
288 * only when all crtc's are DPMS off.
289 */
290 unsigned int dev_cdclk;
291
Maarten Lankhorst565602d2015-12-10 12:33:57 +0100292 bool dpll_set, modeset;
293
Matt Roper8b4a7d02016-05-12 07:06:00 -0700294 /*
295 * Does this transaction change the pipes that are active? This mask
296 * tracks which CRTC's have changed their active state at the end of
297 * the transaction (not counting the temporary disable during modesets).
298 * This mask should only be non-zero when intel_state->modeset is true,
299 * but the converse is not necessarily true; simply changing a mode may
300 * not flip the final active status of any CRTC's
301 */
302 unsigned int active_pipe_changes;
303
Maarten Lankhorst565602d2015-12-10 12:33:57 +0100304 unsigned int active_crtcs;
305 unsigned int min_pixclk[I915_MAX_PIPES];
306
Maarten Lankhorstde419ab2015-06-04 10:21:28 +0200307 struct intel_shared_dpll_config shared_dpll[I915_NUM_PLLS];
Matt Ropered4a6a72016-02-23 17:20:13 -0800308
309 /*
310 * Current watermarks can't be trusted during hardware readout, so
311 * don't bother calculating intermediate watermarks.
312 */
313 bool skip_intermediate_wm;
Matt Roper98d39492016-05-12 07:06:03 -0700314
315 /* Gen9+ only */
Matt Roper734fa012016-05-12 15:11:40 -0700316 struct skl_wm_values wm_results;
Maarten Lankhorstde419ab2015-06-04 10:21:28 +0200317};
318
Gustavo Padovaneeca7782014-09-05 17:04:46 -0300319struct intel_plane_state {
Matt Roper2b875c22014-12-01 15:40:13 -0800320 struct drm_plane_state base;
Gustavo Padovaneeca7782014-09-05 17:04:46 -0300321 struct drm_rect src;
322 struct drm_rect dst;
323 struct drm_rect clip;
Gustavo Padovaneeca7782014-09-05 17:04:46 -0300324 bool visible;
Matt Roper32b7eee2014-12-24 07:59:06 -0800325
326 /*
Chandra Kondurube41e332015-04-07 15:28:36 -0700327 * scaler_id
328 * = -1 : not using a scaler
329 * >= 0 : using a scalers
330 *
331 * plane requiring a scaler:
332 * - During check_plane, its bit is set in
333 * crtc_state->scaler_state.scaler_users by calling helper function
Maarten Lankhorst86adf9d2015-06-22 09:50:32 +0200334 * update_scaler_plane.
Chandra Kondurube41e332015-04-07 15:28:36 -0700335 * - scaler_id indicates the scaler it got assigned.
336 *
337 * plane doesn't require a scaler:
338 * - this can happen when scaling is no more required or plane simply
339 * got disabled.
340 * - During check_plane, corresponding bit is reset in
341 * crtc_state->scaler_state.scaler_users by calling helper function
Maarten Lankhorst86adf9d2015-06-22 09:50:32 +0200342 * update_scaler_plane.
Chandra Kondurube41e332015-04-07 15:28:36 -0700343 */
344 int scaler_id;
Maarten Lankhorst818ed962015-06-15 12:33:54 +0200345
346 struct drm_intel_sprite_colorkey ckey;
Maarten Lankhorst7580d772015-08-18 13:40:06 +0200347
348 /* async flip related structures */
349 struct drm_i915_gem_request *wait_req;
Gustavo Padovaneeca7782014-09-05 17:04:46 -0300350};
351
Damien Lespiau5724dbd2015-01-20 12:51:52 +0000352struct intel_initial_plane_config {
Damien Lespiau2d140302015-02-05 17:22:18 +0000353 struct intel_framebuffer *fb;
Damien Lespiau49af4492015-01-20 12:51:44 +0000354 unsigned int tiling;
Jesse Barnes46f297f2014-03-07 08:57:48 -0800355 int size;
356 u32 base;
357};
358
Chandra Kondurube41e332015-04-07 15:28:36 -0700359#define SKL_MIN_SRC_W 8
360#define SKL_MAX_SRC_W 4096
361#define SKL_MIN_SRC_H 8
Chandra Konduru6156a452015-04-27 13:48:39 -0700362#define SKL_MAX_SRC_H 4096
Chandra Kondurube41e332015-04-07 15:28:36 -0700363#define SKL_MIN_DST_W 8
364#define SKL_MAX_DST_W 4096
365#define SKL_MIN_DST_H 8
Chandra Konduru6156a452015-04-27 13:48:39 -0700366#define SKL_MAX_DST_H 4096
Chandra Kondurube41e332015-04-07 15:28:36 -0700367
368struct intel_scaler {
Chandra Kondurube41e332015-04-07 15:28:36 -0700369 int in_use;
370 uint32_t mode;
371};
372
373struct intel_crtc_scaler_state {
374#define SKL_NUM_SCALERS 2
375 struct intel_scaler scalers[SKL_NUM_SCALERS];
376
377 /*
378 * scaler_users: keeps track of users requesting scalers on this crtc.
379 *
380 * If a bit is set, a user is using a scaler.
381 * Here user can be a plane or crtc as defined below:
382 * bits 0-30 - plane (bit position is index from drm_plane_index)
383 * bit 31 - crtc
384 *
385 * Instead of creating a new index to cover planes and crtc, using
386 * existing drm_plane_index for planes which is well less than 31
387 * planes and bit 31 for crtc. This should be fine to cover all
388 * our platforms.
389 *
390 * intel_atomic_setup_scalers will setup available scalers to users
391 * requesting scalers. It will gracefully fail if request exceeds
392 * avilability.
393 */
394#define SKL_CRTC_INDEX 31
395 unsigned scaler_users;
396
397 /* scaler used by crtc for panel fitting purpose */
398 int scaler_id;
399};
400
Daniel Vetter1ed51de2015-07-15 14:15:51 +0200401/* drm_mode->private_flags */
402#define I915_MODE_FLAG_INHERITED 1
403
Matt Roper4e0963c2015-09-24 15:53:15 -0700404struct intel_pipe_wm {
405 struct intel_wm_level wm[5];
Maarten Lankhorst71f0a622016-03-08 10:57:16 +0100406 struct intel_wm_level raw_wm[5];
Matt Roper4e0963c2015-09-24 15:53:15 -0700407 uint32_t linetime;
408 bool fbc_wm_enabled;
409 bool pipe_enabled;
410 bool sprites_enabled;
411 bool sprites_scaled;
412};
413
414struct skl_pipe_wm {
415 struct skl_wm_level wm[8];
416 struct skl_wm_level trans_wm;
417 uint32_t linetime;
418};
419
Matt Ropere8f1f022016-05-12 07:05:55 -0700420struct intel_crtc_wm_state {
421 union {
422 struct {
423 /*
424 * Intermediate watermarks; these can be
425 * programmed immediately since they satisfy
426 * both the current configuration we're
427 * switching away from and the new
428 * configuration we're switching to.
429 */
430 struct intel_pipe_wm intermediate;
431
432 /*
433 * Optimal watermarks, programmed post-vblank
434 * when this state is committed.
435 */
436 struct intel_pipe_wm optimal;
437 } ilk;
438
439 struct {
440 /* gen9+ only needs 1-step wm programming */
441 struct skl_pipe_wm optimal;
Matt Ropera1de91e2016-05-12 07:05:57 -0700442
443 /* cached plane data rate */
444 unsigned plane_data_rate[I915_MAX_PLANES];
445 unsigned plane_y_data_rate[I915_MAX_PLANES];
Matt Roper86a2100a2016-05-12 07:05:59 -0700446
447 /* minimum block allocation */
448 uint16_t minimum_blocks[I915_MAX_PLANES];
449 uint16_t minimum_y_blocks[I915_MAX_PLANES];
Matt Ropere8f1f022016-05-12 07:05:55 -0700450 } skl;
451 };
452
453 /*
454 * Platforms with two-step watermark programming will need to
455 * update watermark programming post-vblank to switch from the
456 * safe intermediate watermarks to the optimal final
457 * watermarks.
458 */
459 bool need_postvbl_update;
460};
461
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +0200462struct intel_crtc_state {
Ander Conselvan de Oliveira2d112de2015-01-15 14:55:22 +0200463 struct drm_crtc_state base;
464
Daniel Vetterbb760062013-06-06 14:55:52 +0200465 /**
466 * quirks - bitfield with hw state readout quirks
467 *
468 * For various reasons the hw state readout code might not be able to
469 * completely faithfully read out the current state. These cases are
470 * tracked with quirk flags so that fastboot and state checker can act
471 * accordingly.
472 */
Daniel Vetter99535992014-04-13 12:00:33 +0200473#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
Daniel Vetterbb760062013-06-06 14:55:52 +0200474 unsigned long quirks;
475
Maarten Lankhorstcd202f62016-03-09 10:35:44 +0100476 unsigned fb_bits; /* framebuffers to flip */
Maarten Lankhorstab1d3a02015-11-19 16:07:14 +0100477 bool update_pipe; /* can a fast modeset be performed? */
478 bool disable_cxsr;
Ville Syrjäläcaed3612016-03-09 19:07:25 +0200479 bool update_wm_pre, update_wm_post; /* watermarks are updated */
Maarten Lankhorste8861672016-02-24 11:24:26 +0100480 bool fb_changed; /* fb on any of the planes is changed */
Maarten Lankhorstbfd16b22015-08-27 15:44:05 +0200481
Ville Syrjälä37327ab2013-09-04 18:25:28 +0300482 /* Pipe source size (ie. panel fitter input size)
483 * All planes will be positioned inside this space,
484 * and get clipped at the edges. */
485 int pipe_src_w, pipe_src_h;
486
Daniel Vetter5bfe2ac2013-03-27 00:44:55 +0100487 /* Whether to set up the PCH/FDI. Note that we never allow sharing
488 * between pch encoders and cpu encoders. */
489 bool has_pch_encoder;
Daniel Vetter50f3b012013-03-27 00:44:56 +0100490
Jesse Barnese43823e2014-11-05 14:26:08 -0800491 /* Are we sending infoframes on the attached port */
492 bool has_infoframe;
493
Daniel Vetter3b117c82013-04-17 20:15:07 +0200494 /* CPU Transcoder for the pipe. Currently this can only differ from the
Jani Nikula4d1de972016-03-18 17:05:42 +0200495 * pipe on Haswell and later (where we have a special eDP transcoder)
496 * and Broxton (where we have special DSI transcoders). */
Daniel Vetter3b117c82013-04-17 20:15:07 +0200497 enum transcoder cpu_transcoder;
498
Daniel Vetter50f3b012013-03-27 00:44:56 +0100499 /*
500 * Use reduced/limited/broadcast rbg range, compressing from the full
501 * range fed into the crtcs.
502 */
503 bool limited_color_range;
504
Daniel Vetter03afc4a2013-04-02 23:42:31 +0200505 /* DP has a bunch of special case unfortunately, so mark the pipe
506 * accordingly. */
507 bool has_dp_encoder;
Daniel Vetterd8b32242013-04-25 17:54:44 +0200508
Jani Nikulaa65347b2015-11-27 12:21:46 +0200509 /* DSI has special cases */
510 bool has_dsi_encoder;
511
Daniel Vetter6897b4b52014-04-24 23:54:47 +0200512 /* Whether we should send NULL infoframes. Required for audio. */
513 bool has_hdmi_sink;
514
Daniel Vetter9ed109a2014-04-24 23:54:52 +0200515 /* Audio enabled on this pipe. Only valid if either has_hdmi_sink or
516 * has_dp_encoder is set. */
517 bool has_audio;
518
Daniel Vetterd8b32242013-04-25 17:54:44 +0200519 /*
520 * Enable dithering, used when the selected pipe bpp doesn't match the
521 * plane bpp.
522 */
Daniel Vetter965e0c42013-03-27 00:44:57 +0100523 bool dither;
Daniel Vetterf47709a2013-03-28 10:42:02 +0100524
525 /* Controls for the clock computation, to override various stages. */
526 bool clock_set;
527
Daniel Vetter09ede542013-04-30 14:01:45 +0200528 /* SDVO TV has a bunch of special case. To make multifunction encoders
529 * work correctly, we need to track this at runtime.*/
530 bool sdvo_tv_clock;
531
Daniel Vettere29c22c2013-02-21 00:00:16 +0100532 /*
533 * crtc bandwidth limit, don't increase pipe bpp or clock if not really
534 * required. This is set in the 2nd loop of calling encoder's
535 * ->compute_config if the first pick doesn't work out.
536 */
537 bool bw_constrained;
538
Daniel Vetterf47709a2013-03-28 10:42:02 +0100539 /* Settings for the intel dpll used on pretty much everything but
540 * haswell. */
Ville Syrjälä80ad9202013-04-19 14:36:51 +0300541 struct dpll dpll;
Daniel Vetterf47709a2013-03-28 10:42:02 +0100542
Ander Conselvan de Oliveira8106ddb2016-03-08 17:46:18 +0200543 /* Selected dpll when shared or NULL. */
544 struct intel_shared_dpll *shared_dpll;
Daniel Vettera43f6e02013-06-07 23:10:32 +0200545
Satheeshakrishna M96b7dfb2014-11-13 14:55:17 +0000546 /*
547 * - PORT_CLK_SEL for DDI ports on HSW/BDW.
548 * - enum skl_dpll on SKL
549 */
Daniel Vetterde7cfc62014-06-25 22:01:54 +0300550 uint32_t ddi_pll_sel;
551
Daniel Vetter66e985c2013-06-05 13:34:20 +0200552 /* Actual register state of the dpll, for shared dpll cross-checking. */
553 struct intel_dpll_hw_state dpll_hw_state;
554
Ville Syrjälä47eacba2016-04-12 22:14:35 +0300555 /* DSI PLL registers */
556 struct {
557 u32 ctrl, div;
558 } dsi_pll;
559
Daniel Vetter965e0c42013-03-27 00:44:57 +0100560 int pipe_bpp;
Daniel Vetter6cf86a52013-04-02 23:38:10 +0200561 struct intel_link_m_n dp_m_n;
Daniel Vetterff9a6752013-06-01 17:16:21 +0200562
Pradeep Bhat439d7ac2014-04-05 12:13:28 +0530563 /* m2_n2 for eDP downclock */
564 struct intel_link_m_n dp_m2_n2;
Vandana Kannanf769cd22014-08-05 07:51:22 -0700565 bool has_drrs;
Pradeep Bhat439d7ac2014-04-05 12:13:28 +0530566
Daniel Vetterff9a6752013-06-01 17:16:21 +0200567 /*
568 * Frequence the dpll for the port should run at. Differs from the
Ville Syrjälä3c52f4e2013-09-06 23:28:59 +0300569 * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also
570 * already multiplied by pixel_multiplier.
Daniel Vetterdf92b1e2013-03-28 10:41:58 +0100571 */
Daniel Vetterff9a6752013-06-01 17:16:21 +0200572 int port_clock;
573
Daniel Vetter6cc5f342013-03-27 00:44:53 +0100574 /* Used by SDVO (and if we ever fix it, HDMI). */
575 unsigned pixel_multiplier;
Jesse Barnes2dd24552013-04-25 12:55:01 -0700576
Ville Syrjälä90a6b7b2015-07-06 16:39:15 +0300577 uint8_t lane_count;
578
Jesse Barnes2dd24552013-04-25 12:55:01 -0700579 /* Panel fitter controls for gen2-gen4 + VLV */
Jesse Barnesb074cec2013-04-25 12:55:02 -0700580 struct {
581 u32 control;
582 u32 pgm_ratios;
Daniel Vetter68fc8742013-04-25 22:52:16 +0200583 u32 lvds_border_bits;
Jesse Barnesb074cec2013-04-25 12:55:02 -0700584 } gmch_pfit;
585
586 /* Panel fitter placement and size for Ironlake+ */
587 struct {
588 u32 pos;
589 u32 size;
Chris Wilsonfd4daa92013-08-27 17:04:17 +0100590 bool enabled;
Daniel Vetterfabf6e52014-05-29 14:10:22 +0200591 bool force_thru;
Jesse Barnesb074cec2013-04-25 12:55:02 -0700592 } pch_pfit;
Daniel Vetter33d29b12013-02-13 18:04:45 +0100593
Daniel Vetterca3a0ff2013-02-14 16:54:22 +0100594 /* FDI configuration, only valid if has_pch_encoder is set. */
Daniel Vetter33d29b12013-02-13 18:04:45 +0100595 int fdi_lanes;
Daniel Vetterca3a0ff2013-02-14 16:54:22 +0100596 struct intel_link_m_n fdi_m_n;
Paulo Zanoni42db64e2013-05-31 16:33:22 -0300597
598 bool ips_enabled;
Ville Syrjäläcf532bb2013-09-04 18:30:02 +0300599
Paulo Zanonif51be2e2016-01-19 11:35:50 -0200600 bool enable_fbc;
601
Ville Syrjäläcf532bb2013-09-04 18:30:02 +0300602 bool double_wide;
Dave Airlie0e32b392014-05-02 14:02:48 +1000603
604 bool dp_encoder_is_mst;
605 int pbn;
Chandra Kondurube41e332015-04-07 15:28:36 -0700606
607 struct intel_crtc_scaler_state scaler_state;
Maarten Lankhorst99d736a2015-06-01 12:50:09 +0200608
609 /* w/a for waiting 2 vblanks during crtc enable */
610 enum pipe hsw_workaround_pipe;
Matt Roperd21fbe82015-09-24 15:53:12 -0700611
612 /* IVB sprite scaling w/a (WaCxSRDisabledForSpriteScaling:ivb) */
613 bool disable_lp_wm;
Matt Roper4e0963c2015-09-24 15:53:15 -0700614
Matt Ropere8f1f022016-05-12 07:05:55 -0700615 struct intel_crtc_wm_state wm;
Lionel Landwerlin05dc6982016-03-16 10:57:15 +0000616
617 /* Gamma mode programmed on the pipe */
618 uint32_t gamma_mode;
Daniel Vetterb8cecdf2013-03-27 00:44:50 +0100619};
620
Ville Syrjälä262cd2e2015-06-24 22:00:04 +0300621struct vlv_wm_state {
622 struct vlv_pipe_wm wm[3];
623 struct vlv_sr_wm sr[3];
624 uint8_t num_active_planes;
625 uint8_t num_levels;
626 uint8_t level;
627 bool cxsr;
628};
629
Sourab Gupta84c33a62014-06-02 16:47:17 +0530630struct intel_mmio_flip {
Ander Conselvan de Oliveira9362c7c2014-10-28 15:10:14 +0200631 struct work_struct work;
Chris Wilsonbcafc4e2015-04-27 13:41:21 +0100632 struct drm_i915_private *i915;
Daniel Vettereed29a52015-05-21 14:21:25 +0200633 struct drm_i915_gem_request *req;
Chris Wilsonb2cfe0a2015-04-27 13:41:16 +0100634 struct intel_crtc *crtc;
Tvrtko Ursulin86efe242015-10-20 16:20:21 +0100635 unsigned int rotation;
Sourab Gupta84c33a62014-06-02 16:47:17 +0530636};
637
Jesse Barnes79e53942008-11-07 14:24:08 -0800638struct intel_crtc {
639 struct drm_crtc base;
Jesse Barnes80824002009-09-10 15:28:06 -0700640 enum pipe pipe;
641 enum plane plane;
Jesse Barnes79e53942008-11-07 14:24:08 -0800642 u8 lut_r[256], lut_g[256], lut_b[256];
Daniel Vetter08a48462012-07-02 11:43:47 +0200643 /*
644 * Whether the crtc and the connected output pipeline is active. Implies
645 * that crtc->enabled is set, i.e. the current mode configuration has
646 * some outputs connected to this crtc.
Daniel Vetter08a48462012-07-02 11:43:47 +0200647 */
648 bool active;
Imre Deak6efdf352013-10-16 17:25:52 +0300649 unsigned long enabled_power_domains;
Jesse Barnes652c3932009-08-17 13:31:43 -0700650 bool lowfreq_avail;
Daniel Vetter02e792f2009-09-15 22:57:34 +0200651 struct intel_overlay *overlay;
Kristian Høgsberg6b95a202009-11-18 11:25:18 -0500652 struct intel_unpin_work *unpin_work;
Chris Wilsoncda4b7d2010-07-09 08:45:04 +0100653
Chris Wilsonb4a98e52012-11-01 09:26:26 +0000654 atomic_t unpin_work_count;
655
Daniel Vettere506a0c2012-07-05 12:17:29 +0200656 /* Display surface base address adjustement for pageflips. Note that on
657 * gen4+ this only adjusts up to a tile, offsets within a tile are
658 * handled in the hw itself (with the TILEOFF register). */
Ville Syrjälä54ea9da2016-01-20 21:05:25 +0200659 u32 dspaddr_offset;
Paulo Zanoni2db33662015-09-14 15:20:03 -0300660 int adjusted_x;
661 int adjusted_y;
Daniel Vettere506a0c2012-07-05 12:17:29 +0200662
Chris Wilsoncda4b7d2010-07-09 08:45:04 +0100663 uint32_t cursor_addr;
Chris Wilson4b0e3332014-05-30 16:35:26 +0300664 uint32_t cursor_cntl;
Ville Syrjälädc41c152014-08-13 11:57:05 +0300665 uint32_t cursor_size;
Chris Wilson4b0e3332014-05-30 16:35:26 +0300666 uint32_t cursor_base;
Jesse Barnes4b645f12011-10-12 09:51:31 -0700667
Ander Conselvan de Oliveira6e3c9712015-01-15 14:55:25 +0200668 struct intel_crtc_state *config;
Daniel Vetterb8cecdf2013-03-27 00:44:50 +0100669
Ville Syrjälä10d83732013-01-29 18:13:34 +0200670 /* reset counter value when the last flip was submitted */
671 unsigned int reset_counter;
Paulo Zanoni86642812013-04-12 17:57:57 -0300672
673 /* Access to these should be protected by dev_priv->irq_lock. */
674 bool cpu_fifo_underrun_disabled;
675 bool pch_fifo_underrun_disabled;
Ville Syrjälä0b2ae6d2013-10-09 19:17:55 +0300676
677 /* per-pipe watermark state */
678 struct {
679 /* watermarks currently being used */
Matt Roper4e0963c2015-09-24 15:53:15 -0700680 union {
681 struct intel_pipe_wm ilk;
682 struct skl_pipe_wm skl;
683 } active;
Matt Ropered4a6a72016-02-23 17:20:13 -0800684
Ville Syrjälä852eb002015-06-24 22:00:07 +0300685 /* allow CxSR on this pipe */
686 bool cxsr_allowed;
Ville Syrjälä0b2ae6d2013-10-09 19:17:55 +0300687 } wm;
Ville Syrjälä8d7849d2014-04-29 13:35:46 +0300688
Ville Syrjälä80715b22014-05-15 20:23:23 +0300689 int scanline_offset;
Matt Roper32b7eee2014-12-24 07:59:06 -0800690
Jesse Barneseb120ef2015-09-15 14:19:32 -0700691 struct {
692 unsigned start_vbl_count;
693 ktime_t start_vbl_time;
694 int min_vbl, max_vbl;
695 int scanline_start;
696 } debug;
Maarten Lankhorst85a62bf2015-09-01 12:15:33 +0200697
Chandra Kondurube41e332015-04-07 15:28:36 -0700698 /* scalers available on this crtc */
699 int num_scalers;
Ville Syrjälä262cd2e2015-06-24 22:00:04 +0300700
701 struct vlv_wm_state wm_state;
Jesse Barnes79e53942008-11-07 14:24:08 -0800702};
703
Ville Syrjäläc35426d2013-08-07 13:29:50 +0300704struct intel_plane_wm_parameters {
705 uint32_t horiz_pixels;
Damien Lespiaued57cb82014-07-15 09:21:24 +0200706 uint32_t vert_pixels;
Chandra Konduru2cd601c2015-04-27 15:47:37 -0700707 /*
708 * For packed pixel formats:
709 * bytes_per_pixel - holds bytes per pixel
710 * For planar pixel formats:
711 * bytes_per_pixel - holds bytes per pixel for uv-plane
712 * y_bytes_per_pixel - holds bytes per pixel for y-plane
713 */
Ville Syrjäläc35426d2013-08-07 13:29:50 +0300714 uint8_t bytes_per_pixel;
Chandra Konduru2cd601c2015-04-27 15:47:37 -0700715 uint8_t y_bytes_per_pixel;
Ville Syrjäläc35426d2013-08-07 13:29:50 +0300716 bool enabled;
717 bool scaled;
Tvrtko Ursulin0fda6562015-02-27 15:12:35 +0000718 u64 tiling;
Tvrtko Ursulin1fc0a8f2015-03-23 11:10:38 +0000719 unsigned int rotation;
Ville Syrjälä6eb1a682015-06-24 22:00:03 +0300720 uint16_t fifo_size;
Ville Syrjäläc35426d2013-08-07 13:29:50 +0300721};
722
Jesse Barnesb840d907f2011-12-13 13:19:38 -0800723struct intel_plane {
724 struct drm_plane base;
Jesse Barnes7f1f3852013-04-02 11:22:20 -0700725 int plane;
Jesse Barnesb840d907f2011-12-13 13:19:38 -0800726 enum pipe pipe;
Damien Lespiau2d354c32012-10-22 18:19:27 +0100727 bool can_scale;
Jesse Barnesb840d907f2011-12-13 13:19:38 -0800728 int max_downscale;
Ville Syrjäläa9ff8712015-06-24 21:59:34 +0300729 uint32_t frontbuffer_bit;
Paulo Zanoni526682e2013-05-24 11:59:18 -0300730
731 /* Since we need to change the watermarks before/after
732 * enabling/disabling the planes, we need to store the parameters here
733 * as the other pieces of the struct may not reflect the values we want
734 * for the watermark calculations. Currently only Haswell uses this.
735 */
Ville Syrjäläc35426d2013-08-07 13:29:50 +0300736 struct intel_plane_wm_parameters wm;
Paulo Zanoni526682e2013-05-24 11:59:18 -0300737
Matt Roper8e7d6882015-01-21 16:35:41 -0800738 /*
739 * NOTE: Do not place new plane state fields here (e.g., when adding
740 * new plane properties). New runtime state should now be placed in
Maarten Lankhorst2fde1392016-01-07 11:54:06 +0100741 * the intel_plane_state structure and accessed via plane_state.
Matt Roper8e7d6882015-01-21 16:35:41 -0800742 */
743
Jesse Barnesb840d907f2011-12-13 13:19:38 -0800744 void (*update_plane)(struct drm_plane *plane,
Maarten Lankhorst2fde1392016-01-07 11:54:06 +0100745 const struct intel_crtc_state *crtc_state,
746 const struct intel_plane_state *plane_state);
Ville Syrjäläb39d53f2013-08-06 22:24:09 +0300747 void (*disable_plane)(struct drm_plane *plane,
Maarten Lankhorst7fabf5e2015-06-15 12:33:47 +0200748 struct drm_crtc *crtc);
Matt Roperc59cb172014-12-01 15:40:16 -0800749 int (*check_plane)(struct drm_plane *plane,
Maarten Lankhorst061e4b82015-06-15 12:33:46 +0200750 struct intel_crtc_state *crtc_state,
Matt Roperc59cb172014-12-01 15:40:16 -0800751 struct intel_plane_state *state);
Jesse Barnesb840d907f2011-12-13 13:19:38 -0800752};
753
Eugeni Dodonovb445e3b2012-04-16 22:20:35 -0300754struct intel_watermark_params {
755 unsigned long fifo_size;
756 unsigned long max_wm;
757 unsigned long default_wm;
758 unsigned long guard_size;
759 unsigned long cacheline_size;
760};
761
762struct cxsr_latency {
763 int is_desktop;
764 int is_ddr3;
765 unsigned long fsb_freq;
766 unsigned long mem_freq;
767 unsigned long display_sr;
768 unsigned long display_hpll_disable;
769 unsigned long cursor_sr;
770 unsigned long cursor_hpll_disable;
771};
772
Maarten Lankhorstde419ab2015-06-04 10:21:28 +0200773#define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
Jesse Barnes79e53942008-11-07 14:24:08 -0800774#define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
Ander Conselvan de Oliveira10f81c12015-03-20 16:18:01 +0200775#define to_intel_crtc_state(x) container_of(x, struct intel_crtc_state, base)
Zhenyu Wang5daa55e2010-03-30 14:39:28 +0800776#define to_intel_connector(x) container_of(x, struct intel_connector, base)
Chris Wilson4ef69c72010-09-09 15:14:28 +0100777#define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
Jesse Barnes79e53942008-11-07 14:24:08 -0800778#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
Jesse Barnesb840d907f2011-12-13 13:19:38 -0800779#define to_intel_plane(x) container_of(x, struct intel_plane, base)
Matt Roperea2c67b2014-12-23 10:41:52 -0800780#define to_intel_plane_state(x) container_of(x, struct intel_plane_state, base)
Matt Roper155e6362014-07-07 18:21:47 -0700781#define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL)
Jesse Barnes79e53942008-11-07 14:24:08 -0800782
Eugeni Dodonovf5bbfca2012-05-09 15:37:30 -0300783struct intel_hdmi {
Ville Syrjäläf0f59a02015-11-18 15:33:26 +0200784 i915_reg_t hdmi_reg;
Eugeni Dodonovf5bbfca2012-05-09 15:37:30 -0300785 int ddc_bus;
Ville Syrjäläb1ba1242016-05-02 22:08:23 +0300786 struct {
787 enum drm_dp_dual_mode_type type;
788 int max_tmds_clock;
789 } dp_dual_mode;
Ville Syrjälä0f2a2a72015-07-06 15:10:00 +0300790 bool limited_color_range;
Ville Syrjälä55bc60d2013-01-17 16:31:29 +0200791 bool color_range_auto;
Eugeni Dodonovf5bbfca2012-05-09 15:37:30 -0300792 bool has_hdmi_sink;
793 bool has_audio;
794 enum hdmi_force_audio force_audio;
Ville Syrjäläabedc072013-01-17 16:31:31 +0200795 bool rgb_quant_range_selectable;
Vandana Kannan94a11dd2014-06-11 11:06:01 +0530796 enum hdmi_picture_aspect aspect_ratio;
Shashank Sharmad8b4c432015-09-04 18:56:11 +0530797 struct intel_connector *attached_connector;
Eugeni Dodonovf5bbfca2012-05-09 15:37:30 -0300798 void (*write_infoframe)(struct drm_encoder *encoder,
Damien Lespiau178f7362013-08-06 20:32:18 +0100799 enum hdmi_infoframe_type type,
Ville Syrjäläfff63862013-12-10 15:19:08 +0200800 const void *frame, ssize_t len);
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300801 void (*set_infoframes)(struct drm_encoder *encoder,
Daniel Vetter6897b4b52014-04-24 23:54:47 +0200802 bool enable,
Ville Syrjälä7c5f93b2015-09-08 13:40:49 +0300803 const struct drm_display_mode *adjusted_mode);
Ville Syrjäläcda0aaa2015-11-26 18:27:07 +0200804 bool (*infoframe_enabled)(struct drm_encoder *encoder,
805 const struct intel_crtc_state *pipe_config);
Eugeni Dodonovf5bbfca2012-05-09 15:37:30 -0300806};
807
Dave Airlie0e32b392014-05-02 14:02:48 +1000808struct intel_dp_mst_encoder;
Adam Jacksonb091cd92012-09-18 10:58:49 -0400809#define DP_MAX_DOWNSTREAM_PORTS 0x10
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300810
Ramalingam Cfe3cd482015-02-13 15:32:59 +0530811/*
812 * enum link_m_n_set:
813 * When platform provides two set of M_N registers for dp, we can
814 * program them and switch between them incase of DRRS.
815 * But When only one such register is provided, we have to program the
816 * required divider value on that registers itself based on the DRRS state.
817 *
818 * M1_N1 : Program dp_m_n on M1_N1 registers
819 * dp_m2_n2 on M2_N2 registers (If supported)
820 *
821 * M2_N2 : Program dp_m2_n2 on M1_N1 registers
822 * M2_N2 registers are not supported
823 */
824
825enum link_m_n_set {
826 /* Sets the m1_n1 and m2_n2 */
827 M1_N1 = 0,
828 M2_N2
829};
830
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300831struct intel_dp {
Ville Syrjäläf0f59a02015-11-18 15:33:26 +0200832 i915_reg_t output_reg;
833 i915_reg_t aux_ch_ctl_reg;
834 i915_reg_t aux_ch_data_reg[5];
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300835 uint32_t DP;
Ville Syrjälä901c2da2015-08-17 18:05:12 +0300836 int link_rate;
837 uint8_t lane_count;
Shubhangi Shrivastava30d9aa42016-03-30 18:05:25 +0530838 uint8_t sink_count;
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300839 bool has_audio;
Shubhangi Shrivastava7d23e3c2016-03-30 18:05:23 +0530840 bool detect_done;
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300841 enum hdmi_force_audio force_audio;
Ville Syrjälä0f2a2a72015-07-06 15:10:00 +0300842 bool limited_color_range;
Ville Syrjälä55bc60d2013-01-17 16:31:29 +0200843 bool color_range_auto;
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300844 uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
Shobhit Kumar2293bb52013-07-11 18:44:56 -0300845 uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
Adam Jacksonb091cd92012-09-18 10:58:49 -0400846 uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
Yetunde Adebisi86ee27b2016-04-05 15:10:51 +0100847 uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
Ville Syrjälä94ca7192015-03-13 19:40:31 +0200848 /* sink rates as reported by DP_SUPPORTED_LINK_RATES */
849 uint8_t num_sink_rates;
850 int sink_rates[DP_MAX_SUPPORTED_RATES];
Jani Nikula9d1a1032014-03-14 16:51:15 +0200851 struct drm_dp_aux aux;
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300852 uint8_t train_set[4];
853 int panel_power_up_delay;
854 int panel_power_down_delay;
855 int panel_power_cycle_delay;
856 int backlight_on_delay;
857 int backlight_off_delay;
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300858 struct delayed_work panel_vdd_work;
859 bool want_panel_vdd;
Paulo Zanonidce56b32013-12-19 14:29:40 -0200860 unsigned long last_power_on;
861 unsigned long last_backlight_off;
Abhay Kumard28d4732016-01-22 17:39:04 -0800862 ktime_t panel_power_off_time;
Dave Airlie5d42f822014-08-05 09:04:59 +1000863
Clint Taylor01527b32014-07-07 13:01:46 -0700864 struct notifier_block edp_notifier;
865
Ville Syrjäläa4a5d2f2014-09-04 14:54:20 +0300866 /*
867 * Pipe whose power sequencer is currently locked into
868 * this port. Only relevant on VLV/CHV.
869 */
870 enum pipe pps_pipe;
Ville Syrjälä36b5f422014-10-16 21:27:30 +0300871 struct edp_power_seq pps_delays;
Ville Syrjäläa4a5d2f2014-09-04 14:54:20 +0300872
Dave Airlie0e32b392014-05-02 14:02:48 +1000873 bool can_mst; /* this port supports mst */
874 bool is_mst;
875 int active_mst_links;
876 /* connector directly attached - won't be use for modeset in mst world */
Jani Nikuladd06f902012-10-19 14:51:50 +0300877 struct intel_connector *attached_connector;
Damien Lespiauec5b01d2014-01-21 13:35:39 +0000878
Dave Airlie0e32b392014-05-02 14:02:48 +1000879 /* mst connector list */
880 struct intel_dp_mst_encoder *mst_encoders[I915_MAX_PIPES];
881 struct drm_dp_mst_topology_mgr mst_mgr;
882
Damien Lespiauec5b01d2014-01-21 13:35:39 +0000883 uint32_t (*get_aux_clock_divider)(struct intel_dp *dp, int index);
Damien Lespiau153b1102014-01-21 13:37:15 +0000884 /*
885 * This function returns the value we have to program the AUX_CTL
886 * register with to kick off an AUX transaction.
887 */
888 uint32_t (*get_aux_send_ctl)(struct intel_dp *dp,
889 bool has_aux_irq,
890 int send_bytes,
891 uint32_t aux_clock_divider);
Ander Conselvan de Oliveiraad642172015-10-23 13:01:49 +0300892
893 /* This is called before a link training is starterd */
894 void (*prepare_link_retrain)(struct intel_dp *intel_dp);
895
Mika Kahola4e96c972015-04-29 09:17:39 +0300896 bool train_set_valid;
Todd Previtec5d5ab72015-04-15 08:38:38 -0700897
898 /* Displayport compliance testing */
899 unsigned long compliance_test_type;
Todd Previte559be302015-05-04 07:48:20 -0700900 unsigned long compliance_test_data;
901 bool compliance_test_active;
Shobhit Kumar54d63ca2012-06-29 16:03:35 -0300902};
903
Paulo Zanonida63a9f2012-10-26 19:05:46 -0200904struct intel_digital_port {
905 struct intel_encoder base;
Paulo Zanoni174edf12012-10-26 19:05:50 -0200906 enum port port;
Stéphane Marchesinbcf53de2013-07-12 13:54:41 -0700907 u32 saved_port_bits;
Paulo Zanonida63a9f2012-10-26 19:05:46 -0200908 struct intel_dp dp;
909 struct intel_hdmi hdmi;
Daniel Vetterb2c5c182015-01-23 06:00:31 +0100910 enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
Ville Syrjäläb0b33842015-07-08 23:45:55 +0300911 bool release_cl2_override;
Ville Syrjäläccb1a832015-12-08 19:59:38 +0200912 uint8_t max_lanes;
Takashi Iwaicae666c2015-11-12 15:23:41 +0100913 /* for communication with audio component; protected by av_mutex */
914 const struct drm_connector *audio_connector;
Paulo Zanonida63a9f2012-10-26 19:05:46 -0200915};
916
Dave Airlie0e32b392014-05-02 14:02:48 +1000917struct intel_dp_mst_encoder {
918 struct intel_encoder base;
919 enum pipe pipe;
920 struct intel_digital_port *primary;
Dave Airlie0552f762016-03-09 11:14:38 +1000921 struct intel_connector *connector;
Dave Airlie0e32b392014-05-02 14:02:48 +1000922};
923
Ville Syrjälä65d64cc2015-07-08 23:45:53 +0300924static inline enum dpio_channel
Jesse Barnes89b667f2013-04-18 14:51:36 -0700925vlv_dport_to_channel(struct intel_digital_port *dport)
926{
927 switch (dport->port) {
928 case PORT_B:
Chon Ming Lee00fc31b2014-04-09 13:28:15 +0300929 case PORT_D:
Chon Ming Leee4607fc2013-11-06 14:36:35 +0800930 return DPIO_CH0;
Jesse Barnes89b667f2013-04-18 14:51:36 -0700931 case PORT_C:
Chon Ming Leee4607fc2013-11-06 14:36:35 +0800932 return DPIO_CH1;
Jesse Barnes89b667f2013-04-18 14:51:36 -0700933 default:
934 BUG();
935 }
936}
937
Ville Syrjälä65d64cc2015-07-08 23:45:53 +0300938static inline enum dpio_phy
939vlv_dport_to_phy(struct intel_digital_port *dport)
940{
941 switch (dport->port) {
942 case PORT_B:
943 case PORT_C:
944 return DPIO_PHY0;
945 case PORT_D:
946 return DPIO_PHY1;
947 default:
948 BUG();
949 }
950}
951
952static inline enum dpio_channel
Chon Ming Leeeb69b0e2014-04-09 13:28:16 +0300953vlv_pipe_to_channel(enum pipe pipe)
954{
955 switch (pipe) {
956 case PIPE_A:
957 case PIPE_C:
958 return DPIO_CH0;
959 case PIPE_B:
960 return DPIO_CH1;
961 default:
962 BUG();
963 }
964}
965
Chris Wilsonf875c152010-09-09 15:44:14 +0100966static inline struct drm_crtc *
967intel_get_crtc_for_pipe(struct drm_device *dev, int pipe)
968{
969 struct drm_i915_private *dev_priv = dev->dev_private;
970 return dev_priv->pipe_to_crtc_mapping[pipe];
971}
972
Chris Wilson417ae142011-01-19 15:04:42 +0000973static inline struct drm_crtc *
974intel_get_crtc_for_plane(struct drm_device *dev, int plane)
975{
976 struct drm_i915_private *dev_priv = dev->dev_private;
977 return dev_priv->plane_to_crtc_mapping[plane];
978}
979
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100980struct intel_unpin_work {
981 struct work_struct work;
Chris Wilsonb4a98e52012-11-01 09:26:26 +0000982 struct drm_crtc *crtc;
Tvrtko Ursulinab8d6672015-02-02 15:44:15 +0000983 struct drm_framebuffer *old_fb;
Chris Wilson05394f32010-11-08 19:18:58 +0000984 struct drm_i915_gem_object *pending_flip_obj;
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100985 struct drm_pending_vblank_event *event;
Chris Wilsone7d841c2012-12-03 11:36:30 +0000986 atomic_t pending;
Ville Syrjälä75f7f3e2014-04-15 21:41:34 +0300987 u32 flip_count;
988 u32 gtt_offset;
John Harrisonf06cc1b2014-11-24 18:49:37 +0000989 struct drm_i915_gem_request *flip_queued_req;
Ville Syrjälä66f59c52015-09-14 22:43:46 +0300990 u32 flip_queued_vblank;
991 u32 flip_ready_vblank;
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100992};
993
Paulo Zanoni5f1aae62013-09-24 13:52:53 -0300994struct intel_load_detect_pipe {
Maarten Lankhorstedde3612016-02-17 09:18:35 +0100995 struct drm_atomic_state *restore_state;
Paulo Zanoni5f1aae62013-09-24 13:52:53 -0300996};
Daniel Vetterb9805142012-08-31 17:37:33 +0200997
Paulo Zanoni5f1aae62013-09-24 13:52:53 -0300998static inline struct intel_encoder *
999intel_attached_encoder(struct drm_connector *connector)
Chris Wilsondf0e9242010-09-09 16:20:55 +01001000{
1001 return to_intel_connector(connector)->encoder;
1002}
1003
Paulo Zanonida63a9f2012-10-26 19:05:46 -02001004static inline struct intel_digital_port *
1005enc_to_dig_port(struct drm_encoder *encoder)
1006{
1007 return container_of(encoder, struct intel_digital_port, base.base);
1008}
1009
Dave Airlie0e32b392014-05-02 14:02:48 +10001010static inline struct intel_dp_mst_encoder *
1011enc_to_mst(struct drm_encoder *encoder)
1012{
1013 return container_of(encoder, struct intel_dp_mst_encoder, base.base);
1014}
1015
Imre Deak9ff8c9b2013-05-08 13:14:02 +03001016static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder)
1017{
1018 return &enc_to_dig_port(encoder)->dp;
1019}
1020
Paulo Zanonida63a9f2012-10-26 19:05:46 -02001021static inline struct intel_digital_port *
1022dp_to_dig_port(struct intel_dp *intel_dp)
1023{
1024 return container_of(intel_dp, struct intel_digital_port, dp);
1025}
1026
1027static inline struct intel_digital_port *
1028hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
1029{
1030 return container_of(intel_hdmi, struct intel_digital_port, hdmi);
Paulo Zanoni7739c332012-10-15 15:51:29 -03001031}
1032
Damien Lespiau6af31a62014-03-28 00:18:33 +05301033/*
1034 * Returns the number of planes for this pipe, ie the number of sprites + 1
1035 * (primary plane). This doesn't count the cursor plane then.
1036 */
1037static inline unsigned int intel_num_planes(struct intel_crtc *crtc)
1038{
1039 return INTEL_INFO(crtc->base.dev)->num_sprites[crtc->pipe] + 1;
1040}
Damien Lespiaub0ea7d32012-12-13 16:09:00 +00001041
Daniel Vetter47339cd2014-09-30 10:56:46 +02001042/* intel_fifo_underrun.c */
Daniel Vettera72e4c92014-09-30 10:56:47 +02001043bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
Paulo Zanoni87440422013-09-24 15:48:31 -03001044 enum pipe pipe, bool enable);
Daniel Vettera72e4c92014-09-30 10:56:47 +02001045bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
Paulo Zanoni87440422013-09-24 15:48:31 -03001046 enum transcoder pch_transcoder,
1047 bool enable);
Daniel Vetter1f7247c2014-09-30 10:56:48 +02001048void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
1049 enum pipe pipe);
1050void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
1051 enum transcoder pch_transcoder);
Ville Syrjäläaca7b682015-10-30 19:22:21 +02001052void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv);
1053void intel_check_pch_fifo_underruns(struct drm_i915_private *dev_priv);
Daniel Vetter47339cd2014-09-30 10:56:46 +02001054
1055/* i915_irq.c */
Daniel Vetter480c8032014-07-16 09:49:40 +02001056void gen5_enable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
1057void gen5_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
1058void gen6_enable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
1059void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
Chris Wilsondc979972016-05-10 14:10:04 +01001060void gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv);
Tvrtko Ursulin91d14252016-05-06 14:48:28 +01001061void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv);
1062void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv);
Imre Deak59d02a12014-12-19 19:33:26 +02001063u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask);
Daniel Vetterb9632912014-09-30 10:56:44 +02001064void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv);
1065void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv);
Jesse Barnes9df7575f2014-06-20 09:29:20 -07001066static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
1067{
1068 /*
1069 * We only use drm_irq_uninstall() at unload and VT switch, so
1070 * this is the only thing we need to check.
1071 */
Daniel Vetter2aeb7d32014-09-30 10:56:43 +02001072 return dev_priv->pm.irqs_enabled;
Jesse Barnes9df7575f2014-06-20 09:29:20 -07001073}
1074
Ville Syrjäläa225f072014-04-29 13:35:45 +03001075int intel_get_crtc_scanline(struct intel_crtc *crtc);
Damien Lespiau4c6c03b2015-03-06 18:50:48 +00001076void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
1077 unsigned int pipe_mask);
Ville Syrjäläaae8ba82016-02-19 20:47:30 +02001078void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
1079 unsigned int pipe_mask);
Jesse Barnes79e53942008-11-07 14:24:08 -08001080
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001081/* intel_crt.c */
Paulo Zanoni87440422013-09-24 15:48:31 -03001082void intel_crt_init(struct drm_device *dev);
Jesse Barnes79e53942008-11-07 14:24:08 -08001083
Jesse Barnes79e53942008-11-07 14:24:08 -08001084
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001085/* intel_ddi.c */
Ville Syrjäläe404ba8d2015-08-17 18:46:20 +03001086void intel_ddi_clk_select(struct intel_encoder *encoder,
1087 const struct intel_crtc_state *pipe_config);
Ville Syrjälä6a7e4f92015-12-08 19:59:44 +02001088void intel_prepare_ddi_buffer(struct intel_encoder *encoder);
Paulo Zanoni87440422013-09-24 15:48:31 -03001089void hsw_fdi_link_train(struct drm_crtc *crtc);
1090void intel_ddi_init(struct drm_device *dev, enum port port);
1091enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder);
1092bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
Paulo Zanoni87440422013-09-24 15:48:31 -03001093void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc);
1094void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
1095 enum transcoder cpu_transcoder);
1096void intel_ddi_enable_pipe_clock(struct intel_crtc *intel_crtc);
1097void intel_ddi_disable_pipe_clock(struct intel_crtc *intel_crtc);
Ander Conselvan de Oliveira190f68c2015-01-15 14:55:23 +02001098bool intel_ddi_pll_select(struct intel_crtc *crtc,
1099 struct intel_crtc_state *crtc_state);
Paulo Zanoni87440422013-09-24 15:48:31 -03001100void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
Ander Conselvan de Oliveiraad642172015-10-23 13:01:49 +03001101void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
Paulo Zanoni87440422013-09-24 15:48:31 -03001102bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
1103void intel_ddi_fdi_disable(struct drm_crtc *crtc);
1104void intel_ddi_get_config(struct intel_encoder *encoder,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001105 struct intel_crtc_state *pipe_config);
Satheeshakrishna Mbcddf6102014-08-22 09:49:10 +05301106struct intel_encoder *
1107intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state);
Eugeni Dodonov72662e12012-05-09 15:37:31 -03001108
Dave Airlie44905a272014-05-02 13:36:43 +10001109void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder);
Dave Airlie0e32b392014-05-02 14:02:48 +10001110void intel_ddi_clock_get(struct intel_encoder *encoder,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001111 struct intel_crtc_state *pipe_config);
Dave Airlie0e32b392014-05-02 14:02:48 +10001112void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
David Weinehallf8896f52015-06-25 11:11:03 +03001113uint32_t ddi_signal_levels(struct intel_dp *intel_dp);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001114
Daniel Vetterb680c372014-09-19 18:27:27 +02001115/* intel_frontbuffer.c */
Daniel Vetterf99d7062014-06-19 16:01:59 +02001116void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
Paulo Zanonia4001f12015-02-13 17:23:44 -02001117 enum fb_op_origin origin);
Daniel Vetterf99d7062014-06-19 16:01:59 +02001118void intel_frontbuffer_flip_prepare(struct drm_device *dev,
1119 unsigned frontbuffer_bits);
1120void intel_frontbuffer_flip_complete(struct drm_device *dev,
1121 unsigned frontbuffer_bits);
Daniel Vetterf99d7062014-06-19 16:01:59 +02001122void intel_frontbuffer_flip(struct drm_device *dev,
Daniel Vetterfdbff922015-06-18 11:23:24 +02001123 unsigned frontbuffer_bits);
Tvrtko Ursulin6761dd32015-03-23 11:10:32 +00001124unsigned int intel_fb_align_height(struct drm_device *dev,
1125 unsigned int height,
1126 uint32_t pixel_format,
1127 uint64_t fb_format_modifier);
Rodrigo Vivide152b62015-07-07 16:28:51 -07001128void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire,
1129 enum fb_op_origin origin);
Ville Syrjälä7b49f942016-01-12 21:08:32 +02001130u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv,
1131 uint64_t fb_modifier, uint32_t pixel_format);
Daniel Vetterb680c372014-09-19 18:27:27 +02001132
Jani Nikula7c10a2b2014-10-27 16:26:43 +02001133/* intel_audio.c */
Imre Deak88212942016-03-16 13:38:53 +02001134void intel_init_audio_hooks(struct drm_i915_private *dev_priv);
Jani Nikula69bfe1a2014-10-27 16:26:50 +02001135void intel_audio_codec_enable(struct intel_encoder *encoder);
1136void intel_audio_codec_disable(struct intel_encoder *encoder);
Imre Deak58fddc22015-01-08 17:54:14 +02001137void i915_audio_component_init(struct drm_i915_private *dev_priv);
1138void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
Jani Nikula7c10a2b2014-10-27 16:26:43 +02001139
Daniel Vetterb680c372014-09-19 18:27:27 +02001140/* intel_display.c */
Ville Syrjälä19ab4ed2016-04-27 17:43:22 +03001141void intel_update_rawclk(struct drm_i915_private *dev_priv);
Ville Syrjäläc30fec62016-03-04 21:43:02 +02001142int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
1143 const char *name, u32 reg, int ref_freq);
Matt Roper65a3fea2015-01-21 16:35:42 -08001144extern const struct drm_plane_funcs intel_plane_funcs;
Imre Deak88212942016-03-16 13:38:53 +02001145void intel_init_display_hooks(struct drm_i915_private *dev_priv);
Ville Syrjälä1663b9d2016-02-15 22:54:45 +02001146unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info);
Daniel Vetterb680c372014-09-19 18:27:27 +02001147bool intel_has_pending_fb_unpin(struct drm_device *dev);
Tvrtko Ursulin7d993732016-04-28 12:57:00 +01001148void intel_mark_busy(struct drm_i915_private *dev_priv);
1149void intel_mark_idle(struct drm_i915_private *dev_priv);
Paulo Zanoni87440422013-09-24 15:48:31 -03001150void intel_crtc_restore_mode(struct drm_crtc *crtc);
Maarten Lankhorst70e0bd72015-07-13 16:30:29 +02001151int intel_display_suspend(struct drm_device *dev);
Paulo Zanoni87440422013-09-24 15:48:31 -03001152void intel_encoder_destroy(struct drm_encoder *encoder);
Ander Conselvan de Oliveira08d9bc92015-04-10 10:59:10 +03001153int intel_connector_init(struct intel_connector *);
1154struct intel_connector *intel_connector_alloc(void);
Paulo Zanoni87440422013-09-24 15:48:31 -03001155bool intel_connector_get_hw_state(struct intel_connector *connector);
Paulo Zanoni87440422013-09-24 15:48:31 -03001156void intel_connector_attach_encoder(struct intel_connector *connector,
1157 struct intel_encoder *encoder);
1158struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
1159struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
1160 struct drm_crtc *crtc);
Jesse Barnes752aa882013-10-31 18:55:49 +02001161enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001162int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
1163 struct drm_file *file_priv);
Paulo Zanoni87440422013-09-24 15:48:31 -03001164enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
1165 enum pipe pipe);
Damien Lespiau40935612014-10-29 11:16:59 +00001166bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type);
Daniel Vetter4f905cf92014-09-15 14:12:21 +02001167static inline void
1168intel_wait_for_vblank(struct drm_device *dev, int pipe)
1169{
1170 drm_wait_one_vblank(dev, pipe);
1171}
Ville Syrjälä0c241d52015-10-30 19:23:22 +02001172static inline void
1173intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)
1174{
1175 const struct intel_crtc *crtc =
1176 to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
1177
1178 if (crtc->active)
1179 intel_wait_for_vblank(dev, pipe);
1180}
Paulo Zanoni87440422013-09-24 15:48:31 -03001181int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
Chon Ming Leee4607fc2013-11-06 14:36:35 +08001182void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
Ville Syrjälä9b6de0a2015-04-10 18:21:31 +03001183 struct intel_digital_port *dport,
1184 unsigned int expected_mask);
Paulo Zanoni87440422013-09-24 15:48:31 -03001185bool intel_get_load_detect_pipe(struct drm_connector *connector,
1186 struct drm_display_mode *mode,
Rob Clark51fd3712013-11-19 12:10:12 -05001187 struct intel_load_detect_pipe *old,
1188 struct drm_modeset_acquire_ctx *ctx);
Paulo Zanoni87440422013-09-24 15:48:31 -03001189void intel_release_load_detect_pipe(struct drm_connector *connector,
Ander Conselvan de Oliveira49172fe2015-03-20 16:18:02 +02001190 struct intel_load_detect_pipe *old,
1191 struct drm_modeset_acquire_ctx *ctx);
Ville Syrjälä3465c582016-02-15 22:54:43 +02001192int intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
1193 unsigned int rotation);
Chris Wilsonfb4b8ce2016-04-28 09:56:35 +01001194void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation);
Daniel Vettera8bb6812014-02-10 18:00:39 +01001195struct drm_framebuffer *
1196__intel_framebuffer_create(struct drm_device *dev,
Paulo Zanoni87440422013-09-24 15:48:31 -03001197 struct drm_mode_fb_cmd2 *mode_cmd,
1198 struct drm_i915_gem_object *obj);
Tvrtko Ursulin91d14252016-05-06 14:48:28 +01001199void intel_finish_page_flip(struct drm_i915_private *dev_priv, int pipe);
Tvrtko Ursulin91d14252016-05-06 14:48:28 +01001200void intel_check_page_flip(struct drm_i915_private *dev_priv, int pipe);
Matt Roper6beb8c232014-12-01 15:40:14 -08001201int intel_prepare_plane_fb(struct drm_plane *plane,
Tvrtko Ursulind136dfe2015-03-03 14:22:31 +00001202 const struct drm_plane_state *new_state);
Matt Roper38f3ce32014-12-02 07:45:25 -08001203void intel_cleanup_plane_fb(struct drm_plane *plane,
Tvrtko Ursulind136dfe2015-03-03 14:22:31 +00001204 const struct drm_plane_state *old_state);
Matt Ropera98b3432015-01-21 16:35:43 -08001205int intel_plane_atomic_get_property(struct drm_plane *plane,
1206 const struct drm_plane_state *state,
1207 struct drm_property *property,
1208 uint64_t *val);
1209int intel_plane_atomic_set_property(struct drm_plane *plane,
1210 struct drm_plane_state *state,
1211 struct drm_property *property,
1212 uint64_t val);
Maarten Lankhorstda20eab2015-06-15 12:33:44 +02001213int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
1214 struct drm_plane_state *plane_state);
Daniel Vetter716c2e52014-06-25 22:02:02 +03001215
Ville Syrjälä832be822016-01-12 21:08:33 +02001216unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
1217 uint64_t fb_modifier, unsigned int cpp);
Tvrtko Ursulin50470bb2015-03-23 11:10:36 +00001218
Tvrtko Ursulin121920f2015-03-23 11:10:37 +00001219static inline bool
1220intel_rotation_90_or_270(unsigned int rotation)
1221{
1222 return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
1223}
1224
Sonika Jindal3b7a5112015-04-10 14:37:29 +05301225void intel_create_rotation_property(struct drm_device *dev,
1226 struct intel_plane *plane);
1227
Ander Conselvan de Oliveira7abd4b32016-03-08 17:46:15 +02001228void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
1229 enum pipe pipe);
1230
Tvrtko Ursulin3f36b932016-01-19 15:25:17 +00001231int vlv_force_pll_on(struct drm_device *dev, enum pipe pipe,
1232 const struct dpll *dpll);
Ville Syrjäläd288f652014-10-28 13:20:22 +02001233void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe);
Ville Syrjälä8802e5b2016-02-17 21:41:12 +02001234int lpt_get_iclkip(struct drm_i915_private *dev_priv);
Ville Syrjäläd288f652014-10-28 13:20:22 +02001235
Daniel Vetter716c2e52014-06-25 22:02:02 +03001236/* modesetting asserts */
Daniel Vetterb680c372014-09-19 18:27:27 +02001237void assert_panel_unlocked(struct drm_i915_private *dev_priv,
1238 enum pipe pipe);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001239void assert_pll(struct drm_i915_private *dev_priv,
1240 enum pipe pipe, bool state);
1241#define assert_pll_enabled(d, p) assert_pll(d, p, true)
1242#define assert_pll_disabled(d, p) assert_pll(d, p, false)
Lionel Landwerlin8563b1e2016-03-16 10:57:14 +00001243void assert_dsi_pll(struct drm_i915_private *dev_priv, bool state);
1244#define assert_dsi_pll_enabled(d) assert_dsi_pll(d, true)
1245#define assert_dsi_pll_disabled(d) assert_dsi_pll(d, false)
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001246void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
1247 enum pipe pipe, bool state);
1248#define assert_fdi_rx_pll_enabled(d, p) assert_fdi_rx_pll(d, p, true)
1249#define assert_fdi_rx_pll_disabled(d, p) assert_fdi_rx_pll(d, p, false)
Paulo Zanoni87440422013-09-24 15:48:31 -03001250void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001251#define assert_pipe_enabled(d, p) assert_pipe(d, p, true)
1252#define assert_pipe_disabled(d, p) assert_pipe(d, p, false)
Ville Syrjälä4f2d9932016-02-15 22:54:44 +02001253u32 intel_compute_tile_offset(int *x, int *y,
1254 const struct drm_framebuffer *fb, int plane,
Ville Syrjälä8d0deca2016-02-15 22:54:41 +02001255 unsigned int pitch,
1256 unsigned int rotation);
Chris Wilsonc0336662016-05-06 15:40:21 +01001257void intel_prepare_reset(struct drm_i915_private *dev_priv);
1258void intel_finish_reset(struct drm_i915_private *dev_priv);
Paulo Zanonia14cb6f2014-03-07 20:08:17 -03001259void hsw_enable_pc8(struct drm_i915_private *dev_priv);
1260void hsw_disable_pc8(struct drm_i915_private *dev_priv);
Imre Deakc6c46962016-04-01 16:02:40 +03001261void broxton_init_cdclk(struct drm_i915_private *dev_priv);
1262void broxton_uninit_cdclk(struct drm_i915_private *dev_priv);
Imre Deakadc7f042016-04-04 17:27:10 +03001263bool broxton_cdclk_verify_state(struct drm_i915_private *dev_priv);
Imre Deakc6c46962016-04-01 16:02:40 +03001264void broxton_ddi_phy_init(struct drm_i915_private *dev_priv);
1265void broxton_ddi_phy_uninit(struct drm_i915_private *dev_priv);
Imre Deakadc7f042016-04-04 17:27:10 +03001266void broxton_ddi_phy_verify_state(struct drm_i915_private *dev_priv);
Imre Deakda2f41d2016-04-20 20:27:56 +03001267void gen9_sanitize_dc_state(struct drm_i915_private *dev_priv);
A.Sunil Kamath664326f2014-11-24 13:37:44 +05301268void bxt_enable_dc9(struct drm_i915_private *dev_priv);
1269void bxt_disable_dc9(struct drm_i915_private *dev_priv);
Imre Deakf62c79b2016-04-20 20:27:57 +03001270void gen9_enable_dc5(struct drm_i915_private *dev_priv);
Damien Lespiau5d96d8a2015-05-21 16:37:48 +01001271void skl_init_cdclk(struct drm_i915_private *dev_priv);
Shobhit Kumarc73666f2015-10-20 18:13:12 +05301272int skl_sanitize_cdclk(struct drm_i915_private *dev_priv);
Damien Lespiau5d96d8a2015-05-21 16:37:48 +01001273void skl_uninit_cdclk(struct drm_i915_private *dev_priv);
Animesh Manna0a9d2be2015-09-29 11:01:59 +05301274void skl_enable_dc6(struct drm_i915_private *dev_priv);
1275void skl_disable_dc6(struct drm_i915_private *dev_priv);
Paulo Zanoni87440422013-09-24 15:48:31 -03001276void intel_dp_get_m_n(struct intel_crtc *crtc,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001277 struct intel_crtc_state *pipe_config);
Ramalingam Cfe3cd482015-02-13 15:32:59 +05301278void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Paulo Zanoni87440422013-09-24 15:48:31 -03001279int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
Imre Deak5ab7b0b2015-03-06 03:29:25 +02001280bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state, int target_clock,
Ander Conselvan de Oliveira9e2c8472016-05-04 12:11:57 +03001281 struct dpll *best_clock);
1282int chv_calc_dpll_params(int refclk, struct dpll *pll_clock);
Imre Deakdccbea32015-06-22 23:35:51 +03001283
Paulo Zanoni87440422013-09-24 15:48:31 -03001284bool intel_crtc_active(struct drm_crtc *crtc);
Ville Syrjälä20bc86732013-10-01 18:02:17 +03001285void hsw_enable_ips(struct intel_crtc *crtc);
1286void hsw_disable_ips(struct intel_crtc *crtc);
Imre Deak319be8a2014-03-04 19:22:57 +02001287enum intel_display_power_domain
1288intel_display_port_power_domain(struct intel_encoder *intel_encoder);
Ville Syrjälä25f78f52015-11-16 15:01:04 +01001289enum intel_display_power_domain
1290intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder);
Daniel Vetterf6a83282014-02-11 15:28:57 -08001291void intel_mode_from_pipe_config(struct drm_display_mode *mode,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001292 struct intel_crtc_state *pipe_config);
Maarten Lankhorst86adf9d2015-06-22 09:50:32 +02001293
Maarten Lankhorste435d6e2015-07-13 16:30:15 +02001294int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
Chandra Konduru6156a452015-04-27 13:48:39 -07001295int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001296
Mika Kuoppala44eb0cb2015-10-30 13:26:15 +02001297u32 intel_plane_obj_offset(struct intel_plane *intel_plane,
1298 struct drm_i915_gem_object *obj,
1299 unsigned int plane);
Tvrtko Ursulindedf2782015-09-21 10:45:35 +01001300
Chandra Konduru6156a452015-04-27 13:48:39 -07001301u32 skl_plane_ctl_format(uint32_t pixel_format);
1302u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
1303u32 skl_plane_ctl_rotation(unsigned int rotation);
Tvrtko Ursulin121920f2015-03-23 11:10:37 +00001304
Daniel Vettereb805622015-05-04 14:58:44 +02001305/* intel_csr.c */
Daniel Vetterf4448372015-10-28 23:59:02 +02001306void intel_csr_ucode_init(struct drm_i915_private *);
Imre Deak2abc5252016-03-04 21:57:41 +02001307void intel_csr_load_program(struct drm_i915_private *);
Daniel Vetterf4448372015-10-28 23:59:02 +02001308void intel_csr_ucode_fini(struct drm_i915_private *);
Imre Deakf74ed082016-04-18 14:48:21 +03001309void intel_csr_ucode_suspend(struct drm_i915_private *);
1310void intel_csr_ucode_resume(struct drm_i915_private *);
Daniel Vettereb805622015-05-04 14:58:44 +02001311
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001312/* intel_dp.c */
Ville Syrjäläf0f59a02015-11-18 15:33:26 +02001313void intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
Paulo Zanoni87440422013-09-24 15:48:31 -03001314bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
1315 struct intel_connector *intel_connector);
Ville Syrjälä901c2da2015-08-17 18:05:12 +03001316void intel_dp_set_link_params(struct intel_dp *intel_dp,
1317 const struct intel_crtc_state *pipe_config);
Paulo Zanoni87440422013-09-24 15:48:31 -03001318void intel_dp_start_link_train(struct intel_dp *intel_dp);
Paulo Zanoni87440422013-09-24 15:48:31 -03001319void intel_dp_stop_link_train(struct intel_dp *intel_dp);
1320void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
Imre Deakbf93ba62016-04-18 10:04:21 +03001321void intel_dp_encoder_reset(struct drm_encoder *encoder);
1322void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
Paulo Zanoni87440422013-09-24 15:48:31 -03001323void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Rodrigo Vivid2e216d2014-01-24 13:36:17 -02001324int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
Paulo Zanoni87440422013-09-24 15:48:31 -03001325bool intel_dp_compute_config(struct intel_encoder *encoder,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001326 struct intel_crtc_state *pipe_config);
Ville Syrjälä5d8a7752013-11-01 18:22:39 +02001327bool intel_dp_is_edp(struct drm_device *dev, enum port port);
Daniel Vetterb2c5c182015-01-23 06:00:31 +01001328enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
1329 bool long_hpd);
Daniel Vetter4be73782014-01-17 14:39:48 +01001330void intel_edp_backlight_on(struct intel_dp *intel_dp);
1331void intel_edp_backlight_off(struct intel_dp *intel_dp);
Jani Nikula24f3e092014-03-17 16:43:36 +02001332void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
Daniel Vetter4be73782014-01-17 14:39:48 +01001333void intel_edp_panel_on(struct intel_dp *intel_dp);
1334void intel_edp_panel_off(struct intel_dp *intel_dp);
Dave Airlie0e32b392014-05-02 14:02:48 +10001335void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector);
1336void intel_dp_mst_suspend(struct drm_device *dev);
1337void intel_dp_mst_resume(struct drm_device *dev);
Ville Syrjälä50fec212015-03-12 17:10:34 +02001338int intel_dp_max_link_rate(struct intel_dp *intel_dp);
Ville Syrjäläed4e9c12015-03-12 17:10:36 +02001339int intel_dp_rate_select(struct intel_dp *intel_dp, int rate);
Dave Airlie0e32b392014-05-02 14:02:48 +10001340void intel_dp_hot_plug(struct intel_encoder *intel_encoder);
Ville Syrjälä773538e82014-09-04 14:54:56 +03001341void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv);
Rodrigo Vivi0bc12bc2014-11-14 08:52:28 -08001342uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);
Matt Roper4a3b8762014-12-23 10:41:51 -08001343void intel_plane_destroy(struct drm_plane *plane);
Vandana Kannanc3955782015-01-22 15:17:40 +05301344void intel_edp_drrs_enable(struct intel_dp *intel_dp);
1345void intel_edp_drrs_disable(struct intel_dp *intel_dp);
Vandana Kannana93fad02015-01-10 02:25:59 +05301346void intel_edp_drrs_invalidate(struct drm_device *dev,
1347 unsigned frontbuffer_bits);
1348void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits);
Sonika Jindal237ed862015-09-15 09:44:20 +05301349bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
1350 struct intel_digital_port *port);
Rodrigo Vivi0bc12bc2014-11-14 08:52:28 -08001351
Ander Conselvan de Oliveira94223d02015-10-23 13:01:48 +03001352void
1353intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
1354 uint8_t dp_train_pat);
1355void
1356intel_dp_set_signal_levels(struct intel_dp *intel_dp);
1357void intel_dp_set_idle_link_train(struct intel_dp *intel_dp);
1358uint8_t
1359intel_dp_voltage_max(struct intel_dp *intel_dp);
1360uint8_t
1361intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing);
1362void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
1363 uint8_t *link_bw, uint8_t *rate_select);
Ander Conselvan de Oliveirae588fa12015-10-23 13:01:50 +03001364bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
Ander Conselvan de Oliveira94223d02015-10-23 13:01:48 +03001365bool
1366intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]);
1367
Ander Conselvan de Oliveira419b1b72016-04-27 15:44:19 +03001368static inline unsigned int intel_dp_unused_lane_mask(int lane_count)
1369{
1370 return ~((1 << lane_count) - 1) & 0xf;
1371}
1372
Yetunde Adebisie7156c82016-04-05 15:10:52 +01001373/* intel_dp_aux_backlight.c */
1374int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector);
1375
Dave Airlie0e32b392014-05-02 14:02:48 +10001376/* intel_dp_mst.c */
1377int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
1378void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001379/* intel_dsi.c */
Damien Lespiau4328633d2014-05-28 12:30:56 +01001380void intel_dsi_init(struct drm_device *dev);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001381
Jani Nikula90198352016-04-26 16:14:25 +03001382/* intel_dsi_dcs_backlight.c */
1383int intel_dsi_dcs_init_backlight_funcs(struct intel_connector *intel_connector);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001384
1385/* intel_dvo.c */
Paulo Zanoni87440422013-09-24 15:48:31 -03001386void intel_dvo_init(struct drm_device *dev);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001387
1388
Daniel Vetter0632fef2013-10-08 17:44:49 +02001389/* legacy fbdev emulation in intel_fbdev.c */
Daniel Vetter06957262015-08-10 13:34:08 +02001390#ifdef CONFIG_DRM_FBDEV_EMULATION
Daniel Vetter4520f532013-10-09 09:18:51 +02001391extern int intel_fbdev_init(struct drm_device *dev);
Ville Syrjäläe00bf692015-11-06 15:08:33 +02001392extern void intel_fbdev_initial_config_async(struct drm_device *dev);
Daniel Vetter4520f532013-10-09 09:18:51 +02001393extern void intel_fbdev_fini(struct drm_device *dev);
Chris Wilson82e3b8c2014-08-13 13:09:46 +01001394extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
Daniel Vetter0632fef2013-10-08 17:44:49 +02001395extern void intel_fbdev_output_poll_changed(struct drm_device *dev);
1396extern void intel_fbdev_restore_mode(struct drm_device *dev);
Daniel Vetter4520f532013-10-09 09:18:51 +02001397#else
1398static inline int intel_fbdev_init(struct drm_device *dev)
1399{
1400 return 0;
1401}
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001402
Ville Syrjäläe00bf692015-11-06 15:08:33 +02001403static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
Daniel Vetter4520f532013-10-09 09:18:51 +02001404{
1405}
1406
1407static inline void intel_fbdev_fini(struct drm_device *dev)
1408{
1409}
1410
Chris Wilson82e3b8c2014-08-13 13:09:46 +01001411static inline void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous)
Daniel Vetter4520f532013-10-09 09:18:51 +02001412{
1413}
1414
Daniel Vetter0632fef2013-10-08 17:44:49 +02001415static inline void intel_fbdev_restore_mode(struct drm_device *dev)
Daniel Vetter4520f532013-10-09 09:18:51 +02001416{
1417}
1418#endif
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001419
Rodrigo Vivi7ff0ebc2014-12-08 14:09:10 -02001420/* intel_fbc.c */
Paulo Zanonif51be2e2016-01-19 11:35:50 -02001421void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
1422 struct drm_atomic_state *state);
Paulo Zanoni0e631ad2015-10-14 17:45:36 -03001423bool intel_fbc_is_active(struct drm_i915_private *dev_priv);
Paulo Zanoni1eb52232016-01-19 11:35:44 -02001424void intel_fbc_pre_update(struct intel_crtc *crtc);
1425void intel_fbc_post_update(struct intel_crtc *crtc);
Rodrigo Vivi7ff0ebc2014-12-08 14:09:10 -02001426void intel_fbc_init(struct drm_i915_private *dev_priv);
Paulo Zanoni010cf732016-01-19 11:35:48 -02001427void intel_fbc_init_pipe_state(struct drm_i915_private *dev_priv);
Paulo Zanonid029bca2015-10-15 10:44:46 -03001428void intel_fbc_enable(struct intel_crtc *crtc);
Paulo Zanonic937ab3e52016-01-19 11:35:46 -02001429void intel_fbc_disable(struct intel_crtc *crtc);
1430void intel_fbc_global_disable(struct drm_i915_private *dev_priv);
Paulo Zanonidbef0f12015-02-13 17:23:46 -02001431void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
1432 unsigned int frontbuffer_bits,
1433 enum fb_op_origin origin);
1434void intel_fbc_flush(struct drm_i915_private *dev_priv,
Paulo Zanoni6f4551f2015-07-14 16:29:10 -03001435 unsigned int frontbuffer_bits, enum fb_op_origin origin);
Paulo Zanoni7733b492015-07-07 15:26:04 -03001436void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv);
Rodrigo Vivi7ff0ebc2014-12-08 14:09:10 -02001437
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001438/* intel_hdmi.c */
Ville Syrjäläf0f59a02015-11-18 15:33:26 +02001439void intel_hdmi_init(struct drm_device *dev, i915_reg_t hdmi_reg, enum port port);
Paulo Zanoni87440422013-09-24 15:48:31 -03001440void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
1441 struct intel_connector *intel_connector);
1442struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
1443bool intel_hdmi_compute_config(struct intel_encoder *encoder,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001444 struct intel_crtc_state *pipe_config);
Ville Syrjäläb2ccb822016-05-02 22:08:24 +03001445void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001446
1447
1448/* intel_lvds.c */
Paulo Zanoni87440422013-09-24 15:48:31 -03001449void intel_lvds_init(struct drm_device *dev);
1450bool intel_is_dual_link_lvds(struct drm_device *dev);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001451
1452
1453/* intel_modes.c */
1454int intel_connector_update_modes(struct drm_connector *connector,
Paulo Zanoni87440422013-09-24 15:48:31 -03001455 struct edid *edid);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001456int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
Paulo Zanoni87440422013-09-24 15:48:31 -03001457void intel_attach_force_audio_property(struct drm_connector *connector);
1458void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
Ville Syrjälä7949dd42015-09-25 16:39:30 +03001459void intel_attach_aspect_ratio_property(struct drm_connector *connector);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001460
1461
1462/* intel_overlay.c */
Chris Wilson1ee8da62016-05-12 12:43:23 +01001463void intel_setup_overlay(struct drm_i915_private *dev_priv);
1464void intel_cleanup_overlay(struct drm_i915_private *dev_priv);
Paulo Zanoni87440422013-09-24 15:48:31 -03001465int intel_overlay_switch_off(struct intel_overlay *overlay);
Chris Wilson1ee8da62016-05-12 12:43:23 +01001466int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
1467 struct drm_file *file_priv);
1468int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,
1469 struct drm_file *file_priv);
Ville Syrjälä1362b772014-11-26 17:07:29 +02001470void intel_overlay_reset(struct drm_i915_private *dev_priv);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001471
1472
1473/* intel_panel.c */
Paulo Zanoni87440422013-09-24 15:48:31 -03001474int intel_panel_init(struct intel_panel *panel,
Vandana Kannan4b6ed682014-02-11 14:26:36 +05301475 struct drm_display_mode *fixed_mode,
1476 struct drm_display_mode *downclock_mode);
Paulo Zanoni87440422013-09-24 15:48:31 -03001477void intel_panel_fini(struct intel_panel *panel);
1478void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
1479 struct drm_display_mode *adjusted_mode);
1480void intel_pch_panel_fitting(struct intel_crtc *crtc,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001481 struct intel_crtc_state *pipe_config,
Paulo Zanoni87440422013-09-24 15:48:31 -03001482 int fitting_mode);
1483void intel_gmch_panel_fitting(struct intel_crtc *crtc,
Ander Conselvan de Oliveira5cec2582015-01-15 14:55:21 +02001484 struct intel_crtc_state *pipe_config,
Paulo Zanoni87440422013-09-24 15:48:31 -03001485 int fitting_mode);
Jani Nikula6dda7302014-06-24 18:27:40 +03001486void intel_panel_set_backlight_acpi(struct intel_connector *connector,
1487 u32 level, u32 max);
Ville Syrjälä6517d272014-11-07 11:16:02 +02001488int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe);
Jesse Barnes752aa882013-10-31 18:55:49 +02001489void intel_panel_enable_backlight(struct intel_connector *connector);
1490void intel_panel_disable_backlight(struct intel_connector *connector);
Jani Nikuladb31af1d2013-11-08 16:48:53 +02001491void intel_panel_destroy_backlight(struct drm_connector *connector);
Paulo Zanoni87440422013-09-24 15:48:31 -03001492enum drm_connector_status intel_panel_detect(struct drm_device *dev);
Vandana Kannanec9ed192013-12-10 13:37:36 +05301493extern struct drm_display_mode *intel_find_panel_downclock(
1494 struct drm_device *dev,
1495 struct drm_display_mode *fixed_mode,
1496 struct drm_connector *connector);
Ville Syrjälä0962c3c2014-11-07 15:19:46 +02001497void intel_backlight_register(struct drm_device *dev);
1498void intel_backlight_unregister(struct drm_device *dev);
1499
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001500
Rodrigo Vivi0bc12bc2014-11-14 08:52:28 -08001501/* intel_psr.c */
Rodrigo Vivi0bc12bc2014-11-14 08:52:28 -08001502void intel_psr_enable(struct intel_dp *intel_dp);
1503void intel_psr_disable(struct intel_dp *intel_dp);
1504void intel_psr_invalidate(struct drm_device *dev,
Daniel Vetter20c88382015-06-18 10:30:27 +02001505 unsigned frontbuffer_bits);
Rodrigo Vivi0bc12bc2014-11-14 08:52:28 -08001506void intel_psr_flush(struct drm_device *dev,
Rodrigo Vivi169de132015-07-08 16:21:31 -07001507 unsigned frontbuffer_bits,
1508 enum fb_op_origin origin);
Rodrigo Vivi0bc12bc2014-11-14 08:52:28 -08001509void intel_psr_init(struct drm_device *dev);
Daniel Vetter20c88382015-06-18 10:30:27 +02001510void intel_psr_single_frame_update(struct drm_device *dev,
1511 unsigned frontbuffer_bits);
Rodrigo Vivi0bc12bc2014-11-14 08:52:28 -08001512
Daniel Vetter9c065a72014-09-30 10:56:38 +02001513/* intel_runtime_pm.c */
1514int intel_power_domains_init(struct drm_i915_private *);
Daniel Vetterf458ebb2014-09-30 10:56:39 +02001515void intel_power_domains_fini(struct drm_i915_private *);
Imre Deak73dfc222015-11-17 17:33:53 +02001516void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume);
1517void intel_power_domains_suspend(struct drm_i915_private *dev_priv);
Imre Deakd7d7c9e2016-04-01 16:02:42 +03001518void bxt_display_core_init(struct drm_i915_private *dev_priv, bool resume);
1519void bxt_display_core_uninit(struct drm_i915_private *dev_priv);
Daniel Vetterf458ebb2014-09-30 10:56:39 +02001520void intel_runtime_pm_enable(struct drm_i915_private *dev_priv);
Daniel Stone9895ad02015-11-20 15:55:33 +00001521const char *
1522intel_display_power_domain_str(enum intel_display_power_domain domain);
Daniel Vetter9c065a72014-09-30 10:56:38 +02001523
Daniel Vetterf458ebb2014-09-30 10:56:39 +02001524bool intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
1525 enum intel_display_power_domain domain);
1526bool __intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
1527 enum intel_display_power_domain domain);
Daniel Vetter9c065a72014-09-30 10:56:38 +02001528void intel_display_power_get(struct drm_i915_private *dev_priv,
1529 enum intel_display_power_domain domain);
Imre Deak09731282016-02-17 14:17:42 +02001530bool intel_display_power_get_if_enabled(struct drm_i915_private *dev_priv,
1531 enum intel_display_power_domain domain);
Daniel Vetter9c065a72014-09-30 10:56:38 +02001532void intel_display_power_put(struct drm_i915_private *dev_priv,
1533 enum intel_display_power_domain domain);
Imre Deakda5827c2015-12-15 20:10:33 +02001534
1535static inline void
1536assert_rpm_device_not_suspended(struct drm_i915_private *dev_priv)
1537{
1538 WARN_ONCE(dev_priv->pm.suspended,
1539 "Device suspended during HW access\n");
1540}
1541
1542static inline void
1543assert_rpm_wakelock_held(struct drm_i915_private *dev_priv)
1544{
1545 assert_rpm_device_not_suspended(dev_priv);
Daniel Vetterbecd9ca2016-01-05 17:54:07 +01001546 /* FIXME: Needs to be converted back to WARN_ONCE, but currently causes
1547 * too much noise. */
1548 if (!atomic_read(&dev_priv->pm.wakeref_count))
1549 DRM_DEBUG_DRIVER("RPM wakelock ref not held during HW access");
Imre Deakda5827c2015-12-15 20:10:33 +02001550}
1551
Imre Deak2b19efe2015-12-15 20:10:37 +02001552static inline int
1553assert_rpm_atomic_begin(struct drm_i915_private *dev_priv)
1554{
1555 int seq = atomic_read(&dev_priv->pm.atomic_seq);
1556
1557 assert_rpm_wakelock_held(dev_priv);
1558
1559 return seq;
1560}
1561
1562static inline void
1563assert_rpm_atomic_end(struct drm_i915_private *dev_priv, int begin_seq)
1564{
1565 WARN_ONCE(atomic_read(&dev_priv->pm.atomic_seq) != begin_seq,
1566 "HW access outside of RPM atomic section\n");
1567}
1568
Imre Deak1f814da2015-12-16 02:52:19 +02001569/**
1570 * disable_rpm_wakeref_asserts - disable the RPM assert checks
1571 * @dev_priv: i915 device instance
1572 *
1573 * This function disable asserts that check if we hold an RPM wakelock
1574 * reference, while keeping the device-not-suspended checks still enabled.
1575 * It's meant to be used only in special circumstances where our rule about
1576 * the wakelock refcount wrt. the device power state doesn't hold. According
1577 * to this rule at any point where we access the HW or want to keep the HW in
1578 * an active state we must hold an RPM wakelock reference acquired via one of
1579 * the intel_runtime_pm_get() helpers. Currently there are a few special spots
1580 * where this rule doesn't hold: the IRQ and suspend/resume handlers, the
1581 * forcewake release timer, and the GPU RPS and hangcheck works. All other
1582 * users should avoid using this function.
1583 *
1584 * Any calls to this function must have a symmetric call to
1585 * enable_rpm_wakeref_asserts().
1586 */
1587static inline void
1588disable_rpm_wakeref_asserts(struct drm_i915_private *dev_priv)
1589{
1590 atomic_inc(&dev_priv->pm.wakeref_count);
1591}
1592
1593/**
1594 * enable_rpm_wakeref_asserts - re-enable the RPM assert checks
1595 * @dev_priv: i915 device instance
1596 *
1597 * This function re-enables the RPM assert checks after disabling them with
1598 * disable_rpm_wakeref_asserts. It's meant to be used only in special
1599 * circumstances otherwise its use should be avoided.
1600 *
1601 * Any calls to this function must have a symmetric call to
1602 * disable_rpm_wakeref_asserts().
1603 */
1604static inline void
1605enable_rpm_wakeref_asserts(struct drm_i915_private *dev_priv)
1606{
1607 atomic_dec(&dev_priv->pm.wakeref_count);
1608}
1609
1610/* TODO: convert users of these to rely instead on proper RPM refcounting */
1611#define DISABLE_RPM_WAKEREF_ASSERTS(dev_priv) \
1612 disable_rpm_wakeref_asserts(dev_priv)
1613
1614#define ENABLE_RPM_WAKEREF_ASSERTS(dev_priv) \
1615 enable_rpm_wakeref_asserts(dev_priv)
1616
Daniel Vetter9c065a72014-09-30 10:56:38 +02001617void intel_runtime_pm_get(struct drm_i915_private *dev_priv);
Imre Deak09731282016-02-17 14:17:42 +02001618bool intel_runtime_pm_get_if_in_use(struct drm_i915_private *dev_priv);
Daniel Vetter9c065a72014-09-30 10:56:38 +02001619void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv);
1620void intel_runtime_pm_put(struct drm_i915_private *dev_priv);
1621
Daniel Vetterd9bc89d92014-09-30 10:56:40 +02001622void intel_display_set_init_power(struct drm_i915_private *dev, bool enable);
1623
Ville Syrjäläe0fce782015-07-08 23:45:54 +03001624void chv_phy_powergate_lanes(struct intel_encoder *encoder,
1625 bool override, unsigned int mask);
Ville Syrjäläb0b33842015-07-08 23:45:55 +03001626bool chv_phy_powergate_ch(struct drm_i915_private *dev_priv, enum dpio_phy phy,
1627 enum dpio_channel ch, bool override);
Ville Syrjäläe0fce782015-07-08 23:45:54 +03001628
1629
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001630/* intel_pm.c */
Paulo Zanoni87440422013-09-24 15:48:31 -03001631void intel_init_clock_gating(struct drm_device *dev);
1632void intel_suspend_hw(struct drm_device *dev);
Damien Lespiau546c81f2014-05-13 15:30:26 +01001633int ilk_wm_max_level(const struct drm_device *dev);
Paulo Zanoni87440422013-09-24 15:48:31 -03001634void intel_update_watermarks(struct drm_crtc *crtc);
Paulo Zanoni87440422013-09-24 15:48:31 -03001635void intel_init_pm(struct drm_device *dev);
Imre Deakbb400da2016-03-16 13:38:54 +02001636void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv);
Daniel Vetterf742a552013-12-06 10:17:53 +01001637void intel_pm_setup(struct drm_device *dev);
Paulo Zanoni87440422013-09-24 15:48:31 -03001638void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
1639void intel_gpu_ips_teardown(void);
Chris Wilsondc979972016-05-10 14:10:04 +01001640void intel_init_gt_powersave(struct drm_i915_private *dev_priv);
1641void intel_cleanup_gt_powersave(struct drm_i915_private *dev_priv);
1642void intel_enable_gt_powersave(struct drm_i915_private *dev_priv);
1643void intel_disable_gt_powersave(struct drm_i915_private *dev_priv);
1644void intel_suspend_gt_powersave(struct drm_i915_private *dev_priv);
1645void intel_reset_gt_powersave(struct drm_i915_private *dev_priv);
1646void gen6_update_ring_freq(struct drm_i915_private *dev_priv);
Chris Wilson43cf3bf2015-03-18 09:48:22 +00001647void gen6_rps_busy(struct drm_i915_private *dev_priv);
1648void gen6_rps_reset_ei(struct drm_i915_private *dev_priv);
Daniel Vetter076e29f2013-10-08 19:39:29 +02001649void gen6_rps_idle(struct drm_i915_private *dev_priv);
Chris Wilson1854d5c2015-04-07 16:20:32 +01001650void gen6_rps_boost(struct drm_i915_private *dev_priv,
Chris Wilsone61b9952015-04-27 13:41:24 +01001651 struct intel_rps_client *rps,
1652 unsigned long submitted);
Tvrtko Ursulin91d14252016-05-06 14:48:28 +01001653void intel_queue_rps_boost_for_request(struct drm_i915_gem_request *req);
Ville Syrjälä6eb1a682015-06-24 22:00:03 +03001654void vlv_wm_get_hw_state(struct drm_device *dev);
Ville Syrjälä243e6a42013-10-14 14:55:24 +03001655void ilk_wm_get_hw_state(struct drm_device *dev);
Pradeep Bhat30789992014-11-04 17:06:45 +00001656void skl_wm_get_hw_state(struct drm_device *dev);
Damien Lespiau08db6652014-11-04 17:06:52 +00001657void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv,
1658 struct skl_ddb_allocation *ddb /* out */);
Ville Syrjälä8cfb3402015-06-03 15:45:11 +03001659uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config);
Matt Ropered4a6a72016-02-23 17:20:13 -08001660bool ilk_disable_lp_wm(struct drm_device *dev);
Chris Wilsondc979972016-05-10 14:10:04 +01001661int sanitize_rc6_option(struct drm_i915_private *dev_priv, int enable_rc6);
1662static inline int intel_enable_rc6(void)
1663{
1664 return i915.enable_rc6;
1665}
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001666
1667/* intel_sdvo.c */
Ville Syrjäläf0f59a02015-11-18 15:33:26 +02001668bool intel_sdvo_init(struct drm_device *dev,
1669 i915_reg_t reg, enum port port);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001670
1671
1672/* intel_sprite.c */
Paulo Zanoni87440422013-09-24 15:48:31 -03001673int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane);
Paulo Zanoni87440422013-09-24 15:48:31 -03001674int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
1675 struct drm_file *file_priv);
Maarten Lankhorst34e0adb2015-08-31 13:04:25 +02001676void intel_pipe_update_start(struct intel_crtc *crtc);
1677void intel_pipe_update_end(struct intel_crtc *crtc);
Paulo Zanoni5f1aae62013-09-24 13:52:53 -03001678
1679/* intel_tv.c */
Paulo Zanoni87440422013-09-24 15:48:31 -03001680void intel_tv_init(struct drm_device *dev);
Ville Syrjälä20ddf662013-09-04 18:25:25 +03001681
Matt Roperea2c67b2014-12-23 10:41:52 -08001682/* intel_atomic.c */
Matt Roper2545e4a2015-01-22 16:51:27 -08001683int intel_connector_atomic_get_property(struct drm_connector *connector,
1684 const struct drm_connector_state *state,
1685 struct drm_property *property,
1686 uint64_t *val);
Matt Roper13568372015-01-21 16:35:47 -08001687struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
1688void intel_crtc_destroy_state(struct drm_crtc *crtc,
1689 struct drm_crtc_state *state);
Maarten Lankhorstde419ab2015-06-04 10:21:28 +02001690struct drm_atomic_state *intel_atomic_state_alloc(struct drm_device *dev);
1691void intel_atomic_state_clear(struct drm_atomic_state *);
1692struct intel_shared_dpll_config *
1693intel_atomic_get_shared_dpll_state(struct drm_atomic_state *s);
1694
Ander Conselvan de Oliveira10f81c12015-03-20 16:18:01 +02001695static inline struct intel_crtc_state *
1696intel_atomic_get_crtc_state(struct drm_atomic_state *state,
1697 struct intel_crtc *crtc)
1698{
1699 struct drm_crtc_state *crtc_state;
1700 crtc_state = drm_atomic_get_crtc_state(state, &crtc->base);
1701 if (IS_ERR(crtc_state))
Fabian Frederick0b6cc182015-04-25 11:34:29 +02001702 return ERR_CAST(crtc_state);
Ander Conselvan de Oliveira10f81c12015-03-20 16:18:01 +02001703
1704 return to_intel_crtc_state(crtc_state);
1705}
Maarten Lankhorste3bddde2016-03-01 11:07:22 +01001706
1707static inline struct intel_plane_state *
1708intel_atomic_get_existing_plane_state(struct drm_atomic_state *state,
1709 struct intel_plane *plane)
1710{
1711 struct drm_plane_state *plane_state;
1712
1713 plane_state = drm_atomic_get_existing_plane_state(state, &plane->base);
1714
1715 return to_intel_plane_state(plane_state);
1716}
1717
Chandra Kondurud03c93d2015-04-09 16:42:46 -07001718int intel_atomic_setup_scalers(struct drm_device *dev,
1719 struct intel_crtc *intel_crtc,
1720 struct intel_crtc_state *crtc_state);
Matt Roper5ee67f12015-01-21 16:35:44 -08001721
1722/* intel_atomic_plane.c */
Matt Roper8e7d6882015-01-21 16:35:41 -08001723struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
Matt Roperea2c67b2014-12-23 10:41:52 -08001724struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
1725void intel_plane_destroy_state(struct drm_plane *plane,
1726 struct drm_plane_state *state);
1727extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
1728
Lionel Landwerlin8563b1e2016-03-16 10:57:14 +00001729/* intel_color.c */
1730void intel_color_init(struct drm_crtc *crtc);
Lionel Landwerlin82cf4352016-03-16 10:57:16 +00001731int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
Maarten Lankhorstb95c5322016-03-30 17:16:34 +02001732void intel_color_set_csc(struct drm_crtc_state *crtc_state);
1733void intel_color_load_luts(struct drm_crtc_state *crtc_state);
Lionel Landwerlin8563b1e2016-03-16 10:57:14 +00001734
Jesse Barnes79e53942008-11-07 14:24:08 -08001735#endif /* __INTEL_DRV_H__ */