diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-15 22:04:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-15 22:04:27 -0400 |
commit | be8454afc50f43016ca8b6130d9673bdd0bd56ec (patch) | |
tree | 897e49c1ccadeed9b083a3ffc13f0dd2d6d7d874 /include/drm | |
parent | fec88ab0af9706b2201e5daf377c5031c62d11f7 (diff) | |
parent | 3729fe2bc2a01f4cc1aa88be8f64af06084c87d6 (diff) |
Merge tag 'drm-next-2019-07-16' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie:
"The biggest thing in this is the AMD Navi GPU support, this again
contains a bunch of header files that are large. These are the new AMD
RX5700 GPUs that just recently became available.
New drivers:
- ST-Ericsson MCDE driver
- Ingenic JZ47xx SoC
UAPI change:
- HDR source metadata property
Core:
- HDR inforframes and EDID parsing
- drm hdmi infoframe unpacking
- remove prime sg_table caching into dma-buf
- New gem vram helpers to reduce driver code
- Lots of drmP.h removal
- reservation fencing fix
- documentation updates
- drm_fb_helper_connector removed
- mode name command handler rewrite
fbcon:
- Remove the fbcon notifiers
ttm:
- forward progress fixes
dma-buf:
- make mmap call optional
- debugfs refcount fixes
- dma-fence free with pending signals fix
- each dma-buf gets an inode
Panels:
- Lots of additional panel bindings
amdgpu:
- initial navi10 support
- avoid hw reset
- HDR metadata support
- new thermal sensors for vega asics
- RAS fixes
- use HMM rather than MMU notifier
- xgmi topology via kfd
- SR-IOV fixes
- driver reload fixes
- DC use a core bpc attribute
- Aux fixes for DC
- Bandwidth calc updates for DC
- Clock handling refactor
- kfd VEGAM support
vmwgfx:
- Coherent memory support changes
i915:
- HDR Support
- HDMI i2c link
- Icelake multi-segmented gamma support
- GuC firmware update
- Mule Creek Canyon PCH support for EHL
- EHL platform updtes
- move i915.alpha_support to i915.force_probe
- runtime PM refactoring
- VBT parsing refactoring
- DSI fixes
- struct mutex dependency reduction
- GEM code reorg
mali-dp:
- Komeda driver features
msm:
- dsi vs EPROBE_DEFER fixes
- msm8998 snapdragon 835 support
- a540 gpu support
- mdp5 and dpu interconnect support
exynos:
- drmP.h removal
tegra:
- misc fixes
tda998x:
- audio support improvements
- pixel repeated mode support
- quantisation range handling corrections
- HDMI vendor info fix
armada:
- interlace support fix
- overlay/video plane register handling refactor
- add gamma support
rockchip:
- RX3328 support
panfrost:
- expose perf counters via hidden ioctls
vkms:
- enumerate CRC sources list
ast:
- rework BO handling
mgag200:
- rework BO handling
dw-hdmi:
- suspend/resume support
rcar-du:
- R8A774A1 Soc Support
- LVDS dual-link mode support
- Additional formats
- Misc fixes
omapdrm:
- DSI command mode display support
stm
- fb modifier support
- runtime PM support
sun4i:
- use vmap ops
vc4:
- binner bo binding rework
v3d:
- compute shader support
- resync/sync fixes
- job management refactoring
lima:
- NULL pointer in irq handler fix
- scheduler default timeout
virtio:
- fence seqno support
- trace events
bochs:
- misc fixes
tc458767:
- IRQ/HDP handling
sii902x:
- HDMI audio support
atmel-hlcdc:
- misc fixes
meson:
- zpos support"
* tag 'drm-next-2019-07-16' of git://anongit.freedesktop.org/drm/drm: (1815 commits)
Revert "Merge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm-next"
Revert "mm: adjust apply_to_pfn_range interface for dropped token."
mm: adjust apply_to_pfn_range interface for dropped token.
drm/amdgpu/navi10: add uclk activity sensor
drm/amdgpu: properly guard the generic discovery code
drm/amdgpu: add missing documentation on new module parameters
drm/amdgpu: don't invalidate caches in RELEASE_MEM, only do the writeback
drm/amd/display: avoid 64-bit division
drm/amdgpu/psp11: simplify the ucode register logic
drm/amdgpu: properly guard DC support in navi code
drm/amd/powerplay: vega20: fix uninitialized variable use
drm/amd/display: dcn20: include linux/delay.h
amdgpu: make pmu support optional
drm/amd/powerplay: Zero initialize current_rpm in vega20_get_fan_speed_percent
drm/amd/powerplay: Zero initialize freq in smu_v11_0_get_current_clk_freq
drm/amd/powerplay: Use memset to initialize metrics structs
drm/amdgpu/mes10.1: Fix header guard
drm/amd/powerplay: add temperature sensor support for navi10
drm/amdgpu: fix scheduler timeout calc
drm/amdgpu: Prepare for hmm_range_register API change (v2)
...
Diffstat (limited to 'include/drm')
33 files changed, 933 insertions, 171 deletions
diff --git a/include/drm/amd_asic_type.h b/include/drm/amd_asic_type.h index dd63d08cc54e..bcc2bcf32886 100644 --- a/include/drm/amd_asic_type.h +++ b/include/drm/amd_asic_type.h | |||
@@ -49,6 +49,7 @@ enum amd_asic_type { | |||
49 | CHIP_VEGA12, | 49 | CHIP_VEGA12, |
50 | CHIP_VEGA20, | 50 | CHIP_VEGA20, |
51 | CHIP_RAVEN, | 51 | CHIP_RAVEN, |
52 | CHIP_NAVI10, | ||
52 | CHIP_LAST, | 53 | CHIP_LAST, |
53 | }; | 54 | }; |
54 | 55 | ||
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index b4ca970a5b75..c402364aec0d 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h | |||
@@ -150,6 +150,8 @@ struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, | |||
150 | struct drm_encoder *encoder, | 150 | struct drm_encoder *encoder, |
151 | const struct dw_hdmi_plat_data *plat_data); | 151 | const struct dw_hdmi_plat_data *plat_data); |
152 | 152 | ||
153 | void dw_hdmi_resume(struct dw_hdmi *hdmi); | ||
154 | |||
153 | void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); | 155 | void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); |
154 | 156 | ||
155 | void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); | 157 | void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); |
diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 0c33b9e9e0f0..94cc64a342e1 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h | |||
@@ -9,10 +9,20 @@ | |||
9 | #ifndef __DW_MIPI_DSI__ | 9 | #ifndef __DW_MIPI_DSI__ |
10 | #define __DW_MIPI_DSI__ | 10 | #define __DW_MIPI_DSI__ |
11 | 11 | ||
12 | #include <linux/types.h> | ||
13 | |||
14 | #include <drm/drm_modes.h> | ||
15 | |||
16 | struct drm_display_mode; | ||
17 | struct drm_encoder; | ||
12 | struct dw_mipi_dsi; | 18 | struct dw_mipi_dsi; |
19 | struct mipi_dsi_device; | ||
20 | struct platform_device; | ||
13 | 21 | ||
14 | struct dw_mipi_dsi_phy_ops { | 22 | struct dw_mipi_dsi_phy_ops { |
15 | int (*init)(void *priv_data); | 23 | int (*init)(void *priv_data); |
24 | void (*power_on)(void *priv_data); | ||
25 | void (*power_off)(void *priv_data); | ||
16 | int (*get_lane_mbps)(void *priv_data, | 26 | int (*get_lane_mbps)(void *priv_data, |
17 | const struct drm_display_mode *mode, | 27 | const struct drm_display_mode *mode, |
18 | unsigned long mode_flags, u32 lanes, u32 format, | 28 | unsigned long mode_flags, u32 lanes, u32 format, |
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index e937ff2beb04..927e1205d7aa 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h | |||
@@ -459,6 +459,13 @@ struct drm_private_state * | |||
459 | drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, | 459 | drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, |
460 | struct drm_private_obj *obj); | 460 | struct drm_private_obj *obj); |
461 | 461 | ||
462 | struct drm_connector * | ||
463 | drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, | ||
464 | struct drm_encoder *encoder); | ||
465 | struct drm_connector * | ||
466 | drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, | ||
467 | struct drm_encoder *encoder); | ||
468 | |||
462 | /** | 469 | /** |
463 | * drm_atomic_get_existing_crtc_state - get crtc state, if it exists | 470 | * drm_atomic_get_existing_crtc_state - get crtc state, if it exists |
464 | * @state: global atomic state object | 471 | * @state: global atomic state object |
@@ -950,4 +957,19 @@ drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state) | |||
950 | state->connectors_changed; | 957 | state->connectors_changed; |
951 | } | 958 | } |
952 | 959 | ||
960 | /** | ||
961 | * drm_atomic_crtc_effectively_active - compute whether crtc is actually active | ||
962 | * @state: &drm_crtc_state for the CRTC | ||
963 | * | ||
964 | * When in self refresh mode, the crtc_state->active value will be false, since | ||
965 | * the crtc is off. However in some cases we're interested in whether the crtc | ||
966 | * is active, or effectively active (ie: it's connected to an active display). | ||
967 | * In these cases, use this function instead of just checking active. | ||
968 | */ | ||
969 | static inline bool | ||
970 | drm_atomic_crtc_effectively_active(const struct drm_crtc_state *state) | ||
971 | { | ||
972 | return state->active || state->self_refresh_active; | ||
973 | } | ||
974 | |||
953 | #endif /* DRM_ATOMIC_H_ */ | 975 | #endif /* DRM_ATOMIC_H_ */ |
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 58214be3bf3d..bf4e07141d81 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h | |||
@@ -117,12 +117,8 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane, | |||
117 | struct drm_modeset_acquire_ctx *ctx); | 117 | struct drm_modeset_acquire_ctx *ctx); |
118 | int drm_atomic_helper_disable_plane(struct drm_plane *plane, | 118 | int drm_atomic_helper_disable_plane(struct drm_plane *plane, |
119 | struct drm_modeset_acquire_ctx *ctx); | 119 | struct drm_modeset_acquire_ctx *ctx); |
120 | int __drm_atomic_helper_disable_plane(struct drm_plane *plane, | ||
121 | struct drm_plane_state *plane_state); | ||
122 | int drm_atomic_helper_set_config(struct drm_mode_set *set, | 120 | int drm_atomic_helper_set_config(struct drm_mode_set *set, |
123 | struct drm_modeset_acquire_ctx *ctx); | 121 | struct drm_modeset_acquire_ctx *ctx); |
124 | int __drm_atomic_helper_set_config(struct drm_mode_set *set, | ||
125 | struct drm_atomic_state *state); | ||
126 | 122 | ||
127 | int drm_atomic_helper_disable_all(struct drm_device *dev, | 123 | int drm_atomic_helper_disable_all(struct drm_device *dev, |
128 | struct drm_modeset_acquire_ctx *ctx); | 124 | struct drm_modeset_acquire_ctx *ctx); |
diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 66c92cbd8e16..e4577cc11689 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h | |||
@@ -37,6 +37,8 @@ struct drm_private_state; | |||
37 | struct drm_modeset_acquire_ctx; | 37 | struct drm_modeset_acquire_ctx; |
38 | struct drm_device; | 38 | struct drm_device; |
39 | 39 | ||
40 | void __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc, | ||
41 | struct drm_crtc_state *state); | ||
40 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); | 42 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); |
41 | void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, | 43 | void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, |
42 | struct drm_crtc_state *state); | 44 | struct drm_crtc_state *state); |
@@ -60,6 +62,7 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane, | |||
60 | void __drm_atomic_helper_connector_reset(struct drm_connector *connector, | 62 | void __drm_atomic_helper_connector_reset(struct drm_connector *connector, |
61 | struct drm_connector_state *conn_state); | 63 | struct drm_connector_state *conn_state); |
62 | void drm_atomic_helper_connector_reset(struct drm_connector *connector); | 64 | void drm_atomic_helper_connector_reset(struct drm_connector *connector); |
65 | void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector); | ||
63 | void | 66 | void |
64 | __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, | 67 | __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, |
65 | struct drm_connector_state *state); | 68 | struct drm_connector_state *state); |
diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h index 871008118bab..6bf8b2b78991 100644 --- a/include/drm/drm_auth.h +++ b/include/drm/drm_auth.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #ifndef _DRM_AUTH_H_ | ||
2 | #define _DRM_AUTH_H_ | ||
3 | |||
1 | /* | 4 | /* |
2 | * Internal Header for the Direct Rendering Manager | 5 | * Internal Header for the Direct Rendering Manager |
3 | * | 6 | * |
@@ -25,8 +28,12 @@ | |||
25 | * OTHER DEALINGS IN THE SOFTWARE. | 28 | * OTHER DEALINGS IN THE SOFTWARE. |
26 | */ | 29 | */ |
27 | 30 | ||
28 | #ifndef _DRM_AUTH_H_ | 31 | #include <linux/idr.h> |
29 | #define _DRM_AUTH_H_ | 32 | #include <linux/kref.h> |
33 | #include <linux/wait.h> | ||
34 | |||
35 | struct drm_file; | ||
36 | struct drm_hw_lock; | ||
30 | 37 | ||
31 | /* | 38 | /* |
32 | * Legacy DRI1 locking data structure. Only here instead of in drm_legacy.h for | 39 | * Legacy DRI1 locking data structure. Only here instead of in drm_legacy.h for |
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index d4428913a4e1..7616f6562fe4 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h | |||
@@ -237,6 +237,103 @@ struct drm_bridge_funcs { | |||
237 | * The enable callback is optional. | 237 | * The enable callback is optional. |
238 | */ | 238 | */ |
239 | void (*enable)(struct drm_bridge *bridge); | 239 | void (*enable)(struct drm_bridge *bridge); |
240 | |||
241 | /** | ||
242 | * @atomic_pre_enable: | ||
243 | * | ||
244 | * This callback should enable the bridge. It is called right before | ||
245 | * the preceding element in the display pipe is enabled. If the | ||
246 | * preceding element is a bridge this means it's called before that | ||
247 | * bridge's @atomic_pre_enable or @pre_enable function. If the preceding | ||
248 | * element is a &drm_encoder it's called right before the encoder's | ||
249 | * &drm_encoder_helper_funcs.atomic_enable hook. | ||
250 | * | ||
251 | * The display pipe (i.e. clocks and timing signals) feeding this bridge | ||
252 | * will not yet be running when this callback is called. The bridge must | ||
253 | * not enable the display link feeding the next bridge in the chain (if | ||
254 | * there is one) when this callback is called. | ||
255 | * | ||
256 | * Note that this function will only be invoked in the context of an | ||
257 | * atomic commit. It will not be invoked from &drm_bridge_pre_enable. It | ||
258 | * would be prudent to also provide an implementation of @pre_enable if | ||
259 | * you are expecting driver calls into &drm_bridge_pre_enable. | ||
260 | * | ||
261 | * The @atomic_pre_enable callback is optional. | ||
262 | */ | ||
263 | void (*atomic_pre_enable)(struct drm_bridge *bridge, | ||
264 | struct drm_atomic_state *state); | ||
265 | |||
266 | /** | ||
267 | * @atomic_enable: | ||
268 | * | ||
269 | * This callback should enable the bridge. It is called right after | ||
270 | * the preceding element in the display pipe is enabled. If the | ||
271 | * preceding element is a bridge this means it's called after that | ||
272 | * bridge's @atomic_enable or @enable function. If the preceding element | ||
273 | * is a &drm_encoder it's called right after the encoder's | ||
274 | * &drm_encoder_helper_funcs.atomic_enable hook. | ||
275 | * | ||
276 | * The bridge can assume that the display pipe (i.e. clocks and timing | ||
277 | * signals) feeding it is running when this callback is called. This | ||
278 | * callback must enable the display link feeding the next bridge in the | ||
279 | * chain if there is one. | ||
280 | * | ||
281 | * Note that this function will only be invoked in the context of an | ||
282 | * atomic commit. It will not be invoked from &drm_bridge_enable. It | ||
283 | * would be prudent to also provide an implementation of @enable if | ||
284 | * you are expecting driver calls into &drm_bridge_enable. | ||
285 | * | ||
286 | * The enable callback is optional. | ||
287 | */ | ||
288 | void (*atomic_enable)(struct drm_bridge *bridge, | ||
289 | struct drm_atomic_state *state); | ||
290 | /** | ||
291 | * @atomic_disable: | ||
292 | * | ||
293 | * This callback should disable the bridge. It is called right before | ||
294 | * the preceding element in the display pipe is disabled. If the | ||
295 | * preceding element is a bridge this means it's called before that | ||
296 | * bridge's @atomic_disable or @disable vfunc. If the preceding element | ||
297 | * is a &drm_encoder it's called right before the | ||
298 | * &drm_encoder_helper_funcs.atomic_disable hook. | ||
299 | * | ||
300 | * The bridge can assume that the display pipe (i.e. clocks and timing | ||
301 | * signals) feeding it is still running when this callback is called. | ||
302 | * | ||
303 | * Note that this function will only be invoked in the context of an | ||
304 | * atomic commit. It will not be invoked from &drm_bridge_disable. It | ||
305 | * would be prudent to also provide an implementation of @disable if | ||
306 | * you are expecting driver calls into &drm_bridge_disable. | ||
307 | * | ||
308 | * The disable callback is optional. | ||
309 | */ | ||
310 | void (*atomic_disable)(struct drm_bridge *bridge, | ||
311 | struct drm_atomic_state *state); | ||
312 | |||
313 | /** | ||
314 | * @atomic_post_disable: | ||
315 | * | ||
316 | * This callback should disable the bridge. It is called right after the | ||
317 | * preceding element in the display pipe is disabled. If the preceding | ||
318 | * element is a bridge this means it's called after that bridge's | ||
319 | * @atomic_post_disable or @post_disable function. If the preceding | ||
320 | * element is a &drm_encoder it's called right after the encoder's | ||
321 | * &drm_encoder_helper_funcs.atomic_disable hook. | ||
322 | * | ||
323 | * The bridge must assume that the display pipe (i.e. clocks and timing | ||
324 | * signals) feeding it is no longer running when this callback is | ||
325 | * called. | ||
326 | * | ||
327 | * Note that this function will only be invoked in the context of an | ||
328 | * atomic commit. It will not be invoked from &drm_bridge_post_disable. | ||
329 | * It would be prudent to also provide an implementation of | ||
330 | * @post_disable if you are expecting driver calls into | ||
331 | * &drm_bridge_post_disable. | ||
332 | * | ||
333 | * The post_disable callback is optional. | ||
334 | */ | ||
335 | void (*atomic_post_disable)(struct drm_bridge *bridge, | ||
336 | struct drm_atomic_state *state); | ||
240 | }; | 337 | }; |
241 | 338 | ||
242 | /** | 339 | /** |
@@ -265,6 +362,14 @@ struct drm_bridge_timings { | |||
265 | * input signal after the clock edge. | 362 | * input signal after the clock edge. |
266 | */ | 363 | */ |
267 | u32 hold_time_ps; | 364 | u32 hold_time_ps; |
365 | /** | ||
366 | * @dual_link: | ||
367 | * | ||
368 | * True if the bus operates in dual-link mode. The exact meaning is | ||
369 | * dependent on the bus type. For LVDS buses, this indicates that even- | ||
370 | * and odd-numbered pixels are received on separate links. | ||
371 | */ | ||
372 | bool dual_link; | ||
268 | }; | 373 | }; |
269 | 374 | ||
270 | /** | 375 | /** |
@@ -314,6 +419,15 @@ void drm_bridge_mode_set(struct drm_bridge *bridge, | |||
314 | void drm_bridge_pre_enable(struct drm_bridge *bridge); | 419 | void drm_bridge_pre_enable(struct drm_bridge *bridge); |
315 | void drm_bridge_enable(struct drm_bridge *bridge); | 420 | void drm_bridge_enable(struct drm_bridge *bridge); |
316 | 421 | ||
422 | void drm_atomic_bridge_disable(struct drm_bridge *bridge, | ||
423 | struct drm_atomic_state *state); | ||
424 | void drm_atomic_bridge_post_disable(struct drm_bridge *bridge, | ||
425 | struct drm_atomic_state *state); | ||
426 | void drm_atomic_bridge_pre_enable(struct drm_bridge *bridge, | ||
427 | struct drm_atomic_state *state); | ||
428 | void drm_atomic_bridge_enable(struct drm_bridge *bridge, | ||
429 | struct drm_atomic_state *state); | ||
430 | |||
317 | #ifdef CONFIG_DRM_PANEL_BRIDGE | 431 | #ifdef CONFIG_DRM_PANEL_BRIDGE |
318 | struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel, | 432 | struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel, |
319 | u32 connector_type); | 433 | u32 connector_type); |
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 268b2cf0052a..72d51d1e9dd9 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h | |||
@@ -3,8 +3,13 @@ | |||
3 | #ifndef _DRM_CLIENT_H_ | 3 | #ifndef _DRM_CLIENT_H_ |
4 | #define _DRM_CLIENT_H_ | 4 | #define _DRM_CLIENT_H_ |
5 | 5 | ||
6 | #include <linux/lockdep.h> | ||
7 | #include <linux/mutex.h> | ||
6 | #include <linux/types.h> | 8 | #include <linux/types.h> |
7 | 9 | ||
10 | #include <drm/drm_connector.h> | ||
11 | #include <drm/drm_crtc.h> | ||
12 | |||
8 | struct drm_client_dev; | 13 | struct drm_client_dev; |
9 | struct drm_device; | 14 | struct drm_device; |
10 | struct drm_file; | 15 | struct drm_file; |
@@ -85,6 +90,16 @@ struct drm_client_dev { | |||
85 | * @file: DRM file | 90 | * @file: DRM file |
86 | */ | 91 | */ |
87 | struct drm_file *file; | 92 | struct drm_file *file; |
93 | |||
94 | /** | ||
95 | * @modeset_mutex: Protects @modesets. | ||
96 | */ | ||
97 | struct mutex modeset_mutex; | ||
98 | |||
99 | /** | ||
100 | * @modesets: CRTC configurations | ||
101 | */ | ||
102 | struct drm_mode_set *modesets; | ||
88 | }; | 103 | }; |
89 | 104 | ||
90 | int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, | 105 | int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, |
@@ -135,6 +150,37 @@ struct drm_client_buffer * | |||
135 | drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format); | 150 | drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format); |
136 | void drm_client_framebuffer_delete(struct drm_client_buffer *buffer); | 151 | void drm_client_framebuffer_delete(struct drm_client_buffer *buffer); |
137 | 152 | ||
153 | int drm_client_modeset_create(struct drm_client_dev *client); | ||
154 | void drm_client_modeset_free(struct drm_client_dev *client); | ||
155 | int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int height); | ||
156 | bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation); | ||
157 | int drm_client_modeset_commit_force(struct drm_client_dev *client); | ||
158 | int drm_client_modeset_commit(struct drm_client_dev *client); | ||
159 | int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); | ||
160 | |||
161 | /** | ||
162 | * drm_client_for_each_modeset() - Iterate over client modesets | ||
163 | * @modeset: &drm_mode_set loop cursor | ||
164 | * @client: DRM client | ||
165 | */ | ||
166 | #define drm_client_for_each_modeset(modeset, client) \ | ||
167 | for (({ lockdep_assert_held(&(client)->modeset_mutex); }), \ | ||
168 | modeset = (client)->modesets; modeset->crtc; modeset++) | ||
169 | |||
170 | /** | ||
171 | * drm_client_for_each_connector_iter - connector_list iterator macro | ||
172 | * @connector: &struct drm_connector pointer used as cursor | ||
173 | * @iter: &struct drm_connector_list_iter | ||
174 | * | ||
175 | * This iterates the connectors that are useable for internal clients (excludes | ||
176 | * writeback connectors). | ||
177 | * | ||
178 | * For more info see drm_for_each_connector_iter(). | ||
179 | */ | ||
180 | #define drm_client_for_each_connector_iter(connector, iter) \ | ||
181 | drm_for_each_connector_iter(connector, iter) \ | ||
182 | if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) | ||
183 | |||
138 | int drm_client_debugfs_init(struct drm_minor *minor); | 184 | int drm_client_debugfs_init(struct drm_minor *minor); |
139 | 185 | ||
140 | #endif | 186 | #endif |
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 02a131202add..ca745d9feaf5 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h | |||
@@ -464,13 +464,37 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, | |||
464 | unsigned int num_formats); | 464 | unsigned int num_formats); |
465 | 465 | ||
466 | /** | 466 | /** |
467 | * struct drm_connector_tv_margins - TV connector related margins | ||
468 | * | ||
469 | * Describes the margins in pixels to put around the image on TV | ||
470 | * connectors to deal with overscan. | ||
471 | */ | ||
472 | struct drm_connector_tv_margins { | ||
473 | /** | ||
474 | * @bottom: Bottom margin in pixels. | ||
475 | */ | ||
476 | unsigned int bottom; | ||
477 | |||
478 | /** | ||
479 | * @left: Left margin in pixels. | ||
480 | */ | ||
481 | unsigned int left; | ||
482 | |||
483 | /** | ||
484 | * @right: Right margin in pixels. | ||
485 | */ | ||
486 | unsigned int right; | ||
487 | |||
488 | /** | ||
489 | * @top: Top margin in pixels. | ||
490 | */ | ||
491 | unsigned int top; | ||
492 | }; | ||
493 | |||
494 | /** | ||
467 | * struct drm_tv_connector_state - TV connector related states | 495 | * struct drm_tv_connector_state - TV connector related states |
468 | * @subconnector: selected subconnector | 496 | * @subconnector: selected subconnector |
469 | * @margins: margins (all margins are expressed in pixels) | 497 | * @margins: TV margins |
470 | * @margins.left: left margin | ||
471 | * @margins.right: right margin | ||
472 | * @margins.top: top margin | ||
473 | * @margins.bottom: bottom margin | ||
474 | * @mode: TV mode | 498 | * @mode: TV mode |
475 | * @brightness: brightness in percent | 499 | * @brightness: brightness in percent |
476 | * @contrast: contrast in percent | 500 | * @contrast: contrast in percent |
@@ -481,12 +505,7 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, | |||
481 | */ | 505 | */ |
482 | struct drm_tv_connector_state { | 506 | struct drm_tv_connector_state { |
483 | enum drm_mode_subconnector subconnector; | 507 | enum drm_mode_subconnector subconnector; |
484 | struct { | 508 | struct drm_connector_tv_margins margins; |
485 | unsigned int left; | ||
486 | unsigned int right; | ||
487 | unsigned int top; | ||
488 | unsigned int bottom; | ||
489 | } margins; | ||
490 | unsigned int mode; | 509 | unsigned int mode; |
491 | unsigned int brightness; | 510 | unsigned int brightness; |
492 | unsigned int contrast; | 511 | unsigned int contrast; |
@@ -517,6 +536,15 @@ struct drm_connector_state { | |||
517 | * Used by the atomic helpers to select the encoder, through the | 536 | * Used by the atomic helpers to select the encoder, through the |
518 | * &drm_connector_helper_funcs.atomic_best_encoder or | 537 | * &drm_connector_helper_funcs.atomic_best_encoder or |
519 | * &drm_connector_helper_funcs.best_encoder callbacks. | 538 | * &drm_connector_helper_funcs.best_encoder callbacks. |
539 | * | ||
540 | * This is also used in the atomic helpers to map encoders to their | ||
541 | * current and previous connectors, see | ||
542 | * &drm_atomic_get_old_connector_for_encoder() and | ||
543 | * &drm_atomic_get_new_connector_for_encoder(). | ||
544 | * | ||
545 | * NOTE: Atomic drivers must fill this out (either themselves or through | ||
546 | * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will | ||
547 | * not return correct data to userspace. | ||
520 | */ | 548 | */ |
521 | struct drm_encoder *best_encoder; | 549 | struct drm_encoder *best_encoder; |
522 | 550 | ||
@@ -540,6 +568,20 @@ struct drm_connector_state { | |||
540 | struct drm_tv_connector_state tv; | 568 | struct drm_tv_connector_state tv; |
541 | 569 | ||
542 | /** | 570 | /** |
571 | * @self_refresh_aware: | ||
572 | * | ||
573 | * This tracks whether a connector is aware of the self refresh state. | ||
574 | * It should be set to true for those connector implementations which | ||
575 | * understand the self refresh state. This is needed since the crtc | ||
576 | * registers the self refresh helpers and it doesn't know if the | ||
577 | * connectors downstream have implemented self refresh entry/exit. | ||
578 | * | ||
579 | * Drivers should set this to true in atomic_check if they know how to | ||
580 | * handle self_refresh requests. | ||
581 | */ | ||
582 | bool self_refresh_aware; | ||
583 | |||
584 | /** | ||
543 | * @picture_aspect_ratio: Connector property to control the | 585 | * @picture_aspect_ratio: Connector property to control the |
544 | * HDMI infoframe aspect ratio setting. | 586 | * HDMI infoframe aspect ratio setting. |
545 | * | 587 | * |
@@ -599,6 +641,12 @@ struct drm_connector_state { | |||
599 | * and the connector bpc limitations obtained from edid. | 641 | * and the connector bpc limitations obtained from edid. |
600 | */ | 642 | */ |
601 | u8 max_bpc; | 643 | u8 max_bpc; |
644 | |||
645 | /** | ||
646 | * @hdr_output_metadata: | ||
647 | * DRM blob property for HDR output metadata | ||
648 | */ | ||
649 | struct drm_property_blob *hdr_output_metadata; | ||
602 | }; | 650 | }; |
603 | 651 | ||
604 | /** | 652 | /** |
@@ -894,19 +942,123 @@ struct drm_connector_funcs { | |||
894 | const struct drm_connector_state *state); | 942 | const struct drm_connector_state *state); |
895 | }; | 943 | }; |
896 | 944 | ||
897 | /* mode specified on the command line */ | 945 | /** |
946 | * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line | ||
947 | * | ||
948 | * Each connector can have an initial mode with additional options | ||
949 | * passed through the kernel command line. This structure allows to | ||
950 | * express those parameters and will be filled by the command-line | ||
951 | * parser. | ||
952 | */ | ||
898 | struct drm_cmdline_mode { | 953 | struct drm_cmdline_mode { |
954 | /** | ||
955 | * @name: | ||
956 | * | ||
957 | * Name of the mode. | ||
958 | */ | ||
959 | char name[DRM_DISPLAY_MODE_LEN]; | ||
960 | |||
961 | /** | ||
962 | * @specified: | ||
963 | * | ||
964 | * Has a mode been read from the command-line? | ||
965 | */ | ||
899 | bool specified; | 966 | bool specified; |
967 | |||
968 | /** | ||
969 | * @refresh_specified: | ||
970 | * | ||
971 | * Did the mode have a preferred refresh rate? | ||
972 | */ | ||
900 | bool refresh_specified; | 973 | bool refresh_specified; |
974 | |||
975 | /** | ||
976 | * @bpp_specified: | ||
977 | * | ||
978 | * Did the mode have a preferred BPP? | ||
979 | */ | ||
901 | bool bpp_specified; | 980 | bool bpp_specified; |
902 | int xres, yres; | 981 | |
982 | /** | ||
983 | * @xres: | ||
984 | * | ||
985 | * Active resolution on the X axis, in pixels. | ||
986 | */ | ||
987 | int xres; | ||
988 | |||
989 | /** | ||
990 | * @yres: | ||
991 | * | ||
992 | * Active resolution on the Y axis, in pixels. | ||
993 | */ | ||
994 | int yres; | ||
995 | |||
996 | /** | ||
997 | * @bpp: | ||
998 | * | ||
999 | * Bits per pixels for the mode. | ||
1000 | */ | ||
903 | int bpp; | 1001 | int bpp; |
1002 | |||
1003 | /** | ||
1004 | * @refresh: | ||
1005 | * | ||
1006 | * Refresh rate, in Hertz. | ||
1007 | */ | ||
904 | int refresh; | 1008 | int refresh; |
1009 | |||
1010 | /** | ||
1011 | * @rb: | ||
1012 | * | ||
1013 | * Do we need to use reduced blanking? | ||
1014 | */ | ||
905 | bool rb; | 1015 | bool rb; |
1016 | |||
1017 | /** | ||
1018 | * @interlace: | ||
1019 | * | ||
1020 | * The mode is interlaced. | ||
1021 | */ | ||
906 | bool interlace; | 1022 | bool interlace; |
1023 | |||
1024 | /** | ||
1025 | * @cvt: | ||
1026 | * | ||
1027 | * The timings will be calculated using the VESA Coordinated | ||
1028 | * Video Timings instead of looking up the mode from a table. | ||
1029 | */ | ||
907 | bool cvt; | 1030 | bool cvt; |
1031 | |||
1032 | /** | ||
1033 | * @margins: | ||
1034 | * | ||
1035 | * Add margins to the mode calculation (1.8% of xres rounded | ||
1036 | * down to 8 pixels and 1.8% of yres). | ||
1037 | */ | ||
908 | bool margins; | 1038 | bool margins; |
1039 | |||
1040 | /** | ||
1041 | * @force: | ||
1042 | * | ||
1043 | * Ignore the hotplug state of the connector, and force its | ||
1044 | * state to one of the DRM_FORCE_* values. | ||
1045 | */ | ||
909 | enum drm_connector_force force; | 1046 | enum drm_connector_force force; |
1047 | |||
1048 | /** | ||
1049 | * @rotation_reflection: | ||
1050 | * | ||
1051 | * Initial rotation and reflection of the mode setup from the | ||
1052 | * command line. See DRM_MODE_ROTATE_* and | ||
1053 | * DRM_MODE_REFLECT_*. The only rotations supported are | ||
1054 | * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180. | ||
1055 | */ | ||
1056 | unsigned int rotation_reflection; | ||
1057 | |||
1058 | /** | ||
1059 | * @tv_margins: TV margins to apply to the mode. | ||
1060 | */ | ||
1061 | struct drm_connector_tv_margins tv_margins; | ||
910 | }; | 1062 | }; |
911 | 1063 | ||
912 | /** | 1064 | /** |
@@ -1062,12 +1214,6 @@ struct drm_connector { | |||
1062 | struct drm_property *vrr_capable_property; | 1214 | struct drm_property *vrr_capable_property; |
1063 | 1215 | ||
1064 | /** | 1216 | /** |
1065 | * @content_protection_property: DRM ENUM property for content | ||
1066 | * protection. See drm_connector_attach_content_protection_property(). | ||
1067 | */ | ||
1068 | struct drm_property *content_protection_property; | ||
1069 | |||
1070 | /** | ||
1071 | * @colorspace_property: Connector property to set the suitable | 1217 | * @colorspace_property: Connector property to set the suitable |
1072 | * colorspace supported by the sink. | 1218 | * colorspace supported by the sink. |
1073 | */ | 1219 | */ |
@@ -1239,6 +1385,9 @@ struct drm_connector { | |||
1239 | * &drm_mode_config.connector_free_work. | 1385 | * &drm_mode_config.connector_free_work. |
1240 | */ | 1386 | */ |
1241 | struct llist_node free_node; | 1387 | struct llist_node free_node; |
1388 | |||
1389 | /** @hdr_sink_metadata: HDR Metadata Information read from sink */ | ||
1390 | struct hdr_sink_metadata hdr_sink_metadata; | ||
1242 | }; | 1391 | }; |
1243 | 1392 | ||
1244 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) | 1393 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) |
@@ -1345,8 +1494,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, | |||
1345 | u32 scaling_mode_mask); | 1494 | u32 scaling_mode_mask); |
1346 | int drm_connector_attach_vrr_capable_property( | 1495 | int drm_connector_attach_vrr_capable_property( |
1347 | struct drm_connector *connector); | 1496 | struct drm_connector *connector); |
1348 | int drm_connector_attach_content_protection_property( | ||
1349 | struct drm_connector *connector); | ||
1350 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); | 1497 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
1351 | int drm_mode_create_colorspace_property(struct drm_connector *connector); | 1498 | int drm_mode_create_colorspace_property(struct drm_connector *connector); |
1352 | int drm_mode_create_content_type_property(struct drm_device *dev); | 1499 | int drm_mode_create_content_type_property(struct drm_device *dev); |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 58ad983d7cd6..128d8b210621 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <drm/drm_framebuffer.h> | 39 | #include <drm/drm_framebuffer.h> |
40 | #include <drm/drm_modes.h> | 40 | #include <drm/drm_modes.h> |
41 | #include <drm/drm_connector.h> | 41 | #include <drm/drm_connector.h> |
42 | #include <drm/drm_device.h> | ||
42 | #include <drm/drm_property.h> | 43 | #include <drm/drm_property.h> |
43 | #include <drm/drm_bridge.h> | 44 | #include <drm/drm_bridge.h> |
44 | #include <drm/drm_edid.h> | 45 | #include <drm/drm_edid.h> |
@@ -53,6 +54,7 @@ struct drm_mode_set; | |||
53 | struct drm_file; | 54 | struct drm_file; |
54 | struct drm_clip_rect; | 55 | struct drm_clip_rect; |
55 | struct drm_printer; | 56 | struct drm_printer; |
57 | struct drm_self_refresh_data; | ||
56 | struct device_node; | 58 | struct device_node; |
57 | struct dma_fence; | 59 | struct dma_fence; |
58 | struct edid; | 60 | struct edid; |
@@ -300,6 +302,17 @@ struct drm_crtc_state { | |||
300 | bool vrr_enabled; | 302 | bool vrr_enabled; |
301 | 303 | ||
302 | /** | 304 | /** |
305 | * @self_refresh_active: | ||
306 | * | ||
307 | * Used by the self refresh helpers to denote when a self refresh | ||
308 | * transition is occurring. This will be set on enable/disable callbacks | ||
309 | * when self refresh is being enabled or disabled. In some cases, it may | ||
310 | * not be desirable to fully shut off the crtc during self refresh. | ||
311 | * CRTC's can inspect this flag and determine the best course of action. | ||
312 | */ | ||
313 | bool self_refresh_active; | ||
314 | |||
315 | /** | ||
303 | * @event: | 316 | * @event: |
304 | * | 317 | * |
305 | * Optional pointer to a DRM event to signal upon completion of the | 318 | * Optional pointer to a DRM event to signal upon completion of the |
@@ -1087,6 +1100,13 @@ struct drm_crtc { | |||
1087 | * The name of the CRTC's fence timeline. | 1100 | * The name of the CRTC's fence timeline. |
1088 | */ | 1101 | */ |
1089 | char timeline_name[32]; | 1102 | char timeline_name[32]; |
1103 | |||
1104 | /** | ||
1105 | * @self_refresh_data: Holds the state for the self refresh helpers | ||
1106 | * | ||
1107 | * Initialized via drm_self_refresh_helper_register(). | ||
1108 | */ | ||
1109 | struct drm_self_refresh_data *self_refresh_data; | ||
1090 | }; | 1110 | }; |
1091 | 1111 | ||
1092 | /** | 1112 | /** |
diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h index ac0f75df1ac9..7501e323d383 100644 --- a/include/drm/drm_debugfs.h +++ b/include/drm/drm_debugfs.h | |||
@@ -32,6 +32,8 @@ | |||
32 | #ifndef _DRM_DEBUGFS_H_ | 32 | #ifndef _DRM_DEBUGFS_H_ |
33 | #define _DRM_DEBUGFS_H_ | 33 | #define _DRM_DEBUGFS_H_ |
34 | 34 | ||
35 | #include <linux/types.h> | ||
36 | #include <linux/seq_file.h> | ||
35 | /** | 37 | /** |
36 | * struct drm_info_list - debugfs info list entry | 38 | * struct drm_info_list - debugfs info list entry |
37 | * | 39 | * |
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index 7f9ef709b2b6..1acfc3bbd3fb 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h | |||
@@ -17,6 +17,7 @@ struct drm_vblank_crtc; | |||
17 | struct drm_sg_mem; | 17 | struct drm_sg_mem; |
18 | struct drm_local_map; | 18 | struct drm_local_map; |
19 | struct drm_vma_offset_manager; | 19 | struct drm_vma_offset_manager; |
20 | struct drm_vram_mm; | ||
20 | struct drm_fb_helper; | 21 | struct drm_fb_helper; |
21 | 22 | ||
22 | struct inode; | 23 | struct inode; |
@@ -286,6 +287,9 @@ struct drm_device { | |||
286 | /** @vma_offset_manager: GEM information */ | 287 | /** @vma_offset_manager: GEM information */ |
287 | struct drm_vma_offset_manager *vma_offset_manager; | 288 | struct drm_vma_offset_manager *vma_offset_manager; |
288 | 289 | ||
290 | /** @vram_mm: VRAM MM memory manager */ | ||
291 | struct drm_vram_mm *vram_mm; | ||
292 | |||
289 | /** | 293 | /** |
290 | * @switch_power_state: | 294 | * @switch_power_state: |
291 | * | 295 | * |
diff --git a/include/drm/drm_displayid.h b/include/drm/drm_displayid.h index c0d4df6a606f..9d3b745c3107 100644 --- a/include/drm/drm_displayid.h +++ b/include/drm/drm_displayid.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #define DATA_BLOCK_DISPLAY_INTERFACE 0x0f | 40 | #define DATA_BLOCK_DISPLAY_INTERFACE 0x0f |
41 | #define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10 | 41 | #define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10 |
42 | #define DATA_BLOCK_TILED_DISPLAY 0x12 | 42 | #define DATA_BLOCK_TILED_DISPLAY 0x12 |
43 | #define DATA_BLOCK_CTA 0x81 | ||
43 | 44 | ||
44 | #define DATA_BLOCK_VENDOR_SPECIFIC 0x7f | 45 | #define DATA_BLOCK_VENDOR_SPECIFIC 0x7f |
45 | 46 | ||
@@ -90,4 +91,13 @@ struct displayid_detailed_timing_block { | |||
90 | struct displayid_block base; | 91 | struct displayid_block base; |
91 | struct displayid_detailed_timings_1 timings[0]; | 92 | struct displayid_detailed_timings_1 timings[0]; |
92 | }; | 93 | }; |
94 | |||
95 | #define for_each_displayid_db(displayid, block, idx, length) \ | ||
96 | for ((block) = (struct displayid_block *)&(displayid)[idx]; \ | ||
97 | (idx) + sizeof(struct displayid_block) <= (length) && \ | ||
98 | (idx) + sizeof(struct displayid_block) + (block)->num_bytes <= (length) && \ | ||
99 | (block)->num_bytes > 0; \ | ||
100 | (idx) += (block)->num_bytes + sizeof(struct displayid_block), \ | ||
101 | (block) = (struct displayid_block *)&(displayid)[idx]) | ||
102 | |||
93 | #endif | 103 | #endif |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 97ce790a5b5a..397896b5b21a 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
@@ -249,6 +249,7 @@ | |||
249 | #define DP_DSC_PEAK_THROUGHPUT 0x06B | 249 | #define DP_DSC_PEAK_THROUGHPUT 0x06B |
250 | # define DP_DSC_THROUGHPUT_MODE_0_MASK (0xf << 0) | 250 | # define DP_DSC_THROUGHPUT_MODE_0_MASK (0xf << 0) |
251 | # define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0 | 251 | # define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0 |
252 | # define DP_DSC_THROUGHPUT_MODE_0_UPSUPPORTED 0 | ||
252 | # define DP_DSC_THROUGHPUT_MODE_0_340 (1 << 0) | 253 | # define DP_DSC_THROUGHPUT_MODE_0_340 (1 << 0) |
253 | # define DP_DSC_THROUGHPUT_MODE_0_400 (2 << 0) | 254 | # define DP_DSC_THROUGHPUT_MODE_0_400 (2 << 0) |
254 | # define DP_DSC_THROUGHPUT_MODE_0_450 (3 << 0) | 255 | # define DP_DSC_THROUGHPUT_MODE_0_450 (3 << 0) |
@@ -263,8 +264,10 @@ | |||
263 | # define DP_DSC_THROUGHPUT_MODE_0_900 (12 << 0) | 264 | # define DP_DSC_THROUGHPUT_MODE_0_900 (12 << 0) |
264 | # define DP_DSC_THROUGHPUT_MODE_0_950 (13 << 0) | 265 | # define DP_DSC_THROUGHPUT_MODE_0_950 (13 << 0) |
265 | # define DP_DSC_THROUGHPUT_MODE_0_1000 (14 << 0) | 266 | # define DP_DSC_THROUGHPUT_MODE_0_1000 (14 << 0) |
267 | # define DP_DSC_THROUGHPUT_MODE_0_170 (15 << 4) | ||
266 | # define DP_DSC_THROUGHPUT_MODE_1_MASK (0xf << 4) | 268 | # define DP_DSC_THROUGHPUT_MODE_1_MASK (0xf << 4) |
267 | # define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4 | 269 | # define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4 |
270 | # define DP_DSC_THROUGHPUT_MODE_1_UPSUPPORTED 0 | ||
268 | # define DP_DSC_THROUGHPUT_MODE_1_340 (1 << 4) | 271 | # define DP_DSC_THROUGHPUT_MODE_1_340 (1 << 4) |
269 | # define DP_DSC_THROUGHPUT_MODE_1_400 (2 << 4) | 272 | # define DP_DSC_THROUGHPUT_MODE_1_400 (2 << 4) |
270 | # define DP_DSC_THROUGHPUT_MODE_1_450 (3 << 4) | 273 | # define DP_DSC_THROUGHPUT_MODE_1_450 (3 << 4) |
@@ -279,6 +282,7 @@ | |||
279 | # define DP_DSC_THROUGHPUT_MODE_1_900 (12 << 4) | 282 | # define DP_DSC_THROUGHPUT_MODE_1_900 (12 << 4) |
280 | # define DP_DSC_THROUGHPUT_MODE_1_950 (13 << 4) | 283 | # define DP_DSC_THROUGHPUT_MODE_1_950 (13 << 4) |
281 | # define DP_DSC_THROUGHPUT_MODE_1_1000 (14 << 4) | 284 | # define DP_DSC_THROUGHPUT_MODE_1_1000 (14 << 4) |
285 | # define DP_DSC_THROUGHPUT_MODE_1_170 (15 << 4) | ||
282 | 286 | ||
283 | #define DP_DSC_MAX_SLICE_WIDTH 0x06C | 287 | #define DP_DSC_MAX_SLICE_WIDTH 0x06C |
284 | #define DP_DSC_MIN_SLICE_WIDTH_VALUE 2560 | 288 | #define DP_DSC_MIN_SLICE_WIDTH_VALUE 2560 |
@@ -352,6 +356,11 @@ | |||
352 | # define DP_FEC_CORR_BLK_ERROR_COUNT_CAP (1 << 2) | 356 | # define DP_FEC_CORR_BLK_ERROR_COUNT_CAP (1 << 2) |
353 | # define DP_FEC_BIT_ERROR_COUNT_CAP (1 << 3) | 357 | # define DP_FEC_BIT_ERROR_COUNT_CAP (1 << 3) |
354 | 358 | ||
359 | /* DP Extended DSC Capabilities */ | ||
360 | #define DP_DSC_BRANCH_OVERALL_THROUGHPUT_0 0x0a0 /* DP 1.4a SCR */ | ||
361 | #define DP_DSC_BRANCH_OVERALL_THROUGHPUT_1 0x0a1 | ||
362 | #define DP_DSC_BRANCH_MAX_LINE_WIDTH 0x0a2 | ||
363 | |||
355 | /* link configuration */ | 364 | /* link configuration */ |
356 | #define DP_LINK_BW_SET 0x100 | 365 | #define DP_LINK_BW_SET 0x100 |
357 | # define DP_LINK_RATE_TABLE 0x00 /* eDP 1.4 */ | 366 | # define DP_LINK_RATE_TABLE 0x00 /* eDP 1.4 */ |
@@ -1083,17 +1092,30 @@ struct dp_sdp_header { | |||
1083 | #define EDP_SDP_HEADER_VALID_PAYLOAD_BYTES 0x1F | 1092 | #define EDP_SDP_HEADER_VALID_PAYLOAD_BYTES 0x1F |
1084 | #define DP_SDP_PPS_HEADER_PAYLOAD_BYTES_MINUS_1 0x7F | 1093 | #define DP_SDP_PPS_HEADER_PAYLOAD_BYTES_MINUS_1 0x7F |
1085 | 1094 | ||
1086 | struct edp_vsc_psr { | 1095 | /** |
1096 | * struct dp_sdp - DP secondary data packet | ||
1097 | * @sdp_header: DP secondary data packet header | ||
1098 | * @db: DP secondaray data packet data blocks | ||
1099 | * VSC SDP Payload for PSR | ||
1100 | * db[0]: Stereo Interface | ||
1101 | * db[1]: 0 - PSR State; 1 - Update RFB; 2 - CRC Valid | ||
1102 | * db[2]: CRC value bits 7:0 of the R or Cr component | ||
1103 | * db[3]: CRC value bits 15:8 of the R or Cr component | ||
1104 | * db[4]: CRC value bits 7:0 of the G or Y component | ||
1105 | * db[5]: CRC value bits 15:8 of the G or Y component | ||
1106 | * db[6]: CRC value bits 7:0 of the B or Cb component | ||
1107 | * db[7]: CRC value bits 15:8 of the B or Cb component | ||
1108 | * db[8] - db[31]: Reserved | ||
1109 | * VSC SDP Payload for Pixel Encoding/Colorimetry Format | ||
1110 | * db[0] - db[15]: Reserved | ||
1111 | * db[16]: Pixel Encoding and Colorimetry Formats | ||
1112 | * db[17]: Dynamic Range and Component Bit Depth | ||
1113 | * db[18]: Content Type | ||
1114 | * db[19] - db[31]: Reserved | ||
1115 | */ | ||
1116 | struct dp_sdp { | ||
1087 | struct dp_sdp_header sdp_header; | 1117 | struct dp_sdp_header sdp_header; |
1088 | u8 DB0; /* Stereo Interface */ | 1118 | u8 db[32]; |
1089 | u8 DB1; /* 0 - PSR State; 1 - Update RFB; 2 - CRC Valid */ | ||
1090 | u8 DB2; /* CRC value bits 7:0 of the R or Cr component */ | ||
1091 | u8 DB3; /* CRC value bits 15:8 of the R or Cr component */ | ||
1092 | u8 DB4; /* CRC value bits 7:0 of the G or Y component */ | ||
1093 | u8 DB5; /* CRC value bits 15:8 of the G or Y component */ | ||
1094 | u8 DB6; /* CRC value bits 7:0 of the B or Cb component */ | ||
1095 | u8 DB7; /* CRC value bits 15:8 of the B or Cb component */ | ||
1096 | u8 DB8_31[24]; /* Reserved */ | ||
1097 | } __packed; | 1119 | } __packed; |
1098 | 1120 | ||
1099 | #define EDP_VSC_PSR_STATE_ACTIVE (1<<0) | 1121 | #define EDP_VSC_PSR_STATE_ACTIVE (1<<0) |
@@ -1401,6 +1423,13 @@ enum drm_dp_quirk { | |||
1401 | * driver still need to implement proper handling for such device. | 1423 | * driver still need to implement proper handling for such device. |
1402 | */ | 1424 | */ |
1403 | DP_DPCD_QUIRK_NO_PSR, | 1425 | DP_DPCD_QUIRK_NO_PSR, |
1426 | /** | ||
1427 | * @DP_DPCD_QUIRK_NO_SINK_COUNT: | ||
1428 | * | ||
1429 | * The device does not set SINK_COUNT to a non-zero value. | ||
1430 | * The driver should ignore SINK_COUNT during detection. | ||
1431 | */ | ||
1432 | DP_DPCD_QUIRK_NO_SINK_COUNT, | ||
1404 | }; | 1433 | }; |
1405 | 1434 | ||
1406 | /** | 1435 | /** |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index c9ca0be54d9a..b9719418c3d2 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/hdmi.h> | 27 | #include <linux/hdmi.h> |
28 | #include <drm/drm_mode.h> | ||
28 | 29 | ||
29 | struct drm_device; | 30 | struct drm_device; |
30 | struct i2c_adapter; | 31 | struct i2c_adapter; |
@@ -176,21 +177,23 @@ struct detailed_timing { | |||
176 | #define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4) | 177 | #define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4) |
177 | #define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5) | 178 | #define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5) |
178 | #define DRM_EDID_INPUT_DIGITAL (1 << 7) | 179 | #define DRM_EDID_INPUT_DIGITAL (1 << 7) |
179 | #define DRM_EDID_DIGITAL_DEPTH_MASK (7 << 4) | 180 | #define DRM_EDID_DIGITAL_DEPTH_MASK (7 << 4) /* 1.4 */ |
180 | #define DRM_EDID_DIGITAL_DEPTH_UNDEF (0 << 4) | 181 | #define DRM_EDID_DIGITAL_DEPTH_UNDEF (0 << 4) /* 1.4 */ |
181 | #define DRM_EDID_DIGITAL_DEPTH_6 (1 << 4) | 182 | #define DRM_EDID_DIGITAL_DEPTH_6 (1 << 4) /* 1.4 */ |
182 | #define DRM_EDID_DIGITAL_DEPTH_8 (2 << 4) | 183 | #define DRM_EDID_DIGITAL_DEPTH_8 (2 << 4) /* 1.4 */ |
183 | #define DRM_EDID_DIGITAL_DEPTH_10 (3 << 4) | 184 | #define DRM_EDID_DIGITAL_DEPTH_10 (3 << 4) /* 1.4 */ |
184 | #define DRM_EDID_DIGITAL_DEPTH_12 (4 << 4) | 185 | #define DRM_EDID_DIGITAL_DEPTH_12 (4 << 4) /* 1.4 */ |
185 | #define DRM_EDID_DIGITAL_DEPTH_14 (5 << 4) | 186 | #define DRM_EDID_DIGITAL_DEPTH_14 (5 << 4) /* 1.4 */ |
186 | #define DRM_EDID_DIGITAL_DEPTH_16 (6 << 4) | 187 | #define DRM_EDID_DIGITAL_DEPTH_16 (6 << 4) /* 1.4 */ |
187 | #define DRM_EDID_DIGITAL_DEPTH_RSVD (7 << 4) | 188 | #define DRM_EDID_DIGITAL_DEPTH_RSVD (7 << 4) /* 1.4 */ |
188 | #define DRM_EDID_DIGITAL_TYPE_UNDEF (0) | 189 | #define DRM_EDID_DIGITAL_TYPE_MASK (7 << 0) /* 1.4 */ |
189 | #define DRM_EDID_DIGITAL_TYPE_DVI (1) | 190 | #define DRM_EDID_DIGITAL_TYPE_UNDEF (0 << 0) /* 1.4 */ |
190 | #define DRM_EDID_DIGITAL_TYPE_HDMI_A (2) | 191 | #define DRM_EDID_DIGITAL_TYPE_DVI (1 << 0) /* 1.4 */ |
191 | #define DRM_EDID_DIGITAL_TYPE_HDMI_B (3) | 192 | #define DRM_EDID_DIGITAL_TYPE_HDMI_A (2 << 0) /* 1.4 */ |
192 | #define DRM_EDID_DIGITAL_TYPE_MDDI (4) | 193 | #define DRM_EDID_DIGITAL_TYPE_HDMI_B (3 << 0) /* 1.4 */ |
193 | #define DRM_EDID_DIGITAL_TYPE_DP (5) | 194 | #define DRM_EDID_DIGITAL_TYPE_MDDI (4 << 0) /* 1.4 */ |
195 | #define DRM_EDID_DIGITAL_TYPE_DP (5 << 0) /* 1.4 */ | ||
196 | #define DRM_EDID_DIGITAL_DFP_1_X (1 << 0) /* 1.3 */ | ||
194 | 197 | ||
195 | #define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) | 198 | #define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) |
196 | #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) | 199 | #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) |
@@ -370,6 +373,10 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, | |||
370 | const struct drm_display_mode *mode, | 373 | const struct drm_display_mode *mode, |
371 | enum hdmi_quantization_range rgb_quant_range); | 374 | enum hdmi_quantization_range rgb_quant_range); |
372 | 375 | ||
376 | int | ||
377 | drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame, | ||
378 | const struct drm_connector_state *conn_state); | ||
379 | |||
373 | /** | 380 | /** |
374 | * drm_eld_mnl - Get ELD monitor name length in bytes. | 381 | * drm_eld_mnl - Get ELD monitor name length in bytes. |
375 | * @eld: pointer to an eld memory structure with mnl set | 382 | * @eld: pointer to an eld memory structure with mnl set |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 40af2866c26a..c8a8ae2a678a 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
@@ -43,17 +43,6 @@ enum mode_set_atomic { | |||
43 | ENTER_ATOMIC_MODE_SET, | 43 | ENTER_ATOMIC_MODE_SET, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct drm_fb_offset { | ||
47 | int x, y; | ||
48 | }; | ||
49 | |||
50 | struct drm_fb_helper_crtc { | ||
51 | struct drm_mode_set mode_set; | ||
52 | struct drm_display_mode *desired_mode; | ||
53 | int x, y; | ||
54 | int rotation; | ||
55 | }; | ||
56 | |||
57 | /** | 46 | /** |
58 | * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size | 47 | * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size |
59 | * @fb_width: fbdev width | 48 | * @fb_width: fbdev width |
@@ -104,18 +93,10 @@ struct drm_fb_helper_funcs { | |||
104 | struct drm_fb_helper_surface_size *sizes); | 93 | struct drm_fb_helper_surface_size *sizes); |
105 | }; | 94 | }; |
106 | 95 | ||
107 | struct drm_fb_helper_connector { | ||
108 | struct drm_connector *connector; | ||
109 | }; | ||
110 | |||
111 | /** | 96 | /** |
112 | * struct drm_fb_helper - main structure to emulate fbdev on top of KMS | 97 | * struct drm_fb_helper - main structure to emulate fbdev on top of KMS |
113 | * @fb: Scanout framebuffer object | 98 | * @fb: Scanout framebuffer object |
114 | * @dev: DRM device | 99 | * @dev: DRM device |
115 | * @crtc_count: number of possible CRTCs | ||
116 | * @crtc_info: per-CRTC helper state (mode, x/y offset, etc) | ||
117 | * @connector_count: number of connected connectors | ||
118 | * @connector_info_alloc_count: size of connector_info | ||
119 | * @funcs: driver callbacks for fb helper | 100 | * @funcs: driver callbacks for fb helper |
120 | * @fbdev: emulated fbdev device info struct | 101 | * @fbdev: emulated fbdev device info struct |
121 | * @pseudo_palette: fake palette of 16 colors | 102 | * @pseudo_palette: fake palette of 16 colors |
@@ -147,24 +128,6 @@ struct drm_fb_helper { | |||
147 | 128 | ||
148 | struct drm_framebuffer *fb; | 129 | struct drm_framebuffer *fb; |
149 | struct drm_device *dev; | 130 | struct drm_device *dev; |
150 | int crtc_count; | ||
151 | struct drm_fb_helper_crtc *crtc_info; | ||
152 | int connector_count; | ||
153 | int connector_info_alloc_count; | ||
154 | /** | ||
155 | * @sw_rotations: | ||
156 | * Bitmask of all rotations requested for panel-orientation which | ||
157 | * could not be handled in hardware. If only one bit is set | ||
158 | * fbdev->fbcon_rotate_hint gets set to the requested rotation. | ||
159 | */ | ||
160 | int sw_rotations; | ||
161 | /** | ||
162 | * @connector_info: | ||
163 | * | ||
164 | * Array of per-connector information. Do not iterate directly, but use | ||
165 | * drm_fb_helper_for_each_connector. | ||
166 | */ | ||
167 | struct drm_fb_helper_connector **connector_info; | ||
168 | const struct drm_fb_helper_funcs *funcs; | 131 | const struct drm_fb_helper_funcs *funcs; |
169 | struct fb_info *fbdev; | 132 | struct fb_info *fbdev; |
170 | u32 pseudo_palette[17]; | 133 | u32 pseudo_palette[17]; |
@@ -304,18 +267,8 @@ int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd, | |||
304 | 267 | ||
305 | int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); | 268 | int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); |
306 | int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); | 269 | int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); |
307 | int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); | ||
308 | int drm_fb_helper_debug_enter(struct fb_info *info); | 270 | int drm_fb_helper_debug_enter(struct fb_info *info); |
309 | int drm_fb_helper_debug_leave(struct fb_info *info); | 271 | int drm_fb_helper_debug_leave(struct fb_info *info); |
310 | struct drm_display_mode * | ||
311 | drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, | ||
312 | int width, int height); | ||
313 | struct drm_display_mode * | ||
314 | drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn); | ||
315 | |||
316 | int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); | ||
317 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | ||
318 | struct drm_connector *connector); | ||
319 | 272 | ||
320 | int drm_fb_helper_fbdev_setup(struct drm_device *dev, | 273 | int drm_fb_helper_fbdev_setup(struct drm_device *dev, |
321 | struct drm_fb_helper *fb_helper, | 274 | struct drm_fb_helper *fb_helper, |
@@ -490,12 +443,6 @@ static inline int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, | |||
490 | return 0; | 443 | return 0; |
491 | } | 444 | } |
492 | 445 | ||
493 | static inline int | ||
494 | drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) | ||
495 | { | ||
496 | return 0; | ||
497 | } | ||
498 | |||
499 | static inline int drm_fb_helper_debug_enter(struct fb_info *info) | 446 | static inline int drm_fb_helper_debug_enter(struct fb_info *info) |
500 | { | 447 | { |
501 | return 0; | 448 | return 0; |
@@ -506,34 +453,6 @@ static inline int drm_fb_helper_debug_leave(struct fb_info *info) | |||
506 | return 0; | 453 | return 0; |
507 | } | 454 | } |
508 | 455 | ||
509 | static inline struct drm_display_mode * | ||
510 | drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, | ||
511 | int width, int height) | ||
512 | { | ||
513 | return NULL; | ||
514 | } | ||
515 | |||
516 | static inline struct drm_display_mode * | ||
517 | drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, | ||
518 | int width, int height) | ||
519 | { | ||
520 | return NULL; | ||
521 | } | ||
522 | |||
523 | static inline int | ||
524 | drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, | ||
525 | struct drm_connector *connector) | ||
526 | { | ||
527 | return 0; | ||
528 | } | ||
529 | |||
530 | static inline int | ||
531 | drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | ||
532 | struct drm_connector *connector) | ||
533 | { | ||
534 | return 0; | ||
535 | } | ||
536 | |||
537 | static inline int | 456 | static inline int |
538 | drm_fb_helper_fbdev_setup(struct drm_device *dev, | 457 | drm_fb_helper_fbdev_setup(struct drm_device *dev, |
539 | struct drm_fb_helper *fb_helper, | 458 | struct drm_fb_helper *fb_helper, |
@@ -575,6 +494,27 @@ drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp) | |||
575 | 494 | ||
576 | #endif | 495 | #endif |
577 | 496 | ||
497 | /* TODO: There's a todo entry to remove these three */ | ||
498 | static inline int | ||
499 | drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) | ||
500 | { | ||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | static inline int | ||
505 | drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, | ||
506 | struct drm_connector *connector) | ||
507 | { | ||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | static inline int | ||
512 | drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | ||
513 | struct drm_connector *connector) | ||
514 | { | ||
515 | return 0; | ||
516 | } | ||
517 | |||
578 | /** | 518 | /** |
579 | * drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers | 519 | * drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers |
580 | * @a: memory range, users of which are to be removed | 520 | * @a: memory range, users of which are to be removed |
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index b3d9d88ab290..306d1efeb5e0 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h | |||
@@ -260,6 +260,50 @@ drm_format_info_is_yuv_sampling_444(const struct drm_format_info *info) | |||
260 | return info->is_yuv && info->hsub == 1 && info->vsub == 1; | 260 | return info->is_yuv && info->hsub == 1 && info->vsub == 1; |
261 | } | 261 | } |
262 | 262 | ||
263 | /** | ||
264 | * drm_format_info_plane_width - width of the plane given the first plane | ||
265 | * @info: pixel format info | ||
266 | * @width: width of the first plane | ||
267 | * @plane: plane index | ||
268 | * | ||
269 | * Returns: | ||
270 | * The width of @plane, given that the width of the first plane is @width. | ||
271 | */ | ||
272 | static inline | ||
273 | int drm_format_info_plane_width(const struct drm_format_info *info, int width, | ||
274 | int plane) | ||
275 | { | ||
276 | if (!info || plane >= info->num_planes) | ||
277 | return 0; | ||
278 | |||
279 | if (plane == 0) | ||
280 | return width; | ||
281 | |||
282 | return width / info->hsub; | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * drm_format_info_plane_height - height of the plane given the first plane | ||
287 | * @info: pixel format info | ||
288 | * @height: height of the first plane | ||
289 | * @plane: plane index | ||
290 | * | ||
291 | * Returns: | ||
292 | * The height of @plane, given that the height of the first plane is @height. | ||
293 | */ | ||
294 | static inline | ||
295 | int drm_format_info_plane_height(const struct drm_format_info *info, int height, | ||
296 | int plane) | ||
297 | { | ||
298 | if (!info || plane >= info->num_planes) | ||
299 | return 0; | ||
300 | |||
301 | if (plane == 0) | ||
302 | return height; | ||
303 | |||
304 | return height / info->vsub; | ||
305 | } | ||
306 | |||
263 | const struct drm_format_info *__drm_format_info(u32 format); | 307 | const struct drm_format_info *__drm_format_info(u32 format); |
264 | const struct drm_format_info *drm_format_info(u32 format); | 308 | const struct drm_format_info *drm_format_info(u32 format); |
265 | const struct drm_format_info * | 309 | const struct drm_format_info * |
@@ -268,12 +312,6 @@ drm_get_format_info(struct drm_device *dev, | |||
268 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); | 312 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); |
269 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, | 313 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, |
270 | uint32_t bpp, uint32_t depth); | 314 | uint32_t bpp, uint32_t depth); |
271 | int drm_format_num_planes(uint32_t format); | ||
272 | int drm_format_plane_cpp(uint32_t format, int plane); | ||
273 | int drm_format_horz_chroma_subsampling(uint32_t format); | ||
274 | int drm_format_vert_chroma_subsampling(uint32_t format); | ||
275 | int drm_format_plane_width(int width, uint32_t format, int plane); | ||
276 | int drm_format_plane_height(int height, uint32_t format, int plane); | ||
277 | unsigned int drm_format_info_block_width(const struct drm_format_info *info, | 315 | unsigned int drm_format_info_block_width(const struct drm_format_info *info, |
278 | int plane); | 316 | int plane); |
279 | unsigned int drm_format_info_block_height(const struct drm_format_info *info, | 317 | unsigned int drm_format_info_block_height(const struct drm_format_info *info, |
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index c23016748e3f..c0e0256e3e98 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h | |||
@@ -87,6 +87,9 @@ struct drm_framebuffer_funcs { | |||
87 | * for more information as all the semantics and arguments have a one to | 87 | * for more information as all the semantics and arguments have a one to |
88 | * one mapping on this function. | 88 | * one mapping on this function. |
89 | * | 89 | * |
90 | * Atomic drivers should use drm_atomic_helper_dirtyfb() to implement | ||
91 | * this hook. | ||
92 | * | ||
90 | * RETURNS: | 93 | * RETURNS: |
91 | * | 94 | * |
92 | * 0 on success or a negative error code on failure. | 95 | * 0 on success or a negative error code on failure. |
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 5047c7ee25f5..a9121fe66ea2 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h | |||
@@ -401,9 +401,4 @@ int drm_gem_dumb_destroy(struct drm_file *file, | |||
401 | struct drm_device *dev, | 401 | struct drm_device *dev, |
402 | uint32_t handle); | 402 | uint32_t handle); |
403 | 403 | ||
404 | int drm_gem_pin(struct drm_gem_object *obj); | ||
405 | void drm_gem_unpin(struct drm_gem_object *obj); | ||
406 | void *drm_gem_vmap(struct drm_gem_object *obj); | ||
407 | void drm_gem_vunmap(struct drm_gem_object *obj, void *vaddr); | ||
408 | |||
409 | #endif /* __DRM_GEM_H__ */ | 404 | #endif /* __DRM_GEM_H__ */ |
diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h new file mode 100644 index 000000000000..9581ea0a4f7e --- /dev/null +++ b/include/drm/drm_gem_vram_helper.h | |||
@@ -0,0 +1,153 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
2 | |||
3 | #ifndef DRM_GEM_VRAM_HELPER_H | ||
4 | #define DRM_GEM_VRAM_HELPER_H | ||
5 | |||
6 | #include <drm/drm_gem.h> | ||
7 | #include <drm/ttm/ttm_bo_api.h> | ||
8 | #include <drm/ttm/ttm_placement.h> | ||
9 | #include <linux/kernel.h> /* for container_of() */ | ||
10 | |||
11 | struct drm_mode_create_dumb; | ||
12 | struct drm_vram_mm_funcs; | ||
13 | struct filp; | ||
14 | struct vm_area_struct; | ||
15 | |||
16 | #define DRM_GEM_VRAM_PL_FLAG_VRAM TTM_PL_FLAG_VRAM | ||
17 | #define DRM_GEM_VRAM_PL_FLAG_SYSTEM TTM_PL_FLAG_SYSTEM | ||
18 | |||
19 | /* | ||
20 | * Buffer-object helpers | ||
21 | */ | ||
22 | |||
23 | /** | ||
24 | * struct drm_gem_vram_object - GEM object backed by VRAM | ||
25 | * @gem: GEM object | ||
26 | * @bo: TTM buffer object | ||
27 | * @kmap: Mapping information for @bo | ||
28 | * @placement: TTM placement information. Supported placements are \ | ||
29 | %TTM_PL_VRAM and %TTM_PL_SYSTEM | ||
30 | * @placements: TTM placement information. | ||
31 | * @pin_count: Pin counter | ||
32 | * | ||
33 | * The type struct drm_gem_vram_object represents a GEM object that is | ||
34 | * backed by VRAM. It can be used for simple framebuffer devices with | ||
35 | * dedicated memory. The buffer object can be evicted to system memory if | ||
36 | * video memory becomes scarce. | ||
37 | */ | ||
38 | struct drm_gem_vram_object { | ||
39 | struct drm_gem_object gem; | ||
40 | struct ttm_buffer_object bo; | ||
41 | struct ttm_bo_kmap_obj kmap; | ||
42 | |||
43 | /* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ | ||
44 | struct ttm_placement placement; | ||
45 | struct ttm_place placements[2]; | ||
46 | |||
47 | int pin_count; | ||
48 | }; | ||
49 | |||
50 | /** | ||
51 | * Returns the container of type &struct drm_gem_vram_object | ||
52 | * for field bo. | ||
53 | * @bo: the VRAM buffer object | ||
54 | * Returns: The containing GEM VRAM object | ||
55 | */ | ||
56 | static inline struct drm_gem_vram_object *drm_gem_vram_of_bo( | ||
57 | struct ttm_buffer_object *bo) | ||
58 | { | ||
59 | return container_of(bo, struct drm_gem_vram_object, bo); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Returns the container of type &struct drm_gem_vram_object | ||
64 | * for field gem. | ||
65 | * @gem: the GEM object | ||
66 | * Returns: The containing GEM VRAM object | ||
67 | */ | ||
68 | static inline struct drm_gem_vram_object *drm_gem_vram_of_gem( | ||
69 | struct drm_gem_object *gem) | ||
70 | { | ||
71 | return container_of(gem, struct drm_gem_vram_object, gem); | ||
72 | } | ||
73 | |||
74 | struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev, | ||
75 | struct ttm_bo_device *bdev, | ||
76 | size_t size, | ||
77 | unsigned long pg_align, | ||
78 | bool interruptible); | ||
79 | void drm_gem_vram_put(struct drm_gem_vram_object *gbo); | ||
80 | u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo); | ||
81 | s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo); | ||
82 | int drm_gem_vram_pin(struct drm_gem_vram_object *gbo, unsigned long pl_flag); | ||
83 | int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo); | ||
84 | void *drm_gem_vram_kmap(struct drm_gem_vram_object *gbo, bool map, | ||
85 | bool *is_iomem); | ||
86 | void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo); | ||
87 | |||
88 | int drm_gem_vram_fill_create_dumb(struct drm_file *file, | ||
89 | struct drm_device *dev, | ||
90 | struct ttm_bo_device *bdev, | ||
91 | unsigned long pg_align, | ||
92 | bool interruptible, | ||
93 | struct drm_mode_create_dumb *args); | ||
94 | |||
95 | /* | ||
96 | * Helpers for struct ttm_bo_driver | ||
97 | */ | ||
98 | |||
99 | void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo, | ||
100 | struct ttm_placement *pl); | ||
101 | |||
102 | int drm_gem_vram_bo_driver_verify_access(struct ttm_buffer_object *bo, | ||
103 | struct file *filp); | ||
104 | |||
105 | extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs; | ||
106 | |||
107 | /* | ||
108 | * Helpers for struct drm_driver | ||
109 | */ | ||
110 | |||
111 | void drm_gem_vram_driver_gem_free_object_unlocked(struct drm_gem_object *gem); | ||
112 | int drm_gem_vram_driver_dumb_create(struct drm_file *file, | ||
113 | struct drm_device *dev, | ||
114 | struct drm_mode_create_dumb *args); | ||
115 | int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, | ||
116 | struct drm_device *dev, | ||
117 | uint32_t handle, uint64_t *offset); | ||
118 | |||
119 | /** | ||
120 | * define DRM_GEM_VRAM_DRIVER - default callback functions for \ | ||
121 | &struct drm_driver | ||
122 | * | ||
123 | * Drivers that use VRAM MM and GEM VRAM can use this macro to initialize | ||
124 | * &struct drm_driver with default functions. | ||
125 | */ | ||
126 | #define DRM_GEM_VRAM_DRIVER \ | ||
127 | .gem_free_object_unlocked = \ | ||
128 | drm_gem_vram_driver_gem_free_object_unlocked, \ | ||
129 | .dumb_create = drm_gem_vram_driver_dumb_create, \ | ||
130 | .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset | ||
131 | |||
132 | /* | ||
133 | * PRIME helpers for struct drm_driver | ||
134 | */ | ||
135 | |||
136 | int drm_gem_vram_driver_gem_prime_pin(struct drm_gem_object *obj); | ||
137 | void drm_gem_vram_driver_gem_prime_unpin(struct drm_gem_object *obj); | ||
138 | void *drm_gem_vram_driver_gem_prime_vmap(struct drm_gem_object *obj); | ||
139 | void drm_gem_vram_driver_gem_prime_vunmap(struct drm_gem_object *obj, | ||
140 | void *vaddr); | ||
141 | int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *obj, | ||
142 | struct vm_area_struct *vma); | ||
143 | |||
144 | #define DRM_GEM_VRAM_DRIVER_PRIME \ | ||
145 | .gem_prime_export = drm_gem_prime_export, \ | ||
146 | .gem_prime_import = drm_gem_prime_import, \ | ||
147 | .gem_prime_pin = drm_gem_vram_driver_gem_prime_pin, \ | ||
148 | .gem_prime_unpin = drm_gem_vram_driver_gem_prime_unpin, \ | ||
149 | .gem_prime_vmap = drm_gem_vram_driver_gem_prime_vmap, \ | ||
150 | .gem_prime_vunmap = drm_gem_vram_driver_gem_prime_vunmap, \ | ||
151 | .gem_prime_mmap = drm_gem_vram_driver_gem_prime_mmap | ||
152 | |||
153 | #endif | ||
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index f243408ecf26..13771a496e2b 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h | |||
@@ -252,17 +252,44 @@ struct hdcp2_rep_stream_ready { | |||
252 | * host format and back | 252 | * host format and back |
253 | */ | 253 | */ |
254 | static inline | 254 | static inline |
255 | u32 drm_hdcp2_seq_num_to_u32(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN]) | 255 | u32 drm_hdcp_be24_to_cpu(const u8 seq_num[HDCP_2_2_SEQ_NUM_LEN]) |
256 | { | 256 | { |
257 | return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16); | 257 | return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16); |
258 | } | 258 | } |
259 | 259 | ||
260 | static inline | 260 | static inline |
261 | void drm_hdcp2_u32_to_seq_num(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val) | 261 | void drm_hdcp_cpu_to_be24(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val) |
262 | { | 262 | { |
263 | seq_num[0] = val >> 16; | 263 | seq_num[0] = val >> 16; |
264 | seq_num[1] = val >> 8; | 264 | seq_num[1] = val >> 8; |
265 | seq_num[2] = val; | 265 | seq_num[2] = val; |
266 | } | 266 | } |
267 | 267 | ||
268 | #define DRM_HDCP_SRM_GEN1_MAX_BYTES (5 * 1024) | ||
269 | #define DRM_HDCP_1_4_SRM_ID 0x8 | ||
270 | #define DRM_HDCP_SRM_ID_MASK (0xF << 4) | ||
271 | #define DRM_HDCP_1_4_VRL_LENGTH_SIZE 3 | ||
272 | #define DRM_HDCP_1_4_DCP_SIG_SIZE 40 | ||
273 | #define DRM_HDCP_2_SRM_ID 0x9 | ||
274 | #define DRM_HDCP_2_INDICATOR 0x1 | ||
275 | #define DRM_HDCP_2_INDICATOR_MASK 0xF | ||
276 | #define DRM_HDCP_2_VRL_LENGTH_SIZE 3 | ||
277 | #define DRM_HDCP_2_DCP_SIG_SIZE 384 | ||
278 | #define DRM_HDCP_2_NO_OF_DEV_PLUS_RESERVED_SZ 4 | ||
279 | #define DRM_HDCP_2_KSV_COUNT_2_LSBITS(byte) (((byte) & 0xC) >> 6) | ||
280 | |||
281 | struct hdcp_srm_header { | ||
282 | u8 srm_id; | ||
283 | u8 reserved; | ||
284 | __be16 srm_version; | ||
285 | u8 srm_gen_no; | ||
286 | } __packed; | ||
287 | |||
288 | struct drm_device; | ||
289 | struct drm_connector; | ||
290 | |||
291 | bool drm_hdcp_check_ksvs_revoked(struct drm_device *dev, | ||
292 | u8 *ksvs, u32 ksv_count); | ||
293 | int drm_connector_attach_content_protection_property( | ||
294 | struct drm_connector *connector); | ||
268 | #endif | 295 | #endif |
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h index 2182a56ac421..58dc0c04bf99 100644 --- a/include/drm/drm_legacy.h +++ b/include/drm/drm_legacy.h | |||
@@ -1,11 +1,5 @@ | |||
1 | #ifndef __DRM_DRM_LEGACY_H__ | 1 | #ifndef __DRM_DRM_LEGACY_H__ |
2 | #define __DRM_DRM_LEGACY_H__ | 2 | #define __DRM_DRM_LEGACY_H__ |
3 | |||
4 | #include <drm/drm_auth.h> | ||
5 | #include <drm/drm_hashtab.h> | ||
6 | |||
7 | struct drm_device; | ||
8 | |||
9 | /* | 3 | /* |
10 | * Legacy driver interfaces for the Direct Rendering Manager | 4 | * Legacy driver interfaces for the Direct Rendering Manager |
11 | * | 5 | * |
@@ -39,6 +33,12 @@ struct drm_device; | |||
39 | * OTHER DEALINGS IN THE SOFTWARE. | 33 | * OTHER DEALINGS IN THE SOFTWARE. |
40 | */ | 34 | */ |
41 | 35 | ||
36 | #include <drm/drm.h> | ||
37 | #include <drm/drm_auth.h> | ||
38 | #include <drm/drm_hashtab.h> | ||
39 | |||
40 | struct drm_device; | ||
41 | struct file; | ||
42 | 42 | ||
43 | /* | 43 | /* |
44 | * Legacy Support for palateontologic DRM drivers | 44 | * Legacy Support for palateontologic DRM drivers |
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 7f60e8eb269a..759d462d028b 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h | |||
@@ -836,6 +836,19 @@ struct drm_mode_config { | |||
836 | */ | 836 | */ |
837 | struct drm_property *writeback_out_fence_ptr_property; | 837 | struct drm_property *writeback_out_fence_ptr_property; |
838 | 838 | ||
839 | /** | ||
840 | * @hdr_output_metadata_property: Connector property containing hdr | ||
841 | * metatada. This will be provided by userspace compositors based | ||
842 | * on HDR content | ||
843 | */ | ||
844 | struct drm_property *hdr_output_metadata_property; | ||
845 | |||
846 | /** | ||
847 | * @content_protection_property: DRM ENUM property for content | ||
848 | * protection. See drm_connector_attach_content_protection_property(). | ||
849 | */ | ||
850 | struct drm_property *content_protection_property; | ||
851 | |||
839 | /* dumb ioctl parameters */ | 852 | /* dumb ioctl parameters */ |
840 | uint32_t preferred_depth, prefer_shadow; | 853 | uint32_t preferred_depth, prefer_shadow; |
841 | 854 | ||
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index f7bbd0b0ecd1..6b18c8adfe9d 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h | |||
@@ -680,6 +680,52 @@ struct drm_encoder_helper_funcs { | |||
680 | struct drm_connector *connector); | 680 | struct drm_connector *connector); |
681 | 681 | ||
682 | /** | 682 | /** |
683 | * @atomic_disable: | ||
684 | * | ||
685 | * This callback should be used to disable the encoder. With the atomic | ||
686 | * drivers it is called before this encoder's CRTC has been shut off | ||
687 | * using their own &drm_crtc_helper_funcs.atomic_disable hook. If that | ||
688 | * sequence is too simple drivers can just add their own driver private | ||
689 | * encoder hooks and call them from CRTC's callback by looping over all | ||
690 | * encoders connected to it using for_each_encoder_on_crtc(). | ||
691 | * | ||
692 | * This callback is a variant of @disable that provides the atomic state | ||
693 | * to the driver. If @atomic_disable is implemented, @disable is not | ||
694 | * called by the helpers. | ||
695 | * | ||
696 | * This hook is only used by atomic helpers. Atomic drivers don't need | ||
697 | * to implement it if there's no need to disable anything at the encoder | ||
698 | * level. To ensure that runtime PM handling (using either DPMS or the | ||
699 | * new "ACTIVE" property) works @atomic_disable must be the inverse of | ||
700 | * @atomic_enable. | ||
701 | */ | ||
702 | void (*atomic_disable)(struct drm_encoder *encoder, | ||
703 | struct drm_atomic_state *state); | ||
704 | |||
705 | /** | ||
706 | * @atomic_enable: | ||
707 | * | ||
708 | * This callback should be used to enable the encoder. It is called | ||
709 | * after this encoder's CRTC has been enabled using their own | ||
710 | * &drm_crtc_helper_funcs.atomic_enable hook. If that sequence is | ||
711 | * too simple drivers can just add their own driver private encoder | ||
712 | * hooks and call them from CRTC's callback by looping over all encoders | ||
713 | * connected to it using for_each_encoder_on_crtc(). | ||
714 | * | ||
715 | * This callback is a variant of @enable that provides the atomic state | ||
716 | * to the driver. If @atomic_enable is implemented, @enable is not | ||
717 | * called by the helpers. | ||
718 | * | ||
719 | * This hook is only used by atomic helpers, it is the opposite of | ||
720 | * @atomic_disable. Atomic drivers don't need to implement it if there's | ||
721 | * no need to enable anything at the encoder level. To ensure that | ||
722 | * runtime PM handling works @atomic_enable must be the inverse of | ||
723 | * @atomic_disable. | ||
724 | */ | ||
725 | void (*atomic_enable)(struct drm_encoder *encoder, | ||
726 | struct drm_atomic_state *state); | ||
727 | |||
728 | /** | ||
683 | * @disable: | 729 | * @disable: |
684 | * | 730 | * |
685 | * This callback should be used to disable the encoder. With the atomic | 731 | * This callback should be used to disable the encoder. With the atomic |
@@ -695,6 +741,9 @@ struct drm_encoder_helper_funcs { | |||
695 | * handling (using either DPMS or the new "ACTIVE" property) works | 741 | * handling (using either DPMS or the new "ACTIVE" property) works |
696 | * @disable must be the inverse of @enable for atomic drivers. | 742 | * @disable must be the inverse of @enable for atomic drivers. |
697 | * | 743 | * |
744 | * For atomic drivers also consider @atomic_disable and save yourself | ||
745 | * from having to read the NOTE below! | ||
746 | * | ||
698 | * NOTE: | 747 | * NOTE: |
699 | * | 748 | * |
700 | * With legacy CRTC helpers there's a big semantic difference between | 749 | * With legacy CRTC helpers there's a big semantic difference between |
@@ -719,11 +768,11 @@ struct drm_encoder_helper_funcs { | |||
719 | * hooks and call them from CRTC's callback by looping over all encoders | 768 | * hooks and call them from CRTC's callback by looping over all encoders |
720 | * connected to it using for_each_encoder_on_crtc(). | 769 | * connected to it using for_each_encoder_on_crtc(). |
721 | * | 770 | * |
722 | * This hook is used only by atomic helpers, for symmetry with @disable. | 771 | * This hook is only used by atomic helpers, it is the opposite of |
723 | * Atomic drivers don't need to implement it if there's no need to | 772 | * @disable. Atomic drivers don't need to implement it if there's no |
724 | * enable anything at the encoder level. To ensure that runtime PM handling | 773 | * need to enable anything at the encoder level. To ensure that |
725 | * (using either DPMS or the new "ACTIVE" property) works | 774 | * runtime PM handling (using either DPMS or the new "ACTIVE" property) |
726 | * @enable must be the inverse of @disable for atomic drivers. | 775 | * works @enable must be the inverse of @disable for atomic drivers. |
727 | */ | 776 | */ |
728 | void (*enable)(struct drm_encoder *encoder); | 777 | void (*enable)(struct drm_encoder *encoder); |
729 | 778 | ||
@@ -979,7 +1028,7 @@ struct drm_connector_helper_funcs { | |||
979 | * deadlock. | 1028 | * deadlock. |
980 | */ | 1029 | */ |
981 | int (*atomic_check)(struct drm_connector *connector, | 1030 | int (*atomic_check)(struct drm_connector *connector, |
982 | struct drm_connector_state *state); | 1031 | struct drm_atomic_state *state); |
983 | 1032 | ||
984 | /** | 1033 | /** |
985 | * @atomic_commit: | 1034 | * @atomic_commit: |
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 6078c700d9ba..cd5903ad33f7 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h | |||
@@ -69,7 +69,7 @@ struct drm_plane_state { | |||
69 | * | 69 | * |
70 | * Optional fence to wait for before scanning out @fb. The core atomic | 70 | * Optional fence to wait for before scanning out @fb. The core atomic |
71 | * code will set this when userspace is using explicit fencing. Do not | 71 | * code will set this when userspace is using explicit fencing. Do not |
72 | * write this directly for a driver's implicit fence, use | 72 | * write this field directly for a driver's implicit fence, use |
73 | * drm_atomic_set_fence_for_plane() to ensure that an explicit fence is | 73 | * drm_atomic_set_fence_for_plane() to ensure that an explicit fence is |
74 | * preserved. | 74 | * preserved. |
75 | * | 75 | * |
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 3a4247319e63..a5d6f2f3e430 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/debugfs.h> | 33 | #include <linux/debugfs.h> |
34 | 34 | ||
35 | #include <drm/drm.h> | ||
36 | |||
35 | /** | 37 | /** |
36 | * DOC: print | 38 | * DOC: print |
37 | * | 39 | * |
diff --git a/include/drm/drm_self_refresh_helper.h b/include/drm/drm_self_refresh_helper.h new file mode 100644 index 000000000000..397a583ccca7 --- /dev/null +++ b/include/drm/drm_self_refresh_helper.h | |||
@@ -0,0 +1,20 @@ | |||
1 | // SPDX-License-Identifier: MIT | ||
2 | /* | ||
3 | * Copyright (C) 2019 Google, Inc. | ||
4 | * | ||
5 | * Authors: | ||
6 | * Sean Paul <seanpaul@chromium.org> | ||
7 | */ | ||
8 | #ifndef DRM_SELF_REFRESH_HELPER_H_ | ||
9 | #define DRM_SELF_REFRESH_HELPER_H_ | ||
10 | |||
11 | struct drm_atomic_state; | ||
12 | struct drm_crtc; | ||
13 | |||
14 | void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state); | ||
15 | |||
16 | int drm_self_refresh_helper_init(struct drm_crtc *crtc, | ||
17 | unsigned int entry_delay_ms); | ||
18 | |||
19 | void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc); | ||
20 | #endif | ||
diff --git a/include/drm/drm_vram_mm_helper.h b/include/drm/drm_vram_mm_helper.h new file mode 100644 index 000000000000..a8ffd8599b08 --- /dev/null +++ b/include/drm/drm_vram_mm_helper.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
2 | |||
3 | #ifndef DRM_VRAM_MM_HELPER_H | ||
4 | #define DRM_VRAM_MM_HELPER_H | ||
5 | |||
6 | #include <drm/ttm/ttm_bo_driver.h> | ||
7 | |||
8 | struct drm_device; | ||
9 | |||
10 | /** | ||
11 | * struct drm_vram_mm_funcs - Callback functions for &struct drm_vram_mm | ||
12 | * @evict_flags: Provides an implementation for struct \ | ||
13 | &ttm_bo_driver.evict_flags | ||
14 | * @verify_access: Provides an implementation for \ | ||
15 | struct &ttm_bo_driver.verify_access | ||
16 | * | ||
17 | * These callback function integrate VRAM MM with TTM buffer objects. New | ||
18 | * functions can be added if necessary. | ||
19 | */ | ||
20 | struct drm_vram_mm_funcs { | ||
21 | void (*evict_flags)(struct ttm_buffer_object *bo, | ||
22 | struct ttm_placement *placement); | ||
23 | int (*verify_access)(struct ttm_buffer_object *bo, struct file *filp); | ||
24 | }; | ||
25 | |||
26 | /** | ||
27 | * struct drm_vram_mm - An instance of VRAM MM | ||
28 | * @vram_base: Base address of the managed video memory | ||
29 | * @vram_size: Size of the managed video memory in bytes | ||
30 | * @bdev: The TTM BO device. | ||
31 | * @funcs: TTM BO functions | ||
32 | * | ||
33 | * The fields &struct drm_vram_mm.vram_base and | ||
34 | * &struct drm_vram_mm.vrm_size are managed by VRAM MM, but are | ||
35 | * available for public read access. Use the field | ||
36 | * &struct drm_vram_mm.bdev to access the TTM BO device. | ||
37 | */ | ||
38 | struct drm_vram_mm { | ||
39 | uint64_t vram_base; | ||
40 | size_t vram_size; | ||
41 | |||
42 | struct ttm_bo_device bdev; | ||
43 | |||
44 | const struct drm_vram_mm_funcs *funcs; | ||
45 | }; | ||
46 | |||
47 | /** | ||
48 | * drm_vram_mm_of_bdev() - \ | ||
49 | Returns the container of type &struct ttm_bo_device for field bdev. | ||
50 | * @bdev: the TTM BO device | ||
51 | * | ||
52 | * Returns: | ||
53 | * The containing instance of &struct drm_vram_mm | ||
54 | */ | ||
55 | static inline struct drm_vram_mm *drm_vram_mm_of_bdev( | ||
56 | struct ttm_bo_device *bdev) | ||
57 | { | ||
58 | return container_of(bdev, struct drm_vram_mm, bdev); | ||
59 | } | ||
60 | |||
61 | int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev, | ||
62 | uint64_t vram_base, size_t vram_size, | ||
63 | const struct drm_vram_mm_funcs *funcs); | ||
64 | void drm_vram_mm_cleanup(struct drm_vram_mm *vmm); | ||
65 | |||
66 | int drm_vram_mm_mmap(struct file *filp, struct vm_area_struct *vma, | ||
67 | struct drm_vram_mm *vmm); | ||
68 | |||
69 | /* | ||
70 | * Helpers for integration with struct drm_device | ||
71 | */ | ||
72 | |||
73 | struct drm_vram_mm *drm_vram_helper_alloc_mm( | ||
74 | struct drm_device *dev, uint64_t vram_base, size_t vram_size, | ||
75 | const struct drm_vram_mm_funcs *funcs); | ||
76 | void drm_vram_helper_release_mm(struct drm_device *dev); | ||
77 | |||
78 | /* | ||
79 | * Helpers for &struct file_operations | ||
80 | */ | ||
81 | |||
82 | int drm_vram_mm_file_operations_mmap( | ||
83 | struct file *filp, struct vm_area_struct *vma); | ||
84 | |||
85 | /** | ||
86 | * define DRM_VRAM_MM_FILE_OPERATIONS - default callback functions for \ | ||
87 | &struct file_operations | ||
88 | * | ||
89 | * Drivers that use VRAM MM can use this macro to initialize | ||
90 | * &struct file_operations with default functions. | ||
91 | */ | ||
92 | #define DRM_VRAM_MM_FILE_OPERATIONS \ | ||
93 | .llseek = no_llseek, \ | ||
94 | .read = drm_read, \ | ||
95 | .poll = drm_poll, \ | ||
96 | .unlocked_ioctl = drm_ioctl, \ | ||
97 | .compat_ioctl = drm_compat_ioctl, \ | ||
98 | .mmap = drm_vram_mm_file_operations_mmap, \ | ||
99 | .open = drm_open, \ | ||
100 | .release = drm_release \ | ||
101 | |||
102 | #endif | ||
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 0daca4d8dad9..57b4121c750a 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h | |||
@@ -167,9 +167,6 @@ struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f); | |||
167 | * @sched: the scheduler instance on which this job is scheduled. | 167 | * @sched: the scheduler instance on which this job is scheduled. |
168 | * @s_fence: contains the fences for the scheduling of job. | 168 | * @s_fence: contains the fences for the scheduling of job. |
169 | * @finish_cb: the callback for the finished fence. | 169 | * @finish_cb: the callback for the finished fence. |
170 | * @finish_work: schedules the function @drm_sched_job_finish once the job has | ||
171 | * finished to remove the job from the | ||
172 | * @drm_gpu_scheduler.ring_mirror_list. | ||
173 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. | 170 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. |
174 | * @id: a unique id assigned to each job scheduled on the scheduler. | 171 | * @id: a unique id assigned to each job scheduled on the scheduler. |
175 | * @karma: increment on every hang caused by this job. If this exceeds the hang | 172 | * @karma: increment on every hang caused by this job. If this exceeds the hang |
@@ -188,7 +185,6 @@ struct drm_sched_job { | |||
188 | struct drm_gpu_scheduler *sched; | 185 | struct drm_gpu_scheduler *sched; |
189 | struct drm_sched_fence *s_fence; | 186 | struct drm_sched_fence *s_fence; |
190 | struct dma_fence_cb finish_cb; | 187 | struct dma_fence_cb finish_cb; |
191 | struct work_struct finish_work; | ||
192 | struct list_head node; | 188 | struct list_head node; |
193 | uint64_t id; | 189 | uint64_t id; |
194 | atomic_t karma; | 190 | atomic_t karma; |
@@ -263,6 +259,7 @@ struct drm_sched_backend_ops { | |||
263 | * guilty and it will be considered for scheduling further. | 259 | * guilty and it will be considered for scheduling further. |
264 | * @num_jobs: the number of jobs in queue in the scheduler | 260 | * @num_jobs: the number of jobs in queue in the scheduler |
265 | * @ready: marks if the underlying HW is ready to work | 261 | * @ready: marks if the underlying HW is ready to work |
262 | * @free_guilty: A hit to time out handler to free the guilty job. | ||
266 | * | 263 | * |
267 | * One scheduler is implemented for each hardware ring. | 264 | * One scheduler is implemented for each hardware ring. |
268 | */ | 265 | */ |
@@ -283,6 +280,7 @@ struct drm_gpu_scheduler { | |||
283 | int hang_limit; | 280 | int hang_limit; |
284 | atomic_t num_jobs; | 281 | atomic_t num_jobs; |
285 | bool ready; | 282 | bool ready; |
283 | bool free_guilty; | ||
286 | }; | 284 | }; |
287 | 285 | ||
288 | int drm_sched_init(struct drm_gpu_scheduler *sched, | 286 | int drm_sched_init(struct drm_gpu_scheduler *sched, |
@@ -296,7 +294,7 @@ int drm_sched_job_init(struct drm_sched_job *job, | |||
296 | void *owner); | 294 | void *owner); |
297 | void drm_sched_job_cleanup(struct drm_sched_job *job); | 295 | void drm_sched_job_cleanup(struct drm_sched_job *job); |
298 | void drm_sched_wakeup(struct drm_gpu_scheduler *sched); | 296 | void drm_sched_wakeup(struct drm_gpu_scheduler *sched); |
299 | void drm_sched_stop(struct drm_gpu_scheduler *sched); | 297 | void drm_sched_stop(struct drm_gpu_scheduler *sched, struct drm_sched_job *bad); |
300 | void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery); | 298 | void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery); |
301 | void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched); | 299 | void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched); |
302 | void drm_sched_increase_karma(struct drm_sched_job *bad); | 300 | void drm_sched_increase_karma(struct drm_sched_job *bad); |
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h index 6477da22af28..6d60ea68c171 100644 --- a/include/drm/i915_pciids.h +++ b/include/drm/i915_pciids.h | |||
@@ -559,7 +559,6 @@ | |||
559 | #define INTEL_ICL_PORT_F_IDS(info) \ | 559 | #define INTEL_ICL_PORT_F_IDS(info) \ |
560 | INTEL_VGA_DEVICE(0x8A50, info), \ | 560 | INTEL_VGA_DEVICE(0x8A50, info), \ |
561 | INTEL_VGA_DEVICE(0x8A5C, info), \ | 561 | INTEL_VGA_DEVICE(0x8A5C, info), \ |
562 | INTEL_VGA_DEVICE(0x8A5D, info), \ | ||
563 | INTEL_VGA_DEVICE(0x8A59, info), \ | 562 | INTEL_VGA_DEVICE(0x8A59, info), \ |
564 | INTEL_VGA_DEVICE(0x8A58, info), \ | 563 | INTEL_VGA_DEVICE(0x8A58, info), \ |
565 | INTEL_VGA_DEVICE(0x8A52, info), \ | 564 | INTEL_VGA_DEVICE(0x8A52, info), \ |
@@ -573,7 +572,8 @@ | |||
573 | 572 | ||
574 | #define INTEL_ICL_11_IDS(info) \ | 573 | #define INTEL_ICL_11_IDS(info) \ |
575 | INTEL_ICL_PORT_F_IDS(info), \ | 574 | INTEL_ICL_PORT_F_IDS(info), \ |
576 | INTEL_VGA_DEVICE(0x8A51, info) | 575 | INTEL_VGA_DEVICE(0x8A51, info), \ |
576 | INTEL_VGA_DEVICE(0x8A5D, info) | ||
577 | 577 | ||
578 | /* EHL */ | 578 | /* EHL */ |
579 | #define INTEL_EHL_IDS(info) \ | 579 | #define INTEL_EHL_IDS(info) \ |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 129dabbc002d..c9b8ba492f24 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -767,11 +767,12 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, | |||
767 | */ | 767 | */ |
768 | static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) | 768 | static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) |
769 | { | 769 | { |
770 | if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { | 770 | spin_lock(&bo->bdev->glob->lru_lock); |
771 | spin_lock(&bo->bdev->glob->lru_lock); | 771 | if (list_empty(&bo->lru)) |
772 | ttm_bo_add_to_lru(bo); | 772 | ttm_bo_add_to_lru(bo); |
773 | spin_unlock(&bo->bdev->glob->lru_lock); | 773 | else |
774 | } | 774 | ttm_bo_move_to_lru_tail(bo, NULL); |
775 | spin_unlock(&bo->bdev->glob->lru_lock); | ||
775 | reservation_object_unlock(bo->resv); | 776 | reservation_object_unlock(bo->resv); |
776 | } | 777 | } |
777 | 778 | ||
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h index 621615fa7728..7e46cc678e7e 100644 --- a/include/drm/ttm/ttm_execbuf_util.h +++ b/include/drm/ttm/ttm_execbuf_util.h | |||
@@ -70,6 +70,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
70 | * @list: thread private list of ttm_validate_buffer structs. | 70 | * @list: thread private list of ttm_validate_buffer structs. |
71 | * @intr: should the wait be interruptible | 71 | * @intr: should the wait be interruptible |
72 | * @dups: [out] optional list of duplicates. | 72 | * @dups: [out] optional list of duplicates. |
73 | * @del_lru: true if BOs should be removed from the LRU. | ||
73 | * | 74 | * |
74 | * Tries to reserve bos pointed to by the list entries for validation. | 75 | * Tries to reserve bos pointed to by the list entries for validation. |
75 | * If the function returns 0, all buffers are marked as "unfenced", | 76 | * If the function returns 0, all buffers are marked as "unfenced", |
@@ -98,7 +99,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
98 | 99 | ||
99 | extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, | 100 | extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, |
100 | struct list_head *list, bool intr, | 101 | struct list_head *list, bool intr, |
101 | struct list_head *dups); | 102 | struct list_head *dups, bool del_lru); |
102 | 103 | ||
103 | /** | 104 | /** |
104 | * function ttm_eu_fence_buffer_objects. | 105 | * function ttm_eu_fence_buffer_objects. |