intel_drv.h 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620
  1. /*
  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. #include <linux/async.h>
  28. #include <linux/i2c.h>
  29. #include <linux/hdmi.h>
  30. #include <drm/i915_drm.h>
  31. #include "i915_drv.h"
  32. #include <drm/drm_crtc.h>
  33. #include <drm/drm_crtc_helper.h>
  34. #include <drm/drm_fb_helper.h>
  35. #include <drm/drm_dp_mst_helper.h>
  36. #include <drm/drm_rect.h>
  37. #include <drm/drm_atomic.h>
  38. /**
  39. * _wait_for - magic (register) wait macro
  40. *
  41. * Does the right thing for modeset paths when run under kdgb or similar atomic
  42. * contexts. Note that it's important that we check the condition again after
  43. * having timed out, since the timeout could be due to preemption or similar and
  44. * we've never had a chance to check the condition before the timeout.
  45. */
  46. #define _wait_for(COND, MS, W) ({ \
  47. unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \
  48. int ret__ = 0; \
  49. while (!(COND)) { \
  50. if (time_after(jiffies, timeout__)) { \
  51. if (!(COND)) \
  52. ret__ = -ETIMEDOUT; \
  53. break; \
  54. } \
  55. if ((W) && drm_can_sleep()) { \
  56. usleep_range((W)*1000, (W)*2000); \
  57. } else { \
  58. cpu_relax(); \
  59. } \
  60. } \
  61. ret__; \
  62. })
  63. #define wait_for(COND, MS) _wait_for(COND, MS, 1)
  64. #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0)
  65. #define wait_for_atomic_us(COND, US) _wait_for((COND), \
  66. DIV_ROUND_UP((US), 1000), 0)
  67. #define KHz(x) (1000 * (x))
  68. #define MHz(x) KHz(1000 * (x))
  69. /*
  70. * Display related stuff
  71. */
  72. /* store information about an Ixxx DVO */
  73. /* The i830->i865 use multiple DVOs with multiple i2cs */
  74. /* the i915, i945 have a single sDVO i2c bus - which is different */
  75. #define MAX_OUTPUTS 6
  76. /* maximum connectors per crtcs in the mode set */
  77. /* Maximum cursor sizes */
  78. #define GEN2_CURSOR_WIDTH 64
  79. #define GEN2_CURSOR_HEIGHT 64
  80. #define MAX_CURSOR_WIDTH 256
  81. #define MAX_CURSOR_HEIGHT 256
  82. #define INTEL_I2C_BUS_DVO 1
  83. #define INTEL_I2C_BUS_SDVO 2
  84. /* these are outputs from the chip - integrated only
  85. external chips are via DVO or SDVO output */
  86. enum intel_output_type {
  87. INTEL_OUTPUT_UNUSED = 0,
  88. INTEL_OUTPUT_ANALOG = 1,
  89. INTEL_OUTPUT_DVO = 2,
  90. INTEL_OUTPUT_SDVO = 3,
  91. INTEL_OUTPUT_LVDS = 4,
  92. INTEL_OUTPUT_TVOUT = 5,
  93. INTEL_OUTPUT_HDMI = 6,
  94. INTEL_OUTPUT_DISPLAYPORT = 7,
  95. INTEL_OUTPUT_EDP = 8,
  96. INTEL_OUTPUT_DSI = 9,
  97. INTEL_OUTPUT_UNKNOWN = 10,
  98. INTEL_OUTPUT_DP_MST = 11,
  99. };
  100. #define INTEL_DVO_CHIP_NONE 0
  101. #define INTEL_DVO_CHIP_LVDS 1
  102. #define INTEL_DVO_CHIP_TMDS 2
  103. #define INTEL_DVO_CHIP_TVOUT 4
  104. #define INTEL_DSI_VIDEO_MODE 0
  105. #define INTEL_DSI_COMMAND_MODE 1
  106. struct intel_framebuffer {
  107. struct drm_framebuffer base;
  108. struct drm_i915_gem_object *obj;
  109. };
  110. struct intel_fbdev {
  111. struct drm_fb_helper helper;
  112. struct intel_framebuffer *fb;
  113. int preferred_bpp;
  114. };
  115. struct intel_encoder {
  116. struct drm_encoder base;
  117. enum intel_output_type type;
  118. unsigned int cloneable;
  119. void (*hot_plug)(struct intel_encoder *);
  120. bool (*compute_config)(struct intel_encoder *,
  121. struct intel_crtc_state *);
  122. void (*pre_pll_enable)(struct intel_encoder *);
  123. void (*pre_enable)(struct intel_encoder *);
  124. void (*enable)(struct intel_encoder *);
  125. void (*mode_set)(struct intel_encoder *intel_encoder);
  126. void (*disable)(struct intel_encoder *);
  127. void (*post_disable)(struct intel_encoder *);
  128. void (*post_pll_disable)(struct intel_encoder *);
  129. /* Read out the current hw state of this connector, returning true if
  130. * the encoder is active. If the encoder is enabled it also set the pipe
  131. * it is connected to in the pipe parameter. */
  132. bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe);
  133. /* Reconstructs the equivalent mode flags for the current hardware
  134. * state. This must be called _after_ display->get_pipe_config has
  135. * pre-filled the pipe config. Note that intel_encoder->base.crtc must
  136. * be set correctly before calling this function. */
  137. void (*get_config)(struct intel_encoder *,
  138. struct intel_crtc_state *pipe_config);
  139. /*
  140. * Called during system suspend after all pending requests for the
  141. * encoder are flushed (for example for DP AUX transactions) and
  142. * device interrupts are disabled.
  143. */
  144. void (*suspend)(struct intel_encoder *);
  145. int crtc_mask;
  146. enum hpd_pin hpd_pin;
  147. };
  148. struct intel_panel {
  149. struct drm_display_mode *fixed_mode;
  150. struct drm_display_mode *downclock_mode;
  151. int fitting_mode;
  152. /* backlight */
  153. struct {
  154. bool present;
  155. u32 level;
  156. u32 min;
  157. u32 max;
  158. bool enabled;
  159. bool combination_mode; /* gen 2/4 only */
  160. bool active_low_pwm;
  161. /* PWM chip */
  162. bool util_pin_active_low; /* bxt+ */
  163. u8 controller; /* bxt+ only */
  164. struct pwm_device *pwm;
  165. struct backlight_device *device;
  166. /* Connector and platform specific backlight functions */
  167. int (*setup)(struct intel_connector *connector, enum pipe pipe);
  168. uint32_t (*get)(struct intel_connector *connector);
  169. void (*set)(struct intel_connector *connector, uint32_t level);
  170. void (*disable)(struct intel_connector *connector);
  171. void (*enable)(struct intel_connector *connector);
  172. uint32_t (*hz_to_pwm)(struct intel_connector *connector,
  173. uint32_t hz);
  174. void (*power)(struct intel_connector *, bool enable);
  175. } backlight;
  176. };
  177. struct intel_connector {
  178. struct drm_connector base;
  179. /*
  180. * The fixed encoder this connector is connected to.
  181. */
  182. struct intel_encoder *encoder;
  183. /* Reads out the current hw, returning true if the connector is enabled
  184. * and active (i.e. dpms ON state). */
  185. bool (*get_hw_state)(struct intel_connector *);
  186. /*
  187. * Removes all interfaces through which the connector is accessible
  188. * - like sysfs, debugfs entries -, so that no new operations can be
  189. * started on the connector. Also makes sure all currently pending
  190. * operations finish before returing.
  191. */
  192. void (*unregister)(struct intel_connector *);
  193. /* Panel info for eDP and LVDS */
  194. struct intel_panel panel;
  195. /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
  196. struct edid *edid;
  197. struct edid *detect_edid;
  198. /* since POLL and HPD connectors may use the same HPD line keep the native
  199. state of connector->polled in case hotplug storm detection changes it */
  200. u8 polled;
  201. void *port; /* store this opaque as its illegal to dereference it */
  202. struct intel_dp *mst_port;
  203. };
  204. typedef struct dpll {
  205. /* given values */
  206. int n;
  207. int m1, m2;
  208. int p1, p2;
  209. /* derived values */
  210. int dot;
  211. int vco;
  212. int m;
  213. int p;
  214. } intel_clock_t;
  215. struct intel_atomic_state {
  216. struct drm_atomic_state base;
  217. unsigned int cdclk;
  218. /*
  219. * Calculated device cdclk, can be different from cdclk
  220. * only when all crtc's are DPMS off.
  221. */
  222. unsigned int dev_cdclk;
  223. bool dpll_set, modeset;
  224. unsigned int active_crtcs;
  225. unsigned int min_pixclk[I915_MAX_PIPES];
  226. struct intel_shared_dpll_config shared_dpll[I915_NUM_PLLS];
  227. struct intel_wm_config wm_config;
  228. };
  229. struct intel_plane_state {
  230. struct drm_plane_state base;
  231. struct drm_rect src;
  232. struct drm_rect dst;
  233. struct drm_rect clip;
  234. bool visible;
  235. /*
  236. * scaler_id
  237. * = -1 : not using a scaler
  238. * >= 0 : using a scalers
  239. *
  240. * plane requiring a scaler:
  241. * - During check_plane, its bit is set in
  242. * crtc_state->scaler_state.scaler_users by calling helper function
  243. * update_scaler_plane.
  244. * - scaler_id indicates the scaler it got assigned.
  245. *
  246. * plane doesn't require a scaler:
  247. * - this can happen when scaling is no more required or plane simply
  248. * got disabled.
  249. * - During check_plane, corresponding bit is reset in
  250. * crtc_state->scaler_state.scaler_users by calling helper function
  251. * update_scaler_plane.
  252. */
  253. int scaler_id;
  254. struct drm_intel_sprite_colorkey ckey;
  255. /* async flip related structures */
  256. struct drm_i915_gem_request *wait_req;
  257. };
  258. struct intel_initial_plane_config {
  259. struct intel_framebuffer *fb;
  260. unsigned int tiling;
  261. int size;
  262. u32 base;
  263. };
  264. #define SKL_MIN_SRC_W 8
  265. #define SKL_MAX_SRC_W 4096
  266. #define SKL_MIN_SRC_H 8
  267. #define SKL_MAX_SRC_H 4096
  268. #define SKL_MIN_DST_W 8
  269. #define SKL_MAX_DST_W 4096
  270. #define SKL_MIN_DST_H 8
  271. #define SKL_MAX_DST_H 4096
  272. struct intel_scaler {
  273. int in_use;
  274. uint32_t mode;
  275. };
  276. struct intel_crtc_scaler_state {
  277. #define SKL_NUM_SCALERS 2
  278. struct intel_scaler scalers[SKL_NUM_SCALERS];
  279. /*
  280. * scaler_users: keeps track of users requesting scalers on this crtc.
  281. *
  282. * If a bit is set, a user is using a scaler.
  283. * Here user can be a plane or crtc as defined below:
  284. * bits 0-30 - plane (bit position is index from drm_plane_index)
  285. * bit 31 - crtc
  286. *
  287. * Instead of creating a new index to cover planes and crtc, using
  288. * existing drm_plane_index for planes which is well less than 31
  289. * planes and bit 31 for crtc. This should be fine to cover all
  290. * our platforms.
  291. *
  292. * intel_atomic_setup_scalers will setup available scalers to users
  293. * requesting scalers. It will gracefully fail if request exceeds
  294. * avilability.
  295. */
  296. #define SKL_CRTC_INDEX 31
  297. unsigned scaler_users;
  298. /* scaler used by crtc for panel fitting purpose */
  299. int scaler_id;
  300. };
  301. /* drm_mode->private_flags */
  302. #define I915_MODE_FLAG_INHERITED 1
  303. struct intel_pipe_wm {
  304. struct intel_wm_level wm[5];
  305. uint32_t linetime;
  306. bool fbc_wm_enabled;
  307. bool pipe_enabled;
  308. bool sprites_enabled;
  309. bool sprites_scaled;
  310. };
  311. struct skl_pipe_wm {
  312. struct skl_wm_level wm[8];
  313. struct skl_wm_level trans_wm;
  314. uint32_t linetime;
  315. };
  316. struct intel_crtc_state {
  317. struct drm_crtc_state base;
  318. /**
  319. * quirks - bitfield with hw state readout quirks
  320. *
  321. * For various reasons the hw state readout code might not be able to
  322. * completely faithfully read out the current state. These cases are
  323. * tracked with quirk flags so that fastboot and state checker can act
  324. * accordingly.
  325. */
  326. #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
  327. unsigned long quirks;
  328. bool update_pipe; /* can a fast modeset be performed? */
  329. bool disable_cxsr;
  330. bool wm_changed; /* watermarks are updated */
  331. bool fb_changed; /* fb on any of the planes is changed */
  332. /* Pipe source size (ie. panel fitter input size)
  333. * All planes will be positioned inside this space,
  334. * and get clipped at the edges. */
  335. int pipe_src_w, pipe_src_h;
  336. /* Whether to set up the PCH/FDI. Note that we never allow sharing
  337. * between pch encoders and cpu encoders. */
  338. bool has_pch_encoder;
  339. /* Are we sending infoframes on the attached port */
  340. bool has_infoframe;
  341. /* CPU Transcoder for the pipe. Currently this can only differ from the
  342. * pipe on Haswell (where we have a special eDP transcoder). */
  343. enum transcoder cpu_transcoder;
  344. /*
  345. * Use reduced/limited/broadcast rbg range, compressing from the full
  346. * range fed into the crtcs.
  347. */
  348. bool limited_color_range;
  349. /* DP has a bunch of special case unfortunately, so mark the pipe
  350. * accordingly. */
  351. bool has_dp_encoder;
  352. /* DSI has special cases */
  353. bool has_dsi_encoder;
  354. /* Whether we should send NULL infoframes. Required for audio. */
  355. bool has_hdmi_sink;
  356. /* Audio enabled on this pipe. Only valid if either has_hdmi_sink or
  357. * has_dp_encoder is set. */
  358. bool has_audio;
  359. /*
  360. * Enable dithering, used when the selected pipe bpp doesn't match the
  361. * plane bpp.
  362. */
  363. bool dither;
  364. /* Controls for the clock computation, to override various stages. */
  365. bool clock_set;
  366. /* SDVO TV has a bunch of special case. To make multifunction encoders
  367. * work correctly, we need to track this at runtime.*/
  368. bool sdvo_tv_clock;
  369. /*
  370. * crtc bandwidth limit, don't increase pipe bpp or clock if not really
  371. * required. This is set in the 2nd loop of calling encoder's
  372. * ->compute_config if the first pick doesn't work out.
  373. */
  374. bool bw_constrained;
  375. /* Settings for the intel dpll used on pretty much everything but
  376. * haswell. */
  377. struct dpll dpll;
  378. /* Selected dpll when shared or DPLL_ID_PRIVATE. */
  379. enum intel_dpll_id shared_dpll;
  380. /*
  381. * - PORT_CLK_SEL for DDI ports on HSW/BDW.
  382. * - enum skl_dpll on SKL
  383. */
  384. uint32_t ddi_pll_sel;
  385. /* Actual register state of the dpll, for shared dpll cross-checking. */
  386. struct intel_dpll_hw_state dpll_hw_state;
  387. int pipe_bpp;
  388. struct intel_link_m_n dp_m_n;
  389. /* m2_n2 for eDP downclock */
  390. struct intel_link_m_n dp_m2_n2;
  391. bool has_drrs;
  392. /*
  393. * Frequence the dpll for the port should run at. Differs from the
  394. * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also
  395. * already multiplied by pixel_multiplier.
  396. */
  397. int port_clock;
  398. /* Used by SDVO (and if we ever fix it, HDMI). */
  399. unsigned pixel_multiplier;
  400. uint8_t lane_count;
  401. /* Panel fitter controls for gen2-gen4 + VLV */
  402. struct {
  403. u32 control;
  404. u32 pgm_ratios;
  405. u32 lvds_border_bits;
  406. } gmch_pfit;
  407. /* Panel fitter placement and size for Ironlake+ */
  408. struct {
  409. u32 pos;
  410. u32 size;
  411. bool enabled;
  412. bool force_thru;
  413. } pch_pfit;
  414. /* FDI configuration, only valid if has_pch_encoder is set. */
  415. int fdi_lanes;
  416. struct intel_link_m_n fdi_m_n;
  417. bool ips_enabled;
  418. bool enable_fbc;
  419. bool double_wide;
  420. bool dp_encoder_is_mst;
  421. int pbn;
  422. struct intel_crtc_scaler_state scaler_state;
  423. /* w/a for waiting 2 vblanks during crtc enable */
  424. enum pipe hsw_workaround_pipe;
  425. /* IVB sprite scaling w/a (WaCxSRDisabledForSpriteScaling:ivb) */
  426. bool disable_lp_wm;
  427. struct {
  428. /*
  429. * optimal watermarks, programmed post-vblank when this state
  430. * is committed
  431. */
  432. union {
  433. struct intel_pipe_wm ilk;
  434. struct skl_pipe_wm skl;
  435. } optimal;
  436. } wm;
  437. };
  438. struct vlv_wm_state {
  439. struct vlv_pipe_wm wm[3];
  440. struct vlv_sr_wm sr[3];
  441. uint8_t num_active_planes;
  442. uint8_t num_levels;
  443. uint8_t level;
  444. bool cxsr;
  445. };
  446. struct intel_mmio_flip {
  447. struct work_struct work;
  448. struct drm_i915_private *i915;
  449. struct drm_i915_gem_request *req;
  450. struct intel_crtc *crtc;
  451. unsigned int rotation;
  452. };
  453. /*
  454. * Tracking of operations that need to be performed at the beginning/end of an
  455. * atomic commit, outside the atomic section where interrupts are disabled.
  456. * These are generally operations that grab mutexes or might otherwise sleep
  457. * and thus can't be run with interrupts disabled.
  458. */
  459. struct intel_crtc_atomic_commit {
  460. /* Sleepable operations to perform before commit */
  461. /* Sleepable operations to perform after commit */
  462. unsigned fb_bits;
  463. bool post_enable_primary;
  464. /* Sleepable operations to perform before and after commit */
  465. bool update_fbc;
  466. };
  467. struct intel_crtc {
  468. struct drm_crtc base;
  469. enum pipe pipe;
  470. enum plane plane;
  471. u8 lut_r[256], lut_g[256], lut_b[256];
  472. /*
  473. * Whether the crtc and the connected output pipeline is active. Implies
  474. * that crtc->enabled is set, i.e. the current mode configuration has
  475. * some outputs connected to this crtc.
  476. */
  477. bool active;
  478. unsigned long enabled_power_domains;
  479. bool lowfreq_avail;
  480. struct intel_overlay *overlay;
  481. struct intel_unpin_work *unpin_work;
  482. atomic_t unpin_work_count;
  483. /* Display surface base address adjustement for pageflips. Note that on
  484. * gen4+ this only adjusts up to a tile, offsets within a tile are
  485. * handled in the hw itself (with the TILEOFF register). */
  486. u32 dspaddr_offset;
  487. int adjusted_x;
  488. int adjusted_y;
  489. uint32_t cursor_addr;
  490. uint32_t cursor_cntl;
  491. uint32_t cursor_size;
  492. uint32_t cursor_base;
  493. struct intel_crtc_state *config;
  494. /* reset counter value when the last flip was submitted */
  495. unsigned int reset_counter;
  496. /* Access to these should be protected by dev_priv->irq_lock. */
  497. bool cpu_fifo_underrun_disabled;
  498. bool pch_fifo_underrun_disabled;
  499. /* per-pipe watermark state */
  500. struct {
  501. /* watermarks currently being used */
  502. union {
  503. struct intel_pipe_wm ilk;
  504. struct skl_pipe_wm skl;
  505. } active;
  506. /* allow CxSR on this pipe */
  507. bool cxsr_allowed;
  508. } wm;
  509. int scanline_offset;
  510. struct {
  511. unsigned start_vbl_count;
  512. ktime_t start_vbl_time;
  513. int min_vbl, max_vbl;
  514. int scanline_start;
  515. } debug;
  516. struct intel_crtc_atomic_commit atomic;
  517. /* scalers available on this crtc */
  518. int num_scalers;
  519. struct vlv_wm_state wm_state;
  520. };
  521. struct intel_plane_wm_parameters {
  522. uint32_t horiz_pixels;
  523. uint32_t vert_pixels;
  524. /*
  525. * For packed pixel formats:
  526. * bytes_per_pixel - holds bytes per pixel
  527. * For planar pixel formats:
  528. * bytes_per_pixel - holds bytes per pixel for uv-plane
  529. * y_bytes_per_pixel - holds bytes per pixel for y-plane
  530. */
  531. uint8_t bytes_per_pixel;
  532. uint8_t y_bytes_per_pixel;
  533. bool enabled;
  534. bool scaled;
  535. u64 tiling;
  536. unsigned int rotation;
  537. uint16_t fifo_size;
  538. };
  539. struct intel_plane {
  540. struct drm_plane base;
  541. int plane;
  542. enum pipe pipe;
  543. bool can_scale;
  544. int max_downscale;
  545. uint32_t frontbuffer_bit;
  546. /* Since we need to change the watermarks before/after
  547. * enabling/disabling the planes, we need to store the parameters here
  548. * as the other pieces of the struct may not reflect the values we want
  549. * for the watermark calculations. Currently only Haswell uses this.
  550. */
  551. struct intel_plane_wm_parameters wm;
  552. /*
  553. * NOTE: Do not place new plane state fields here (e.g., when adding
  554. * new plane properties). New runtime state should now be placed in
  555. * the intel_plane_state structure and accessed via plane_state.
  556. */
  557. void (*update_plane)(struct drm_plane *plane,
  558. const struct intel_crtc_state *crtc_state,
  559. const struct intel_plane_state *plane_state);
  560. void (*disable_plane)(struct drm_plane *plane,
  561. struct drm_crtc *crtc);
  562. int (*check_plane)(struct drm_plane *plane,
  563. struct intel_crtc_state *crtc_state,
  564. struct intel_plane_state *state);
  565. };
  566. struct intel_watermark_params {
  567. unsigned long fifo_size;
  568. unsigned long max_wm;
  569. unsigned long default_wm;
  570. unsigned long guard_size;
  571. unsigned long cacheline_size;
  572. };
  573. struct cxsr_latency {
  574. int is_desktop;
  575. int is_ddr3;
  576. unsigned long fsb_freq;
  577. unsigned long mem_freq;
  578. unsigned long display_sr;
  579. unsigned long display_hpll_disable;
  580. unsigned long cursor_sr;
  581. unsigned long cursor_hpll_disable;
  582. };
  583. #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
  584. #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
  585. #define to_intel_crtc_state(x) container_of(x, struct intel_crtc_state, base)
  586. #define to_intel_connector(x) container_of(x, struct intel_connector, base)
  587. #define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
  588. #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
  589. #define to_intel_plane(x) container_of(x, struct intel_plane, base)
  590. #define to_intel_plane_state(x) container_of(x, struct intel_plane_state, base)
  591. #define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL)
  592. struct intel_hdmi {
  593. i915_reg_t hdmi_reg;
  594. int ddc_bus;
  595. bool limited_color_range;
  596. bool color_range_auto;
  597. bool has_hdmi_sink;
  598. bool has_audio;
  599. enum hdmi_force_audio force_audio;
  600. bool rgb_quant_range_selectable;
  601. enum hdmi_picture_aspect aspect_ratio;
  602. struct intel_connector *attached_connector;
  603. void (*write_infoframe)(struct drm_encoder *encoder,
  604. enum hdmi_infoframe_type type,
  605. const void *frame, ssize_t len);
  606. void (*set_infoframes)(struct drm_encoder *encoder,
  607. bool enable,
  608. const struct drm_display_mode *adjusted_mode);
  609. bool (*infoframe_enabled)(struct drm_encoder *encoder,
  610. const struct intel_crtc_state *pipe_config);
  611. };
  612. struct intel_dp_mst_encoder;
  613. #define DP_MAX_DOWNSTREAM_PORTS 0x10
  614. /*
  615. * enum link_m_n_set:
  616. * When platform provides two set of M_N registers for dp, we can
  617. * program them and switch between them incase of DRRS.
  618. * But When only one such register is provided, we have to program the
  619. * required divider value on that registers itself based on the DRRS state.
  620. *
  621. * M1_N1 : Program dp_m_n on M1_N1 registers
  622. * dp_m2_n2 on M2_N2 registers (If supported)
  623. *
  624. * M2_N2 : Program dp_m2_n2 on M1_N1 registers
  625. * M2_N2 registers are not supported
  626. */
  627. enum link_m_n_set {
  628. /* Sets the m1_n1 and m2_n2 */
  629. M1_N1 = 0,
  630. M2_N2
  631. };
  632. struct intel_dp {
  633. i915_reg_t output_reg;
  634. i915_reg_t aux_ch_ctl_reg;
  635. i915_reg_t aux_ch_data_reg[5];
  636. uint32_t DP;
  637. int link_rate;
  638. uint8_t lane_count;
  639. bool has_audio;
  640. enum hdmi_force_audio force_audio;
  641. bool limited_color_range;
  642. bool color_range_auto;
  643. uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
  644. uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
  645. uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
  646. /* sink rates as reported by DP_SUPPORTED_LINK_RATES */
  647. uint8_t num_sink_rates;
  648. int sink_rates[DP_MAX_SUPPORTED_RATES];
  649. struct drm_dp_aux aux;
  650. uint8_t train_set[4];
  651. int panel_power_up_delay;
  652. int panel_power_down_delay;
  653. int panel_power_cycle_delay;
  654. int backlight_on_delay;
  655. int backlight_off_delay;
  656. struct delayed_work panel_vdd_work;
  657. bool want_panel_vdd;
  658. unsigned long last_power_on;
  659. unsigned long last_backlight_off;
  660. ktime_t panel_power_off_time;
  661. struct notifier_block edp_notifier;
  662. /*
  663. * Pipe whose power sequencer is currently locked into
  664. * this port. Only relevant on VLV/CHV.
  665. */
  666. enum pipe pps_pipe;
  667. struct edp_power_seq pps_delays;
  668. bool can_mst; /* this port supports mst */
  669. bool is_mst;
  670. int active_mst_links;
  671. /* connector directly attached - won't be use for modeset in mst world */
  672. struct intel_connector *attached_connector;
  673. /* mst connector list */
  674. struct intel_dp_mst_encoder *mst_encoders[I915_MAX_PIPES];
  675. struct drm_dp_mst_topology_mgr mst_mgr;
  676. uint32_t (*get_aux_clock_divider)(struct intel_dp *dp, int index);
  677. /*
  678. * This function returns the value we have to program the AUX_CTL
  679. * register with to kick off an AUX transaction.
  680. */
  681. uint32_t (*get_aux_send_ctl)(struct intel_dp *dp,
  682. bool has_aux_irq,
  683. int send_bytes,
  684. uint32_t aux_clock_divider);
  685. /* This is called before a link training is starterd */
  686. void (*prepare_link_retrain)(struct intel_dp *intel_dp);
  687. bool train_set_valid;
  688. /* Displayport compliance testing */
  689. unsigned long compliance_test_type;
  690. unsigned long compliance_test_data;
  691. bool compliance_test_active;
  692. };
  693. struct intel_digital_port {
  694. struct intel_encoder base;
  695. enum port port;
  696. u32 saved_port_bits;
  697. struct intel_dp dp;
  698. struct intel_hdmi hdmi;
  699. enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
  700. bool release_cl2_override;
  701. uint8_t max_lanes;
  702. /* for communication with audio component; protected by av_mutex */
  703. const struct drm_connector *audio_connector;
  704. };
  705. struct intel_dp_mst_encoder {
  706. struct intel_encoder base;
  707. enum pipe pipe;
  708. struct intel_digital_port *primary;
  709. void *port; /* store this opaque as its illegal to dereference it */
  710. };
  711. static inline enum dpio_channel
  712. vlv_dport_to_channel(struct intel_digital_port *dport)
  713. {
  714. switch (dport->port) {
  715. case PORT_B:
  716. case PORT_D:
  717. return DPIO_CH0;
  718. case PORT_C:
  719. return DPIO_CH1;
  720. default:
  721. BUG();
  722. }
  723. }
  724. static inline enum dpio_phy
  725. vlv_dport_to_phy(struct intel_digital_port *dport)
  726. {
  727. switch (dport->port) {
  728. case PORT_B:
  729. case PORT_C:
  730. return DPIO_PHY0;
  731. case PORT_D:
  732. return DPIO_PHY1;
  733. default:
  734. BUG();
  735. }
  736. }
  737. static inline enum dpio_channel
  738. vlv_pipe_to_channel(enum pipe pipe)
  739. {
  740. switch (pipe) {
  741. case PIPE_A:
  742. case PIPE_C:
  743. return DPIO_CH0;
  744. case PIPE_B:
  745. return DPIO_CH1;
  746. default:
  747. BUG();
  748. }
  749. }
  750. static inline struct drm_crtc *
  751. intel_get_crtc_for_pipe(struct drm_device *dev, int pipe)
  752. {
  753. struct drm_i915_private *dev_priv = dev->dev_private;
  754. return dev_priv->pipe_to_crtc_mapping[pipe];
  755. }
  756. static inline struct drm_crtc *
  757. intel_get_crtc_for_plane(struct drm_device *dev, int plane)
  758. {
  759. struct drm_i915_private *dev_priv = dev->dev_private;
  760. return dev_priv->plane_to_crtc_mapping[plane];
  761. }
  762. struct intel_unpin_work {
  763. struct work_struct work;
  764. struct drm_crtc *crtc;
  765. struct drm_framebuffer *old_fb;
  766. struct drm_i915_gem_object *pending_flip_obj;
  767. struct drm_pending_vblank_event *event;
  768. atomic_t pending;
  769. #define INTEL_FLIP_INACTIVE 0
  770. #define INTEL_FLIP_PENDING 1
  771. #define INTEL_FLIP_COMPLETE 2
  772. u32 flip_count;
  773. u32 gtt_offset;
  774. struct drm_i915_gem_request *flip_queued_req;
  775. u32 flip_queued_vblank;
  776. u32 flip_ready_vblank;
  777. bool enable_stall_check;
  778. };
  779. struct intel_load_detect_pipe {
  780. struct drm_atomic_state *restore_state;
  781. };
  782. static inline struct intel_encoder *
  783. intel_attached_encoder(struct drm_connector *connector)
  784. {
  785. return to_intel_connector(connector)->encoder;
  786. }
  787. static inline struct intel_digital_port *
  788. enc_to_dig_port(struct drm_encoder *encoder)
  789. {
  790. return container_of(encoder, struct intel_digital_port, base.base);
  791. }
  792. static inline struct intel_dp_mst_encoder *
  793. enc_to_mst(struct drm_encoder *encoder)
  794. {
  795. return container_of(encoder, struct intel_dp_mst_encoder, base.base);
  796. }
  797. static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder)
  798. {
  799. return &enc_to_dig_port(encoder)->dp;
  800. }
  801. static inline struct intel_digital_port *
  802. dp_to_dig_port(struct intel_dp *intel_dp)
  803. {
  804. return container_of(intel_dp, struct intel_digital_port, dp);
  805. }
  806. static inline struct intel_digital_port *
  807. hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
  808. {
  809. return container_of(intel_hdmi, struct intel_digital_port, hdmi);
  810. }
  811. /*
  812. * Returns the number of planes for this pipe, ie the number of sprites + 1
  813. * (primary plane). This doesn't count the cursor plane then.
  814. */
  815. static inline unsigned int intel_num_planes(struct intel_crtc *crtc)
  816. {
  817. return INTEL_INFO(crtc->base.dev)->num_sprites[crtc->pipe] + 1;
  818. }
  819. /* intel_fifo_underrun.c */
  820. bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
  821. enum pipe pipe, bool enable);
  822. bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
  823. enum transcoder pch_transcoder,
  824. bool enable);
  825. void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
  826. enum pipe pipe);
  827. void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
  828. enum transcoder pch_transcoder);
  829. void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv);
  830. void intel_check_pch_fifo_underruns(struct drm_i915_private *dev_priv);
  831. /* i915_irq.c */
  832. void gen5_enable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  833. void gen5_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  834. void gen6_enable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  835. void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  836. void gen6_reset_rps_interrupts(struct drm_device *dev);
  837. void gen6_enable_rps_interrupts(struct drm_device *dev);
  838. void gen6_disable_rps_interrupts(struct drm_device *dev);
  839. u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask);
  840. void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv);
  841. void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv);
  842. static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
  843. {
  844. /*
  845. * We only use drm_irq_uninstall() at unload and VT switch, so
  846. * this is the only thing we need to check.
  847. */
  848. return dev_priv->pm.irqs_enabled;
  849. }
  850. int intel_get_crtc_scanline(struct intel_crtc *crtc);
  851. void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
  852. unsigned int pipe_mask);
  853. void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
  854. unsigned int pipe_mask);
  855. /* intel_crt.c */
  856. void intel_crt_init(struct drm_device *dev);
  857. /* intel_ddi.c */
  858. void intel_ddi_clk_select(struct intel_encoder *encoder,
  859. const struct intel_crtc_state *pipe_config);
  860. void intel_prepare_ddi_buffer(struct intel_encoder *encoder);
  861. void hsw_fdi_link_train(struct drm_crtc *crtc);
  862. void intel_ddi_init(struct drm_device *dev, enum port port);
  863. enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder);
  864. bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
  865. void intel_ddi_pll_init(struct drm_device *dev);
  866. void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc);
  867. void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
  868. enum transcoder cpu_transcoder);
  869. void intel_ddi_enable_pipe_clock(struct intel_crtc *intel_crtc);
  870. void intel_ddi_disable_pipe_clock(struct intel_crtc *intel_crtc);
  871. bool intel_ddi_pll_select(struct intel_crtc *crtc,
  872. struct intel_crtc_state *crtc_state);
  873. void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
  874. void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
  875. bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
  876. void intel_ddi_fdi_disable(struct drm_crtc *crtc);
  877. bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
  878. struct intel_crtc *intel_crtc);
  879. void intel_ddi_get_config(struct intel_encoder *encoder,
  880. struct intel_crtc_state *pipe_config);
  881. struct intel_encoder *
  882. intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state);
  883. void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder);
  884. void intel_ddi_clock_get(struct intel_encoder *encoder,
  885. struct intel_crtc_state *pipe_config);
  886. void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
  887. uint32_t ddi_signal_levels(struct intel_dp *intel_dp);
  888. /* intel_frontbuffer.c */
  889. void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
  890. enum fb_op_origin origin);
  891. void intel_frontbuffer_flip_prepare(struct drm_device *dev,
  892. unsigned frontbuffer_bits);
  893. void intel_frontbuffer_flip_complete(struct drm_device *dev,
  894. unsigned frontbuffer_bits);
  895. void intel_frontbuffer_flip(struct drm_device *dev,
  896. unsigned frontbuffer_bits);
  897. unsigned int intel_fb_align_height(struct drm_device *dev,
  898. unsigned int height,
  899. uint32_t pixel_format,
  900. uint64_t fb_format_modifier);
  901. void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire,
  902. enum fb_op_origin origin);
  903. u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv,
  904. uint64_t fb_modifier, uint32_t pixel_format);
  905. /* intel_audio.c */
  906. void intel_init_audio(struct drm_device *dev);
  907. void intel_audio_codec_enable(struct intel_encoder *encoder);
  908. void intel_audio_codec_disable(struct intel_encoder *encoder);
  909. void i915_audio_component_init(struct drm_i915_private *dev_priv);
  910. void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
  911. /* intel_display.c */
  912. extern const struct drm_plane_funcs intel_plane_funcs;
  913. bool intel_has_pending_fb_unpin(struct drm_device *dev);
  914. int intel_pch_rawclk(struct drm_device *dev);
  915. int intel_hrawclk(struct drm_device *dev);
  916. void intel_mark_busy(struct drm_device *dev);
  917. void intel_mark_idle(struct drm_device *dev);
  918. void intel_crtc_restore_mode(struct drm_crtc *crtc);
  919. int intel_display_suspend(struct drm_device *dev);
  920. void intel_encoder_destroy(struct drm_encoder *encoder);
  921. int intel_connector_init(struct intel_connector *);
  922. struct intel_connector *intel_connector_alloc(void);
  923. bool intel_connector_get_hw_state(struct intel_connector *connector);
  924. void intel_connector_attach_encoder(struct intel_connector *connector,
  925. struct intel_encoder *encoder);
  926. struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
  927. struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
  928. struct drm_crtc *crtc);
  929. enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
  930. int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
  931. struct drm_file *file_priv);
  932. enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
  933. enum pipe pipe);
  934. bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type);
  935. static inline void
  936. intel_wait_for_vblank(struct drm_device *dev, int pipe)
  937. {
  938. drm_wait_one_vblank(dev, pipe);
  939. }
  940. static inline void
  941. intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)
  942. {
  943. const struct intel_crtc *crtc =
  944. to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
  945. if (crtc->active)
  946. intel_wait_for_vblank(dev, pipe);
  947. }
  948. int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
  949. void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
  950. struct intel_digital_port *dport,
  951. unsigned int expected_mask);
  952. bool intel_get_load_detect_pipe(struct drm_connector *connector,
  953. struct drm_display_mode *mode,
  954. struct intel_load_detect_pipe *old,
  955. struct drm_modeset_acquire_ctx *ctx);
  956. void intel_release_load_detect_pipe(struct drm_connector *connector,
  957. struct intel_load_detect_pipe *old,
  958. struct drm_modeset_acquire_ctx *ctx);
  959. int intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  960. struct drm_framebuffer *fb,
  961. const struct drm_plane_state *plane_state);
  962. struct drm_framebuffer *
  963. __intel_framebuffer_create(struct drm_device *dev,
  964. struct drm_mode_fb_cmd2 *mode_cmd,
  965. struct drm_i915_gem_object *obj);
  966. void intel_prepare_page_flip(struct drm_device *dev, int plane);
  967. void intel_finish_page_flip(struct drm_device *dev, int pipe);
  968. void intel_finish_page_flip_plane(struct drm_device *dev, int plane);
  969. void intel_check_page_flip(struct drm_device *dev, int pipe);
  970. int intel_prepare_plane_fb(struct drm_plane *plane,
  971. const struct drm_plane_state *new_state);
  972. void intel_cleanup_plane_fb(struct drm_plane *plane,
  973. const struct drm_plane_state *old_state);
  974. int intel_plane_atomic_get_property(struct drm_plane *plane,
  975. const struct drm_plane_state *state,
  976. struct drm_property *property,
  977. uint64_t *val);
  978. int intel_plane_atomic_set_property(struct drm_plane *plane,
  979. struct drm_plane_state *state,
  980. struct drm_property *property,
  981. uint64_t val);
  982. int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
  983. struct drm_plane_state *plane_state);
  984. unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
  985. uint64_t fb_modifier, unsigned int cpp);
  986. static inline bool
  987. intel_rotation_90_or_270(unsigned int rotation)
  988. {
  989. return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
  990. }
  991. void intel_create_rotation_property(struct drm_device *dev,
  992. struct intel_plane *plane);
  993. /* shared dpll functions */
  994. struct intel_shared_dpll *intel_crtc_to_shared_dpll(struct intel_crtc *crtc);
  995. void assert_shared_dpll(struct drm_i915_private *dev_priv,
  996. struct intel_shared_dpll *pll,
  997. bool state);
  998. #define assert_shared_dpll_enabled(d, p) assert_shared_dpll(d, p, true)
  999. #define assert_shared_dpll_disabled(d, p) assert_shared_dpll(d, p, false)
  1000. struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
  1001. struct intel_crtc_state *state);
  1002. int vlv_force_pll_on(struct drm_device *dev, enum pipe pipe,
  1003. const struct dpll *dpll);
  1004. void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe);
  1005. /* modesetting asserts */
  1006. void assert_panel_unlocked(struct drm_i915_private *dev_priv,
  1007. enum pipe pipe);
  1008. void assert_pll(struct drm_i915_private *dev_priv,
  1009. enum pipe pipe, bool state);
  1010. #define assert_pll_enabled(d, p) assert_pll(d, p, true)
  1011. #define assert_pll_disabled(d, p) assert_pll(d, p, false)
  1012. void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
  1013. enum pipe pipe, bool state);
  1014. #define assert_fdi_rx_pll_enabled(d, p) assert_fdi_rx_pll(d, p, true)
  1015. #define assert_fdi_rx_pll_disabled(d, p) assert_fdi_rx_pll(d, p, false)
  1016. void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);
  1017. #define assert_pipe_enabled(d, p) assert_pipe(d, p, true)
  1018. #define assert_pipe_disabled(d, p) assert_pipe(d, p, false)
  1019. u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv,
  1020. int *x, int *y,
  1021. uint64_t fb_modifier,
  1022. unsigned int cpp,
  1023. unsigned int pitch);
  1024. void intel_prepare_reset(struct drm_device *dev);
  1025. void intel_finish_reset(struct drm_device *dev);
  1026. void hsw_enable_pc8(struct drm_i915_private *dev_priv);
  1027. void hsw_disable_pc8(struct drm_i915_private *dev_priv);
  1028. void broxton_init_cdclk(struct drm_device *dev);
  1029. void broxton_uninit_cdclk(struct drm_device *dev);
  1030. void broxton_ddi_phy_init(struct drm_device *dev);
  1031. void broxton_ddi_phy_uninit(struct drm_device *dev);
  1032. void bxt_enable_dc9(struct drm_i915_private *dev_priv);
  1033. void bxt_disable_dc9(struct drm_i915_private *dev_priv);
  1034. void skl_init_cdclk(struct drm_i915_private *dev_priv);
  1035. int skl_sanitize_cdclk(struct drm_i915_private *dev_priv);
  1036. void skl_uninit_cdclk(struct drm_i915_private *dev_priv);
  1037. void skl_enable_dc6(struct drm_i915_private *dev_priv);
  1038. void skl_disable_dc6(struct drm_i915_private *dev_priv);
  1039. void intel_dp_get_m_n(struct intel_crtc *crtc,
  1040. struct intel_crtc_state *pipe_config);
  1041. void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
  1042. int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
  1043. void
  1044. ironlake_check_encoder_dotclock(const struct intel_crtc_state *pipe_config,
  1045. int dotclock);
  1046. bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state, int target_clock,
  1047. intel_clock_t *best_clock);
  1048. int chv_calc_dpll_params(int refclk, intel_clock_t *pll_clock);
  1049. bool intel_crtc_active(struct drm_crtc *crtc);
  1050. void hsw_enable_ips(struct intel_crtc *crtc);
  1051. void hsw_disable_ips(struct intel_crtc *crtc);
  1052. enum intel_display_power_domain
  1053. intel_display_port_power_domain(struct intel_encoder *intel_encoder);
  1054. enum intel_display_power_domain
  1055. intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder);
  1056. void intel_mode_from_pipe_config(struct drm_display_mode *mode,
  1057. struct intel_crtc_state *pipe_config);
  1058. int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
  1059. int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
  1060. u32 intel_plane_obj_offset(struct intel_plane *intel_plane,
  1061. struct drm_i915_gem_object *obj,
  1062. unsigned int plane);
  1063. u32 skl_plane_ctl_format(uint32_t pixel_format);
  1064. u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
  1065. u32 skl_plane_ctl_rotation(unsigned int rotation);
  1066. /* intel_csr.c */
  1067. void intel_csr_ucode_init(struct drm_i915_private *);
  1068. bool intel_csr_load_program(struct drm_i915_private *);
  1069. void intel_csr_ucode_fini(struct drm_i915_private *);
  1070. /* intel_dp.c */
  1071. void intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
  1072. bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
  1073. struct intel_connector *intel_connector);
  1074. void intel_dp_set_link_params(struct intel_dp *intel_dp,
  1075. const struct intel_crtc_state *pipe_config);
  1076. void intel_dp_start_link_train(struct intel_dp *intel_dp);
  1077. void intel_dp_stop_link_train(struct intel_dp *intel_dp);
  1078. void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
  1079. void intel_dp_encoder_destroy(struct drm_encoder *encoder);
  1080. int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
  1081. bool intel_dp_compute_config(struct intel_encoder *encoder,
  1082. struct intel_crtc_state *pipe_config);
  1083. bool intel_dp_is_edp(struct drm_device *dev, enum port port);
  1084. enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
  1085. bool long_hpd);
  1086. void intel_edp_backlight_on(struct intel_dp *intel_dp);
  1087. void intel_edp_backlight_off(struct intel_dp *intel_dp);
  1088. void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
  1089. void intel_edp_panel_on(struct intel_dp *intel_dp);
  1090. void intel_edp_panel_off(struct intel_dp *intel_dp);
  1091. void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector);
  1092. void intel_dp_mst_suspend(struct drm_device *dev);
  1093. void intel_dp_mst_resume(struct drm_device *dev);
  1094. int intel_dp_max_link_rate(struct intel_dp *intel_dp);
  1095. int intel_dp_rate_select(struct intel_dp *intel_dp, int rate);
  1096. void intel_dp_hot_plug(struct intel_encoder *intel_encoder);
  1097. void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv);
  1098. uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);
  1099. void intel_plane_destroy(struct drm_plane *plane);
  1100. void intel_edp_drrs_enable(struct intel_dp *intel_dp);
  1101. void intel_edp_drrs_disable(struct intel_dp *intel_dp);
  1102. void intel_edp_drrs_invalidate(struct drm_device *dev,
  1103. unsigned frontbuffer_bits);
  1104. void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits);
  1105. bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
  1106. struct intel_digital_port *port);
  1107. void hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config);
  1108. void
  1109. intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
  1110. uint8_t dp_train_pat);
  1111. void
  1112. intel_dp_set_signal_levels(struct intel_dp *intel_dp);
  1113. void intel_dp_set_idle_link_train(struct intel_dp *intel_dp);
  1114. uint8_t
  1115. intel_dp_voltage_max(struct intel_dp *intel_dp);
  1116. uint8_t
  1117. intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing);
  1118. void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
  1119. uint8_t *link_bw, uint8_t *rate_select);
  1120. bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
  1121. bool
  1122. intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]);
  1123. /* intel_dp_mst.c */
  1124. int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
  1125. void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
  1126. /* intel_dsi.c */
  1127. void intel_dsi_init(struct drm_device *dev);
  1128. /* intel_dvo.c */
  1129. void intel_dvo_init(struct drm_device *dev);
  1130. /* legacy fbdev emulation in intel_fbdev.c */
  1131. #ifdef CONFIG_DRM_FBDEV_EMULATION
  1132. extern int intel_fbdev_init(struct drm_device *dev);
  1133. extern void intel_fbdev_initial_config_async(struct drm_device *dev);
  1134. extern void intel_fbdev_fini(struct drm_device *dev);
  1135. extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
  1136. extern void intel_fbdev_output_poll_changed(struct drm_device *dev);
  1137. extern void intel_fbdev_restore_mode(struct drm_device *dev);
  1138. #else
  1139. static inline int intel_fbdev_init(struct drm_device *dev)
  1140. {
  1141. return 0;
  1142. }
  1143. static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
  1144. {
  1145. }
  1146. static inline void intel_fbdev_fini(struct drm_device *dev)
  1147. {
  1148. }
  1149. static inline void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous)
  1150. {
  1151. }
  1152. static inline void intel_fbdev_restore_mode(struct drm_device *dev)
  1153. {
  1154. }
  1155. #endif
  1156. /* intel_fbc.c */
  1157. void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
  1158. struct drm_atomic_state *state);
  1159. bool intel_fbc_is_active(struct drm_i915_private *dev_priv);
  1160. void intel_fbc_pre_update(struct intel_crtc *crtc);
  1161. void intel_fbc_post_update(struct intel_crtc *crtc);
  1162. void intel_fbc_init(struct drm_i915_private *dev_priv);
  1163. void intel_fbc_init_pipe_state(struct drm_i915_private *dev_priv);
  1164. void intel_fbc_enable(struct intel_crtc *crtc);
  1165. void intel_fbc_disable(struct intel_crtc *crtc);
  1166. void intel_fbc_global_disable(struct drm_i915_private *dev_priv);
  1167. void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
  1168. unsigned int frontbuffer_bits,
  1169. enum fb_op_origin origin);
  1170. void intel_fbc_flush(struct drm_i915_private *dev_priv,
  1171. unsigned int frontbuffer_bits, enum fb_op_origin origin);
  1172. void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv);
  1173. /* intel_hdmi.c */
  1174. void intel_hdmi_init(struct drm_device *dev, i915_reg_t hdmi_reg, enum port port);
  1175. void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
  1176. struct intel_connector *intel_connector);
  1177. struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
  1178. bool intel_hdmi_compute_config(struct intel_encoder *encoder,
  1179. struct intel_crtc_state *pipe_config);
  1180. /* intel_lvds.c */
  1181. void intel_lvds_init(struct drm_device *dev);
  1182. bool intel_is_dual_link_lvds(struct drm_device *dev);
  1183. /* intel_modes.c */
  1184. int intel_connector_update_modes(struct drm_connector *connector,
  1185. struct edid *edid);
  1186. int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
  1187. void intel_attach_force_audio_property(struct drm_connector *connector);
  1188. void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
  1189. void intel_attach_aspect_ratio_property(struct drm_connector *connector);
  1190. /* intel_overlay.c */
  1191. void intel_setup_overlay(struct drm_device *dev);
  1192. void intel_cleanup_overlay(struct drm_device *dev);
  1193. int intel_overlay_switch_off(struct intel_overlay *overlay);
  1194. int intel_overlay_put_image(struct drm_device *dev, void *data,
  1195. struct drm_file *file_priv);
  1196. int intel_overlay_attrs(struct drm_device *dev, void *data,
  1197. struct drm_file *file_priv);
  1198. void intel_overlay_reset(struct drm_i915_private *dev_priv);
  1199. /* intel_panel.c */
  1200. int intel_panel_init(struct intel_panel *panel,
  1201. struct drm_display_mode *fixed_mode,
  1202. struct drm_display_mode *downclock_mode);
  1203. void intel_panel_fini(struct intel_panel *panel);
  1204. void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
  1205. struct drm_display_mode *adjusted_mode);
  1206. void intel_pch_panel_fitting(struct intel_crtc *crtc,
  1207. struct intel_crtc_state *pipe_config,
  1208. int fitting_mode);
  1209. void intel_gmch_panel_fitting(struct intel_crtc *crtc,
  1210. struct intel_crtc_state *pipe_config,
  1211. int fitting_mode);
  1212. void intel_panel_set_backlight_acpi(struct intel_connector *connector,
  1213. u32 level, u32 max);
  1214. int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe);
  1215. void intel_panel_enable_backlight(struct intel_connector *connector);
  1216. void intel_panel_disable_backlight(struct intel_connector *connector);
  1217. void intel_panel_destroy_backlight(struct drm_connector *connector);
  1218. enum drm_connector_status intel_panel_detect(struct drm_device *dev);
  1219. extern struct drm_display_mode *intel_find_panel_downclock(
  1220. struct drm_device *dev,
  1221. struct drm_display_mode *fixed_mode,
  1222. struct drm_connector *connector);
  1223. void intel_backlight_register(struct drm_device *dev);
  1224. void intel_backlight_unregister(struct drm_device *dev);
  1225. /* intel_psr.c */
  1226. void intel_psr_enable(struct intel_dp *intel_dp);
  1227. void intel_psr_disable(struct intel_dp *intel_dp);
  1228. void intel_psr_invalidate(struct drm_device *dev,
  1229. unsigned frontbuffer_bits);
  1230. void intel_psr_flush(struct drm_device *dev,
  1231. unsigned frontbuffer_bits,
  1232. enum fb_op_origin origin);
  1233. void intel_psr_init(struct drm_device *dev);
  1234. void intel_psr_single_frame_update(struct drm_device *dev,
  1235. unsigned frontbuffer_bits);
  1236. /* intel_runtime_pm.c */
  1237. int intel_power_domains_init(struct drm_i915_private *);
  1238. void intel_power_domains_fini(struct drm_i915_private *);
  1239. void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume);
  1240. void intel_power_domains_suspend(struct drm_i915_private *dev_priv);
  1241. void skl_pw1_misc_io_init(struct drm_i915_private *dev_priv);
  1242. void skl_pw1_misc_io_fini(struct drm_i915_private *dev_priv);
  1243. void intel_runtime_pm_enable(struct drm_i915_private *dev_priv);
  1244. const char *
  1245. intel_display_power_domain_str(enum intel_display_power_domain domain);
  1246. bool intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
  1247. enum intel_display_power_domain domain);
  1248. bool __intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
  1249. enum intel_display_power_domain domain);
  1250. void intel_display_power_get(struct drm_i915_private *dev_priv,
  1251. enum intel_display_power_domain domain);
  1252. bool intel_display_power_get_if_enabled(struct drm_i915_private *dev_priv,
  1253. enum intel_display_power_domain domain);
  1254. void intel_display_power_put(struct drm_i915_private *dev_priv,
  1255. enum intel_display_power_domain domain);
  1256. static inline void
  1257. assert_rpm_device_not_suspended(struct drm_i915_private *dev_priv)
  1258. {
  1259. WARN_ONCE(dev_priv->pm.suspended,
  1260. "Device suspended during HW access\n");
  1261. }
  1262. static inline void
  1263. assert_rpm_wakelock_held(struct drm_i915_private *dev_priv)
  1264. {
  1265. assert_rpm_device_not_suspended(dev_priv);
  1266. /* FIXME: Needs to be converted back to WARN_ONCE, but currently causes
  1267. * too much noise. */
  1268. if (!atomic_read(&dev_priv->pm.wakeref_count))
  1269. DRM_DEBUG_DRIVER("RPM wakelock ref not held during HW access");
  1270. }
  1271. static inline int
  1272. assert_rpm_atomic_begin(struct drm_i915_private *dev_priv)
  1273. {
  1274. int seq = atomic_read(&dev_priv->pm.atomic_seq);
  1275. assert_rpm_wakelock_held(dev_priv);
  1276. return seq;
  1277. }
  1278. static inline void
  1279. assert_rpm_atomic_end(struct drm_i915_private *dev_priv, int begin_seq)
  1280. {
  1281. WARN_ONCE(atomic_read(&dev_priv->pm.atomic_seq) != begin_seq,
  1282. "HW access outside of RPM atomic section\n");
  1283. }
  1284. /**
  1285. * disable_rpm_wakeref_asserts - disable the RPM assert checks
  1286. * @dev_priv: i915 device instance
  1287. *
  1288. * This function disable asserts that check if we hold an RPM wakelock
  1289. * reference, while keeping the device-not-suspended checks still enabled.
  1290. * It's meant to be used only in special circumstances where our rule about
  1291. * the wakelock refcount wrt. the device power state doesn't hold. According
  1292. * to this rule at any point where we access the HW or want to keep the HW in
  1293. * an active state we must hold an RPM wakelock reference acquired via one of
  1294. * the intel_runtime_pm_get() helpers. Currently there are a few special spots
  1295. * where this rule doesn't hold: the IRQ and suspend/resume handlers, the
  1296. * forcewake release timer, and the GPU RPS and hangcheck works. All other
  1297. * users should avoid using this function.
  1298. *
  1299. * Any calls to this function must have a symmetric call to
  1300. * enable_rpm_wakeref_asserts().
  1301. */
  1302. static inline void
  1303. disable_rpm_wakeref_asserts(struct drm_i915_private *dev_priv)
  1304. {
  1305. atomic_inc(&dev_priv->pm.wakeref_count);
  1306. }
  1307. /**
  1308. * enable_rpm_wakeref_asserts - re-enable the RPM assert checks
  1309. * @dev_priv: i915 device instance
  1310. *
  1311. * This function re-enables the RPM assert checks after disabling them with
  1312. * disable_rpm_wakeref_asserts. It's meant to be used only in special
  1313. * circumstances otherwise its use should be avoided.
  1314. *
  1315. * Any calls to this function must have a symmetric call to
  1316. * disable_rpm_wakeref_asserts().
  1317. */
  1318. static inline void
  1319. enable_rpm_wakeref_asserts(struct drm_i915_private *dev_priv)
  1320. {
  1321. atomic_dec(&dev_priv->pm.wakeref_count);
  1322. }
  1323. /* TODO: convert users of these to rely instead on proper RPM refcounting */
  1324. #define DISABLE_RPM_WAKEREF_ASSERTS(dev_priv) \
  1325. disable_rpm_wakeref_asserts(dev_priv)
  1326. #define ENABLE_RPM_WAKEREF_ASSERTS(dev_priv) \
  1327. enable_rpm_wakeref_asserts(dev_priv)
  1328. void intel_runtime_pm_get(struct drm_i915_private *dev_priv);
  1329. bool intel_runtime_pm_get_if_in_use(struct drm_i915_private *dev_priv);
  1330. void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv);
  1331. void intel_runtime_pm_put(struct drm_i915_private *dev_priv);
  1332. void intel_display_set_init_power(struct drm_i915_private *dev, bool enable);
  1333. void chv_phy_powergate_lanes(struct intel_encoder *encoder,
  1334. bool override, unsigned int mask);
  1335. bool chv_phy_powergate_ch(struct drm_i915_private *dev_priv, enum dpio_phy phy,
  1336. enum dpio_channel ch, bool override);
  1337. /* intel_pm.c */
  1338. void intel_init_clock_gating(struct drm_device *dev);
  1339. void intel_suspend_hw(struct drm_device *dev);
  1340. int ilk_wm_max_level(const struct drm_device *dev);
  1341. void intel_update_watermarks(struct drm_crtc *crtc);
  1342. void intel_init_pm(struct drm_device *dev);
  1343. void intel_pm_setup(struct drm_device *dev);
  1344. void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
  1345. void intel_gpu_ips_teardown(void);
  1346. void intel_init_gt_powersave(struct drm_device *dev);
  1347. void intel_cleanup_gt_powersave(struct drm_device *dev);
  1348. void intel_enable_gt_powersave(struct drm_device *dev);
  1349. void intel_disable_gt_powersave(struct drm_device *dev);
  1350. void intel_suspend_gt_powersave(struct drm_device *dev);
  1351. void intel_reset_gt_powersave(struct drm_device *dev);
  1352. void gen6_update_ring_freq(struct drm_device *dev);
  1353. void gen6_rps_busy(struct drm_i915_private *dev_priv);
  1354. void gen6_rps_reset_ei(struct drm_i915_private *dev_priv);
  1355. void gen6_rps_idle(struct drm_i915_private *dev_priv);
  1356. void gen6_rps_boost(struct drm_i915_private *dev_priv,
  1357. struct intel_rps_client *rps,
  1358. unsigned long submitted);
  1359. void intel_queue_rps_boost_for_request(struct drm_device *dev,
  1360. struct drm_i915_gem_request *req);
  1361. void vlv_wm_get_hw_state(struct drm_device *dev);
  1362. void ilk_wm_get_hw_state(struct drm_device *dev);
  1363. void skl_wm_get_hw_state(struct drm_device *dev);
  1364. void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv,
  1365. struct skl_ddb_allocation *ddb /* out */);
  1366. uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config);
  1367. int sanitize_rc6_option(const struct drm_device *dev, int enable_rc6);
  1368. /* intel_sdvo.c */
  1369. bool intel_sdvo_init(struct drm_device *dev,
  1370. i915_reg_t reg, enum port port);
  1371. /* intel_sprite.c */
  1372. int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane);
  1373. int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
  1374. struct drm_file *file_priv);
  1375. void intel_pipe_update_start(struct intel_crtc *crtc);
  1376. void intel_pipe_update_end(struct intel_crtc *crtc);
  1377. /* intel_tv.c */
  1378. void intel_tv_init(struct drm_device *dev);
  1379. /* intel_atomic.c */
  1380. int intel_connector_atomic_get_property(struct drm_connector *connector,
  1381. const struct drm_connector_state *state,
  1382. struct drm_property *property,
  1383. uint64_t *val);
  1384. struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
  1385. void intel_crtc_destroy_state(struct drm_crtc *crtc,
  1386. struct drm_crtc_state *state);
  1387. struct drm_atomic_state *intel_atomic_state_alloc(struct drm_device *dev);
  1388. void intel_atomic_state_clear(struct drm_atomic_state *);
  1389. struct intel_shared_dpll_config *
  1390. intel_atomic_get_shared_dpll_state(struct drm_atomic_state *s);
  1391. static inline struct intel_crtc_state *
  1392. intel_atomic_get_crtc_state(struct drm_atomic_state *state,
  1393. struct intel_crtc *crtc)
  1394. {
  1395. struct drm_crtc_state *crtc_state;
  1396. crtc_state = drm_atomic_get_crtc_state(state, &crtc->base);
  1397. if (IS_ERR(crtc_state))
  1398. return ERR_CAST(crtc_state);
  1399. return to_intel_crtc_state(crtc_state);
  1400. }
  1401. int intel_atomic_setup_scalers(struct drm_device *dev,
  1402. struct intel_crtc *intel_crtc,
  1403. struct intel_crtc_state *crtc_state);
  1404. /* intel_atomic_plane.c */
  1405. struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
  1406. struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
  1407. void intel_plane_destroy_state(struct drm_plane *plane,
  1408. struct drm_plane_state *state);
  1409. extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
  1410. #endif /* __INTEL_DRV_H__ */