diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 20:49:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 20:49:53 -0400 |
| commit | 53b3b6bbfde6aae8d1ededc86ad4e0e1e00eb5f8 (patch) | |
| tree | b29473f21270aefd113b298c9402be8b4b3c91b4 /include | |
| parent | 746bb4ed6d626f3f9e431a7f9b20504538e62ded (diff) | |
| parent | f2bfc71aee75feff33ca659322b72ffeed5a243d (diff) | |
Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie:
"This is going to rebuild more than drm as it adds a new helper to
list.h for doing bulk updates. Seemed like a reasonable addition to
me.
Otherwise the usual merge window stuff lots of i915 and amdgpu, not so
much nouveau, and piles of everything else.
Core:
- Adds a new list.h helper for doing bulk list updates for TTM.
- Don't leak fb address in smem_start to userspace (comes with EXPORT
workaround for people using mali out of tree hacks)
- udmabuf device to turn memfd regions into dma-buf
- Per-plane blend mode property
- ref/unref replacements with get/put
- fbdev conflicting framebuffers code cleaned up
- host-endian format variants
- panel orientation quirk for Acer One 10
bridge:
- TI SN65DSI86 chip support
vkms:
- GEM support.
- Cursor support
amdgpu:
- Merge amdkfd and amdgpu into one module
- CEC over DP AUX support
- Picasso APU support + VCN dynamic powergating
- Raven2 APU support
- Vega20 enablement + kfd support
- ACP powergating improvements
- ABGR/XBGR display support
- VCN jpeg support
- xGMI support
- DC i2c/aux cleanup
- Ycbcr 4:2:0 support
- GPUVM improvements
- Powerplay and powerplay endian fixes
- Display underflow fixes
vmwgfx:
- Move vmwgfx specific TTM code to vmwgfx
- Split out vmwgfx buffer/resource validation code
- Atomic operation rework
bochs:
- use more helpers
- format/byteorder improvements
qxl:
- use more helpers
i915:
- GGTT coherency getparam
- Turn off resource streamer API
- More Icelake enablement + DMC firmware
- Full PPGTT for Ivybridge, Haswell and Valleyview
- DDB distribution based on resolution
- Limited range DP display support
nouveau:
- CEC over DP AUX support
- Initial HDMI 2.0 support
virtio-gpu:
- vmap support for PRIME objects
tegra:
- Initial Tegra194 support
- DMA/IOMMU integration fixes
msm:
- a6xx perf improvements + clock prefix
- GPU preemption optimisations
- a6xx devfreq support
- cursor support
rockchip:
- PX30 support
- rgb output interface support
mediatek:
- HDMI output support on mt2701 and mt7623
rcar-du:
- Interlaced modes on Gen3
- LVDS on R8A77980
- D3 and E3 SoC support
hisilicon:
- misc fixes
mxsfb:
- runtime pm support
sun4i:
- R40 TCON support
- Allwinner A64 support
- R40 HDMI support
omapdrm:
- Driver rework changing display pipeline ordering to use common code
- DMM memory barrier and irq fixes
- Errata workarounds
exynos:
- out-bridge support for LVDS bridge driver
- Samsung 16x16 tiled format support
- Plane alpha and pixel blend mode support
tilcdc:
- suspend/resume update
mali-dp:
- misc updates"
* tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm: (1382 commits)
firmware/dmc/icl: Add missing MODULE_FIRMWARE() for Icelake.
drm/i915/icl: Fix signal_levels
drm/i915/icl: Fix DDI/TC port clk_off bits
drm/i915/icl: create function to identify combophy port
drm/i915/gen9+: Fix initial readout for Y tiled framebuffers
drm/i915: Large page offsets for pread/pwrite
drm/i915/selftests: Disable shrinker across mmap-exhaustion
drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode
drm/i915: Fix intel_dp_mst_best_encoder()
drm/i915: Skip vcpi allocation for MSTB ports that are gone
drm/i915: Don't unset intel_connector->mst_port
drm/i915: Only reset seqno if actually idle
drm/i915: Use the correct crtc when sanitizing plane mapping
drm/i915: Restore vblank interrupts earlier
drm/i915: Check fb stride against plane max stride
drm/amdgpu/vcn:Fix uninitialized symbol error
drm: panel-orientation-quirks: Add quirk for Acer One 10 (S1003)
drm/amd/amdgpu: Fix debugfs error handling
drm/amdgpu: Update gc_9_0 golden settings.
drm/amd/powerplay: update PPtable with DC BTC and Tvr SocLimit fields
...
Diffstat (limited to 'include')
40 files changed, 507 insertions, 683 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index f7a19c2a7a80..05350424a4d3 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -110,7 +110,4 @@ static inline bool drm_can_sleep(void) | |||
| 110 | return true; | 110 | return true; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | /* helper for handling conditionals in various for_each macros */ | ||
| 114 | #define for_each_if(condition) if (!(condition)) {} else | ||
| 115 | |||
| 116 | #endif | 113 | #endif |
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 1e713154f00e..1e810e0b7664 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #define DRM_ATOMIC_H_ | 29 | #define DRM_ATOMIC_H_ |
| 30 | 30 | ||
| 31 | #include <drm/drm_crtc.h> | 31 | #include <drm/drm_crtc.h> |
| 32 | #include <drm/drm_util.h> | ||
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| 34 | * struct drm_crtc_commit - track modeset commits on a CRTC | 35 | * struct drm_crtc_commit - track modeset commits on a CRTC |
| @@ -384,9 +385,6 @@ void drm_atomic_state_default_release(struct drm_atomic_state *state); | |||
| 384 | struct drm_crtc_state * __must_check | 385 | struct drm_crtc_state * __must_check |
| 385 | drm_atomic_get_crtc_state(struct drm_atomic_state *state, | 386 | drm_atomic_get_crtc_state(struct drm_atomic_state *state, |
| 386 | struct drm_crtc *crtc); | 387 | struct drm_crtc *crtc); |
| 387 | int drm_atomic_crtc_set_property(struct drm_crtc *crtc, | ||
| 388 | struct drm_crtc_state *state, struct drm_property *property, | ||
| 389 | uint64_t val); | ||
| 390 | struct drm_plane_state * __must_check | 388 | struct drm_plane_state * __must_check |
| 391 | drm_atomic_get_plane_state(struct drm_atomic_state *state, | 389 | drm_atomic_get_plane_state(struct drm_atomic_state *state, |
| 392 | struct drm_plane *plane); | 390 | struct drm_plane *plane); |
| @@ -598,25 +596,6 @@ __drm_atomic_get_current_plane_state(struct drm_atomic_state *state, | |||
| 598 | } | 596 | } |
| 599 | 597 | ||
| 600 | int __must_check | 598 | int __must_check |
| 601 | drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, | ||
| 602 | const struct drm_display_mode *mode); | ||
| 603 | int __must_check | ||
| 604 | drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, | ||
| 605 | struct drm_property_blob *blob); | ||
| 606 | int __must_check | ||
| 607 | drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, | ||
| 608 | struct drm_crtc *crtc); | ||
| 609 | void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, | ||
| 610 | struct drm_framebuffer *fb); | ||
| 611 | void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state, | ||
| 612 | struct dma_fence *fence); | ||
| 613 | int __must_check | ||
| 614 | drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, | ||
| 615 | struct drm_crtc *crtc); | ||
| 616 | int drm_atomic_set_writeback_fb_for_connector( | ||
| 617 | struct drm_connector_state *conn_state, | ||
| 618 | struct drm_framebuffer *fb); | ||
| 619 | int __must_check | ||
| 620 | drm_atomic_add_affected_connectors(struct drm_atomic_state *state, | 599 | drm_atomic_add_affected_connectors(struct drm_atomic_state *state, |
| 621 | struct drm_crtc *crtc); | 600 | struct drm_crtc *crtc); |
| 622 | int __must_check | 601 | int __must_check |
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 99e2a5297c69..657af7b39379 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <drm/drm_crtc.h> | 31 | #include <drm/drm_crtc.h> |
| 32 | #include <drm/drm_modeset_helper_vtables.h> | 32 | #include <drm/drm_modeset_helper_vtables.h> |
| 33 | #include <drm/drm_modeset_helper.h> | 33 | #include <drm/drm_modeset_helper.h> |
| 34 | #include <drm/drm_util.h> | ||
| 34 | 35 | ||
| 35 | struct drm_atomic_state; | 36 | struct drm_atomic_state; |
| 36 | struct drm_private_obj; | 37 | struct drm_private_obj; |
| @@ -156,6 +157,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state); | |||
| 156 | void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, | 157 | void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, |
| 157 | struct drm_crtc_state *state); | 158 | struct drm_crtc_state *state); |
| 158 | 159 | ||
| 160 | void __drm_atomic_helper_plane_reset(struct drm_plane *plane, | ||
| 161 | struct drm_plane_state *state); | ||
| 159 | void drm_atomic_helper_plane_reset(struct drm_plane *plane); | 162 | void drm_atomic_helper_plane_reset(struct drm_plane *plane); |
| 160 | void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, | 163 | void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, |
| 161 | struct drm_plane_state *state); | 164 | struct drm_plane_state *state); |
diff --git a/include/drm/drm_atomic_uapi.h b/include/drm/drm_atomic_uapi.h new file mode 100644 index 000000000000..8cec52ad1277 --- /dev/null +++ b/include/drm/drm_atomic_uapi.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2014 Red Hat | ||
| 3 | * Copyright (C) 2014 Intel Corp. | ||
| 4 | * Copyright (C) 2018 Intel Corp. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the "Software"), | ||
| 8 | * to deal in the Software without restriction, including without limitation | ||
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 11 | * Software is furnished to do so, subject to the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice shall be included in | ||
| 14 | * all copies or substantial portions of the Software. | ||
| 15 | * | ||
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 22 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | * | ||
| 24 | * Authors: | ||
| 25 | * Rob Clark <robdclark@gmail.com> | ||
| 26 | * Daniel Vetter <daniel.vetter@ffwll.ch> | ||
| 27 | */ | ||
| 28 | |||
| 29 | #ifndef DRM_ATOMIC_UAPI_H_ | ||
| 30 | #define DRM_ATOMIC_UAPI_H_ | ||
| 31 | |||
| 32 | struct drm_crtc_state; | ||
| 33 | struct drm_display_mode; | ||
| 34 | struct drm_property_blob; | ||
| 35 | struct drm_plane_state; | ||
| 36 | struct drm_crtc; | ||
| 37 | struct drm_connector_state; | ||
| 38 | struct dma_fence; | ||
| 39 | struct drm_framebuffer; | ||
| 40 | |||
| 41 | int __must_check | ||
| 42 | drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, | ||
| 43 | const struct drm_display_mode *mode); | ||
| 44 | int __must_check | ||
| 45 | drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, | ||
| 46 | struct drm_property_blob *blob); | ||
| 47 | int __must_check | ||
| 48 | drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, | ||
| 49 | struct drm_crtc *crtc); | ||
| 50 | void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, | ||
| 51 | struct drm_framebuffer *fb); | ||
| 52 | void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state, | ||
| 53 | struct dma_fence *fence); | ||
| 54 | int __must_check | ||
| 55 | drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, | ||
| 56 | struct drm_crtc *crtc); | ||
| 57 | |||
| 58 | #endif | ||
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h index 330c561c4c11..88bdfec3bd88 100644 --- a/include/drm/drm_blend.h +++ b/include/drm/drm_blend.h | |||
| @@ -27,6 +27,10 @@ | |||
| 27 | #include <linux/ctype.h> | 27 | #include <linux/ctype.h> |
| 28 | #include <drm/drm_mode.h> | 28 | #include <drm/drm_mode.h> |
| 29 | 29 | ||
| 30 | #define DRM_MODE_BLEND_PREMULTI 0 | ||
| 31 | #define DRM_MODE_BLEND_COVERAGE 1 | ||
| 32 | #define DRM_MODE_BLEND_PIXEL_NONE 2 | ||
| 33 | |||
| 30 | struct drm_device; | 34 | struct drm_device; |
| 31 | struct drm_atomic_state; | 35 | struct drm_atomic_state; |
| 32 | struct drm_plane; | 36 | struct drm_plane; |
| @@ -52,4 +56,6 @@ int drm_plane_create_zpos_immutable_property(struct drm_plane *plane, | |||
| 52 | unsigned int zpos); | 56 | unsigned int zpos); |
| 53 | int drm_atomic_normalize_zpos(struct drm_device *dev, | 57 | int drm_atomic_normalize_zpos(struct drm_device *dev, |
| 54 | struct drm_atomic_state *state); | 58 | struct drm_atomic_state *state); |
| 59 | int drm_plane_create_blend_mode_property(struct drm_plane *plane, | ||
| 60 | unsigned int supported_modes); | ||
| 55 | #endif | 61 | #endif |
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index 44f04233e3db..90ef9996d9a4 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #define __DRM_COLOR_MGMT_H__ | 24 | #define __DRM_COLOR_MGMT_H__ |
| 25 | 25 | ||
| 26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
| 27 | #include <drm/drm_property.h> | ||
| 27 | 28 | ||
| 28 | struct drm_crtc; | 29 | struct drm_crtc; |
| 29 | struct drm_plane; | 30 | struct drm_plane; |
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 97ea41dc678f..91a877fa00cb 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/ctype.h> | 28 | #include <linux/ctype.h> |
| 29 | #include <linux/hdmi.h> | 29 | #include <linux/hdmi.h> |
| 30 | #include <drm/drm_mode_object.h> | 30 | #include <drm/drm_mode_object.h> |
| 31 | #include <drm/drm_util.h> | ||
| 31 | 32 | ||
| 32 | #include <uapi/drm/drm_mode.h> | 33 | #include <uapi/drm/drm_mode.h> |
| 33 | 34 | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 92e7fc7f05a4..b21437bc95bf 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -744,8 +744,45 @@ struct drm_crtc_funcs { | |||
| 744 | * | 744 | * |
| 745 | * 0 on success or a negative error code on failure. | 745 | * 0 on success or a negative error code on failure. |
| 746 | */ | 746 | */ |
| 747 | int (*set_crc_source)(struct drm_crtc *crtc, const char *source, | 747 | int (*set_crc_source)(struct drm_crtc *crtc, const char *source); |
| 748 | size_t *values_cnt); | 748 | /** |
| 749 | * @verify_crc_source: | ||
| 750 | * | ||
| 751 | * verifies the source of CRC checksums of frames before setting the | ||
| 752 | * source for CRC and during crc open. Source parameter can be NULL | ||
| 753 | * while disabling crc source. | ||
| 754 | * | ||
| 755 | * This callback is optional if the driver does not support any CRC | ||
| 756 | * generation functionality. | ||
| 757 | * | ||
| 758 | * RETURNS: | ||
| 759 | * | ||
| 760 | * 0 on success or a negative error code on failure. | ||
| 761 | */ | ||
| 762 | int (*verify_crc_source)(struct drm_crtc *crtc, const char *source, | ||
| 763 | size_t *values_cnt); | ||
| 764 | /** | ||
| 765 | * @get_crc_sources: | ||
| 766 | * | ||
| 767 | * Driver callback for getting a list of all the available sources for | ||
| 768 | * CRC generation. This callback depends upon verify_crc_source, So | ||
| 769 | * verify_crc_source callback should be implemented before implementing | ||
| 770 | * this. Driver can pass full list of available crc sources, this | ||
| 771 | * callback does the verification on each crc-source before passing it | ||
| 772 | * to userspace. | ||
| 773 | * | ||
| 774 | * This callback is optional if the driver does not support exporting of | ||
| 775 | * possible CRC sources list. | ||
| 776 | * | ||
| 777 | * RETURNS: | ||
| 778 | * | ||
| 779 | * a constant character pointer to the list of all the available CRC | ||
| 780 | * sources. On failure driver should return NULL. count should be | ||
| 781 | * updated with number of sources in list. if zero we don't process any | ||
| 782 | * source from the list. | ||
| 783 | */ | ||
| 784 | const char *const *(*get_crc_sources)(struct drm_crtc *crtc, | ||
| 785 | size_t *count); | ||
| 749 | 786 | ||
| 750 | /** | 787 | /** |
| 751 | * @atomic_print_state: | 788 | * @atomic_print_state: |
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index f9c6e0e3aec7..42411b3ea0c8 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h | |||
| @@ -46,6 +46,16 @@ struct drm_device { | |||
| 46 | struct drm_master *master; | 46 | struct drm_master *master; |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | * @driver_features: per-device driver features | ||
| 50 | * | ||
| 51 | * Drivers can clear specific flags here to disallow | ||
| 52 | * certain features on a per-device basis while still | ||
| 53 | * sharing a single &struct drm_driver instance across | ||
| 54 | * all devices. | ||
| 55 | */ | ||
| 56 | u32 driver_features; | ||
| 57 | |||
| 58 | /** | ||
| 49 | * @unplugged: | 59 | * @unplugged: |
| 50 | * | 60 | * |
| 51 | * Flag to tell if the device has been unplugged. | 61 | * Flag to tell if the device has been unplugged. |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 05cc31b5db16..2a3843f248cf 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
| @@ -123,8 +123,9 @@ | |||
| 123 | # define DP_FRAMING_CHANGE_CAP (1 << 1) | 123 | # define DP_FRAMING_CHANGE_CAP (1 << 1) |
| 124 | # define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher */ | 124 | # define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher */ |
| 125 | 125 | ||
| 126 | #define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ | 126 | #define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ |
| 127 | # define DP_TRAINING_AUX_RD_MASK 0x7F /* XXX 1.2? */ | 127 | # define DP_TRAINING_AUX_RD_MASK 0x7F /* DP 1.3 */ |
| 128 | # define DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT (1 << 7) /* DP 1.3 */ | ||
| 128 | 129 | ||
| 129 | #define DP_ADAPTER_CAP 0x00f /* 1.2 */ | 130 | #define DP_ADAPTER_CAP 0x00f /* 1.2 */ |
| 130 | # define DP_FORCE_LOAD_SENSE_CAP (1 << 0) | 131 | # define DP_FORCE_LOAD_SENSE_CAP (1 << 0) |
| @@ -1260,12 +1261,12 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, | |||
| 1260 | */ | 1261 | */ |
| 1261 | enum drm_dp_quirk { | 1262 | enum drm_dp_quirk { |
| 1262 | /** | 1263 | /** |
| 1263 | * @DP_DPCD_QUIRK_LIMITED_M_N: | 1264 | * @DP_DPCD_QUIRK_CONSTANT_N: |
| 1264 | * | 1265 | * |
| 1265 | * The device requires main link attributes Mvid and Nvid to be limited | 1266 | * The device requires main link attributes Mvid and Nvid to be limited |
| 1266 | * to 16 bits. | 1267 | * to 16 bits. So will give a constant value (0x8000) for compatability. |
| 1267 | */ | 1268 | */ |
| 1268 | DP_DPCD_QUIRK_LIMITED_M_N, | 1269 | DP_DPCD_QUIRK_CONSTANT_N, |
| 1269 | }; | 1270 | }; |
| 1270 | 1271 | ||
| 1271 | /** | 1272 | /** |
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 152b3055e9e1..3199ef70c007 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h | |||
| @@ -56,7 +56,6 @@ struct drm_printer; | |||
| 56 | #define DRIVER_ATOMIC 0x10000 | 56 | #define DRIVER_ATOMIC 0x10000 |
| 57 | #define DRIVER_KMS_LEGACY_CONTEXT 0x20000 | 57 | #define DRIVER_KMS_LEGACY_CONTEXT 0x20000 |
| 58 | #define DRIVER_SYNCOBJ 0x40000 | 58 | #define DRIVER_SYNCOBJ 0x40000 |
| 59 | #define DRIVER_PREFER_XBGR_30BPP 0x80000 | ||
| 60 | 59 | ||
| 61 | /** | 60 | /** |
| 62 | * struct drm_driver - DRM driver structure | 61 | * struct drm_driver - DRM driver structure |
| @@ -654,14 +653,14 @@ static inline bool drm_dev_is_unplugged(struct drm_device *dev) | |||
| 654 | * @dev: DRM device to check | 653 | * @dev: DRM device to check |
| 655 | * @feature: feature flag | 654 | * @feature: feature flag |
| 656 | * | 655 | * |
| 657 | * This checks @dev for driver features, see &drm_driver.driver_features and the | 656 | * This checks @dev for driver features, see &drm_driver.driver_features, |
| 658 | * various DRIVER_\* flags. | 657 | * &drm_device.driver_features, and the various DRIVER_\* flags. |
| 659 | * | 658 | * |
| 660 | * Returns true if the @feature is supported, false otherwise. | 659 | * Returns true if the @feature is supported, false otherwise. |
| 661 | */ | 660 | */ |
| 662 | static inline bool drm_core_check_feature(struct drm_device *dev, int feature) | 661 | static inline bool drm_core_check_feature(struct drm_device *dev, u32 feature) |
| 663 | { | 662 | { |
| 664 | return dev->driver->driver_features & feature; | 663 | return dev->driver->driver_features & dev->driver_features & feature; |
| 665 | } | 664 | } |
| 666 | 665 | ||
| 667 | /** | 666 | /** |
diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 4f597c0730b4..70cfca03d812 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <drm/drm_crtc.h> | 28 | #include <drm/drm_crtc.h> |
| 29 | #include <drm/drm_mode.h> | 29 | #include <drm/drm_mode.h> |
| 30 | #include <drm/drm_mode_object.h> | 30 | #include <drm/drm_mode_object.h> |
| 31 | #include <drm/drm_util.h> | ||
| 31 | 32 | ||
| 32 | struct drm_encoder; | 33 | struct drm_encoder; |
| 33 | 34 | ||
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index 96e26e3b9a0c..4a65f0d155b0 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h | |||
| @@ -26,7 +26,6 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma); | |||
| 26 | 26 | ||
| 27 | void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma); | 27 | void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma); |
| 28 | void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma); | 28 | void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma); |
| 29 | void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state); | ||
| 30 | void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma, | 29 | void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma, |
| 31 | bool state); | 30 | bool state); |
| 32 | 31 | ||
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 5db08c8f1d25..bb9acea61369 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
| @@ -604,6 +604,16 @@ drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp) | |||
| 604 | 604 | ||
| 605 | #endif | 605 | #endif |
| 606 | 606 | ||
| 607 | /** | ||
| 608 | * drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers | ||
| 609 | * @a: memory range, users of which are to be removed | ||
| 610 | * @name: requesting driver name | ||
| 611 | * @primary: also kick vga16fb if present | ||
| 612 | * | ||
| 613 | * This function removes framebuffer devices (initialized by firmware/bootloader) | ||
| 614 | * which use memory range described by @a. If @a is NULL all such devices are | ||
| 615 | * removed. | ||
| 616 | */ | ||
| 607 | static inline int | 617 | static inline int |
| 608 | drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, | 618 | drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, |
| 609 | const char *name, bool primary) | 619 | const char *name, bool primary) |
| @@ -615,4 +625,28 @@ drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, | |||
| 615 | #endif | 625 | #endif |
| 616 | } | 626 | } |
| 617 | 627 | ||
| 628 | /** | ||
| 629 | * drm_fb_helper_remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices | ||
| 630 | * @pdev: PCI device | ||
| 631 | * @resource_id: index of PCI BAR configuring framebuffer memory | ||
| 632 | * @name: requesting driver name | ||
| 633 | * | ||
| 634 | * This function removes framebuffer devices (eg. initialized by firmware) | ||
| 635 | * using memory range configured for @pdev's BAR @resource_id. | ||
| 636 | * | ||
| 637 | * The function assumes that PCI device with shadowed ROM drives a primary | ||
| 638 | * display and so kicks out vga16fb. | ||
| 639 | */ | ||
| 640 | static inline int | ||
| 641 | drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev, | ||
| 642 | int resource_id, | ||
| 643 | const char *name) | ||
| 644 | { | ||
| 645 | #if IS_REACHABLE(CONFIG_FB) | ||
| 646 | return remove_conflicting_pci_framebuffers(pdev, resource_id, name); | ||
| 647 | #else | ||
| 648 | return 0; | ||
| 649 | #endif | ||
| 650 | } | ||
| 651 | |||
| 618 | #endif | 652 | #endif |
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index f9c15845f465..865ef60c17af 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h | |||
| @@ -25,6 +25,28 @@ | |||
| 25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 26 | #include <uapi/drm/drm_fourcc.h> | 26 | #include <uapi/drm/drm_fourcc.h> |
| 27 | 27 | ||
| 28 | /* | ||
| 29 | * DRM formats are little endian. Define host endian variants for the | ||
| 30 | * most common formats here, to reduce the #ifdefs needed in drivers. | ||
| 31 | * | ||
| 32 | * Note that the DRM_FORMAT_BIG_ENDIAN flag should only be used in | ||
| 33 | * case the format can't be specified otherwise, so we don't end up | ||
| 34 | * with two values describing the same format. | ||
| 35 | */ | ||
| 36 | #ifdef __BIG_ENDIAN | ||
| 37 | # define DRM_FORMAT_HOST_XRGB1555 (DRM_FORMAT_XRGB1555 | \ | ||
| 38 | DRM_FORMAT_BIG_ENDIAN) | ||
| 39 | # define DRM_FORMAT_HOST_RGB565 (DRM_FORMAT_RGB565 | \ | ||
| 40 | DRM_FORMAT_BIG_ENDIAN) | ||
| 41 | # define DRM_FORMAT_HOST_XRGB8888 DRM_FORMAT_BGRX8888 | ||
| 42 | # define DRM_FORMAT_HOST_ARGB8888 DRM_FORMAT_BGRA8888 | ||
| 43 | #else | ||
| 44 | # define DRM_FORMAT_HOST_XRGB1555 DRM_FORMAT_XRGB1555 | ||
| 45 | # define DRM_FORMAT_HOST_RGB565 DRM_FORMAT_RGB565 | ||
| 46 | # define DRM_FORMAT_HOST_XRGB8888 DRM_FORMAT_XRGB8888 | ||
| 47 | # define DRM_FORMAT_HOST_ARGB8888 DRM_FORMAT_ARGB8888 | ||
| 48 | #endif | ||
| 49 | |||
| 28 | struct drm_device; | 50 | struct drm_device; |
| 29 | struct drm_mode_fb_cmd2; | 51 | struct drm_mode_fb_cmd2; |
| 30 | 52 | ||
| @@ -66,6 +88,8 @@ const struct drm_format_info * | |||
| 66 | drm_get_format_info(struct drm_device *dev, | 88 | drm_get_format_info(struct drm_device *dev, |
| 67 | const struct drm_mode_fb_cmd2 *mode_cmd); | 89 | const struct drm_mode_fb_cmd2 *mode_cmd); |
| 68 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); | 90 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); |
| 91 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, | ||
| 92 | uint32_t bpp, uint32_t depth); | ||
| 69 | int drm_format_num_planes(uint32_t format); | 93 | int drm_format_num_planes(uint32_t format); |
| 70 | int drm_format_plane_cpp(uint32_t format, int plane); | 94 | int drm_format_plane_cpp(uint32_t format, int plane); |
| 71 | int drm_format_horz_chroma_subsampling(uint32_t format); | 95 | int drm_format_horz_chroma_subsampling(uint32_t format); |
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index a0b202e1d69a..928e4172a0bb 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h | |||
| @@ -809,6 +809,21 @@ struct drm_mode_config { | |||
| 809 | 809 | ||
| 810 | /* dumb ioctl parameters */ | 810 | /* dumb ioctl parameters */ |
| 811 | uint32_t preferred_depth, prefer_shadow; | 811 | uint32_t preferred_depth, prefer_shadow; |
| 812 | bool quirk_addfb_prefer_xbgr_30bpp; | ||
| 813 | |||
| 814 | /** | ||
| 815 | * @quirk_addfb_prefer_host_byte_order: | ||
| 816 | * | ||
| 817 | * When set to true drm_mode_addfb() will pick host byte order | ||
| 818 | * pixel_format when calling drm_mode_addfb2(). This is how | ||
| 819 | * drm_mode_addfb() should have worked from day one. It | ||
| 820 | * didn't though, so we ended up with quirks in both kernel | ||
| 821 | * and userspace drivers to deal with the broken behavior. | ||
| 822 | * Simply fixing drm_mode_addfb() unconditionally would break | ||
| 823 | * these drivers, so add a quirk bit here to allow drivers | ||
| 824 | * opt-in. | ||
| 825 | */ | ||
| 826 | bool quirk_addfb_prefer_host_byte_order; | ||
| 812 | 827 | ||
| 813 | /** | 828 | /** |
| 814 | * @async_page_flip: Does this device support async flips on the primary | 829 | * @async_page_flip: Does this device support async flips on the primary |
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 777814755fa6..8c738c0e6e9f 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h | |||
| @@ -82,6 +82,7 @@ struct drm_panel_funcs { | |||
| 82 | * @drm: DRM device owning the panel | 82 | * @drm: DRM device owning the panel |
| 83 | * @connector: DRM connector that the panel is attached to | 83 | * @connector: DRM connector that the panel is attached to |
| 84 | * @dev: parent device of the panel | 84 | * @dev: parent device of the panel |
| 85 | * @link: link from panel device (supplier) to DRM device (consumer) | ||
| 85 | * @funcs: operations that can be performed on the panel | 86 | * @funcs: operations that can be performed on the panel |
| 86 | * @list: panel entry in registry | 87 | * @list: panel entry in registry |
| 87 | */ | 88 | */ |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 683742826511..b7e899ce44f0 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: MIT */ |
| 2 | #define radeon_PCI_IDS \ | 2 | #define radeon_PCI_IDS \ |
| 3 | {0x1002, 0x1304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 3 | {0x1002, 0x1304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 4 | {0x1002, 0x1305, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 4 | {0x1002, 0x1305, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 8a152dc16ea5..0a0834bef8bd 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h | |||
| @@ -27,6 +27,9 @@ | |||
| 27 | #include <linux/ctype.h> | 27 | #include <linux/ctype.h> |
| 28 | #include <drm/drm_mode_object.h> | 28 | #include <drm/drm_mode_object.h> |
| 29 | #include <drm/drm_color_mgmt.h> | 29 | #include <drm/drm_color_mgmt.h> |
| 30 | #include <drm/drm_rect.h> | ||
| 31 | #include <drm/drm_modeset_lock.h> | ||
| 32 | #include <drm/drm_util.h> | ||
| 30 | 33 | ||
| 31 | struct drm_crtc; | 34 | struct drm_crtc; |
| 32 | struct drm_printer; | 35 | struct drm_printer; |
| @@ -119,6 +122,14 @@ struct drm_plane_state { | |||
| 119 | u16 alpha; | 122 | u16 alpha; |
| 120 | 123 | ||
| 121 | /** | 124 | /** |
| 125 | * @pixel_blend_mode: | ||
| 126 | * The alpha blending equation selection, describing how the pixels from | ||
| 127 | * the current plane are composited with the background. Value can be | ||
| 128 | * one of DRM_MODE_BLEND_* | ||
| 129 | */ | ||
| 130 | uint16_t pixel_blend_mode; | ||
| 131 | |||
| 132 | /** | ||
| 122 | * @rotation: | 133 | * @rotation: |
| 123 | * Rotation of the plane. See drm_plane_create_rotation_property() for | 134 | * Rotation of the plane. See drm_plane_create_rotation_property() for |
| 124 | * more details. | 135 | * more details. |
| @@ -659,6 +670,14 @@ struct drm_plane { | |||
| 659 | * drm_plane_create_rotation_property(). | 670 | * drm_plane_create_rotation_property(). |
| 660 | */ | 671 | */ |
| 661 | struct drm_property *rotation_property; | 672 | struct drm_property *rotation_property; |
| 673 | /** | ||
| 674 | * @blend_mode_property: | ||
| 675 | * Optional "pixel blend mode" enum property for this plane. | ||
| 676 | * Blend mode property represents the alpha blending equation selection, | ||
| 677 | * describing how the pixels from the current plane are composited with | ||
| 678 | * the background. | ||
| 679 | */ | ||
| 680 | struct drm_property *blend_mode_property; | ||
| 662 | 681 | ||
| 663 | /** | 682 | /** |
| 664 | * @color_encoding_property: | 683 | * @color_encoding_property: |
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index f3e6eed3e79c..afbc3beef089 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h | |||
| @@ -381,7 +381,7 @@ void drm_err(const char *format, ...); | |||
| 381 | 381 | ||
| 382 | #define DRM_DEV_DEBUG_DP(dev, fmt, ...) \ | 382 | #define DRM_DEV_DEBUG_DP(dev, fmt, ...) \ |
| 383 | drm_dev_dbg(dev, DRM_UT_DP, fmt, ## __VA_ARGS__) | 383 | drm_dev_dbg(dev, DRM_UT_DP, fmt, ## __VA_ARGS__) |
| 384 | #define DRM_DEBUG_DP(dev, fmt, ...) \ | 384 | #define DRM_DEBUG_DP(fmt, ...) \ |
| 385 | drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__) | 385 | drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__) |
| 386 | 386 | ||
| 387 | #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...) \ | 387 | #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...) \ |
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h index c030f6ccab99..5b9efff35d6d 100644 --- a/include/drm/drm_property.h +++ b/include/drm/drm_property.h | |||
| @@ -27,6 +27,8 @@ | |||
| 27 | #include <linux/ctype.h> | 27 | #include <linux/ctype.h> |
| 28 | #include <drm/drm_mode_object.h> | 28 | #include <drm/drm_mode_object.h> |
| 29 | 29 | ||
| 30 | #include <uapi/drm/drm_mode.h> | ||
| 31 | |||
| 30 | /** | 32 | /** |
| 31 | * struct drm_property_enum - symbolic values for enumerations | 33 | * struct drm_property_enum - symbolic values for enumerations |
| 32 | * @value: numeric property value for this enum entry | 34 | * @value: numeric property value for this enum entry |
diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 3980602472c0..425432b85a87 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h | |||
| @@ -131,15 +131,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj) | |||
| 131 | 131 | ||
| 132 | struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, | 132 | struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, |
| 133 | u32 handle); | 133 | u32 handle); |
| 134 | void drm_syncobj_add_callback(struct drm_syncobj *syncobj, | 134 | void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, u64 point, |
| 135 | struct drm_syncobj_cb *cb, | ||
| 136 | drm_syncobj_func_t func); | ||
| 137 | void drm_syncobj_remove_callback(struct drm_syncobj *syncobj, | ||
| 138 | struct drm_syncobj_cb *cb); | ||
| 139 | void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, | ||
| 140 | struct dma_fence *fence); | 135 | struct dma_fence *fence); |
| 141 | int drm_syncobj_find_fence(struct drm_file *file_private, | 136 | int drm_syncobj_find_fence(struct drm_file *file_private, |
| 142 | u32 handle, | 137 | u32 handle, u64 point, |
| 143 | struct dma_fence **fence); | 138 | struct dma_fence **fence); |
| 144 | void drm_syncobj_free(struct kref *kref); | 139 | void drm_syncobj_free(struct kref *kref); |
| 145 | int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, | 140 | int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, |
diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h new file mode 100644 index 000000000000..88abdca89baa --- /dev/null +++ b/include/drm/drm_util.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* | ||
| 2 | * Internal Header for the Direct Rendering Manager | ||
| 3 | * | ||
| 4 | * Copyright 2018 Intel Corporation | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the "Software"), | ||
| 8 | * to deal in the Software without restriction, including without limitation | ||
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 11 | * Software is furnished to do so, subject to the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice (including the next | ||
| 14 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 15 | * Software. | ||
| 16 | * | ||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 20 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 23 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef _DRM_UTIL_H_ | ||
| 27 | #define _DRM_UTIL_H_ | ||
| 28 | |||
| 29 | /* helper for handling conditionals in various for_each macros */ | ||
| 30 | #define for_each_if(condition) if (!(condition)) {} else | ||
| 31 | |||
| 32 | #endif | ||
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 21c648b0b2a1..d87b268f1781 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h | |||
| @@ -50,7 +50,10 @@ enum drm_sched_priority { | |||
| 50 | * | 50 | * |
| 51 | * @list: used to append this struct to the list of entities in the | 51 | * @list: used to append this struct to the list of entities in the |
| 52 | * runqueue. | 52 | * runqueue. |
| 53 | * @rq: runqueue to which this entity belongs. | 53 | * @rq: runqueue on which this entity is currently scheduled. |
| 54 | * @rq_list: a list of run queues on which jobs from this entity can | ||
| 55 | * be scheduled | ||
| 56 | * @num_rq_list: number of run queues in the rq_list | ||
| 54 | * @rq_lock: lock to modify the runqueue to which this entity belongs. | 57 | * @rq_lock: lock to modify the runqueue to which this entity belongs. |
| 55 | * @job_queue: the list of jobs of this entity. | 58 | * @job_queue: the list of jobs of this entity. |
| 56 | * @fence_seq: a linearly increasing seqno incremented with each | 59 | * @fence_seq: a linearly increasing seqno incremented with each |
| @@ -67,6 +70,7 @@ enum drm_sched_priority { | |||
| 67 | * @fini_status: contains the exit status in case the process was signalled. | 70 | * @fini_status: contains the exit status in case the process was signalled. |
| 68 | * @last_scheduled: points to the finished fence of the last scheduled job. | 71 | * @last_scheduled: points to the finished fence of the last scheduled job. |
| 69 | * @last_user: last group leader pushing a job into the entity. | 72 | * @last_user: last group leader pushing a job into the entity. |
| 73 | * @stopped: Marks the enity as removed from rq and destined for termination. | ||
| 70 | * | 74 | * |
| 71 | * Entities will emit jobs in order to their corresponding hardware | 75 | * Entities will emit jobs in order to their corresponding hardware |
| 72 | * ring, and the scheduler will alternate between entities based on | 76 | * ring, and the scheduler will alternate between entities based on |
| @@ -75,6 +79,8 @@ enum drm_sched_priority { | |||
| 75 | struct drm_sched_entity { | 79 | struct drm_sched_entity { |
| 76 | struct list_head list; | 80 | struct list_head list; |
| 77 | struct drm_sched_rq *rq; | 81 | struct drm_sched_rq *rq; |
| 82 | struct drm_sched_rq **rq_list; | ||
| 83 | unsigned int num_rq_list; | ||
| 78 | spinlock_t rq_lock; | 84 | spinlock_t rq_lock; |
| 79 | 85 | ||
| 80 | struct spsc_queue job_queue; | 86 | struct spsc_queue job_queue; |
| @@ -87,6 +93,7 @@ struct drm_sched_entity { | |||
| 87 | atomic_t *guilty; | 93 | atomic_t *guilty; |
| 88 | struct dma_fence *last_scheduled; | 94 | struct dma_fence *last_scheduled; |
| 89 | struct task_struct *last_user; | 95 | struct task_struct *last_user; |
| 96 | bool stopped; | ||
| 90 | }; | 97 | }; |
| 91 | 98 | ||
| 92 | /** | 99 | /** |
| @@ -168,8 +175,6 @@ struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f); | |||
| 168 | * finished to remove the job from the | 175 | * finished to remove the job from the |
| 169 | * @drm_gpu_scheduler.ring_mirror_list. | 176 | * @drm_gpu_scheduler.ring_mirror_list. |
| 170 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. | 177 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. |
| 171 | * @work_tdr: schedules a delayed call to @drm_sched_job_timedout after the timeout | ||
| 172 | * interval is over. | ||
| 173 | * @id: a unique id assigned to each job scheduled on the scheduler. | 178 | * @id: a unique id assigned to each job scheduled on the scheduler. |
| 174 | * @karma: increment on every hang caused by this job. If this exceeds the hang | 179 | * @karma: increment on every hang caused by this job. If this exceeds the hang |
| 175 | * limit of the scheduler then the job is marked guilty and will not | 180 | * limit of the scheduler then the job is marked guilty and will not |
| @@ -188,7 +193,6 @@ struct drm_sched_job { | |||
| 188 | struct dma_fence_cb finish_cb; | 193 | struct dma_fence_cb finish_cb; |
| 189 | struct work_struct finish_work; | 194 | struct work_struct finish_work; |
| 190 | struct list_head node; | 195 | struct list_head node; |
| 191 | struct delayed_work work_tdr; | ||
| 192 | uint64_t id; | 196 | uint64_t id; |
| 193 | atomic_t karma; | 197 | atomic_t karma; |
| 194 | enum drm_sched_priority s_priority; | 198 | enum drm_sched_priority s_priority; |
| @@ -252,11 +256,14 @@ struct drm_sched_backend_ops { | |||
| 252 | * finished. | 256 | * finished. |
| 253 | * @hw_rq_count: the number of jobs currently in the hardware queue. | 257 | * @hw_rq_count: the number of jobs currently in the hardware queue. |
| 254 | * @job_id_count: used to assign unique id to the each job. | 258 | * @job_id_count: used to assign unique id to the each job. |
| 259 | * @work_tdr: schedules a delayed call to @drm_sched_job_timedout after the | ||
| 260 | * timeout interval is over. | ||
| 255 | * @thread: the kthread on which the scheduler which run. | 261 | * @thread: the kthread on which the scheduler which run. |
| 256 | * @ring_mirror_list: the list of jobs which are currently in the job queue. | 262 | * @ring_mirror_list: the list of jobs which are currently in the job queue. |
| 257 | * @job_list_lock: lock to protect the ring_mirror_list. | 263 | * @job_list_lock: lock to protect the ring_mirror_list. |
| 258 | * @hang_limit: once the hangs by a job crosses this limit then it is marked | 264 | * @hang_limit: once the hangs by a job crosses this limit then it is marked |
| 259 | * guilty and it will be considered for scheduling further. | 265 | * guilty and it will be considered for scheduling further. |
| 266 | * @num_jobs: the number of jobs in queue in the scheduler | ||
| 260 | * | 267 | * |
| 261 | * One scheduler is implemented for each hardware ring. | 268 | * One scheduler is implemented for each hardware ring. |
| 262 | */ | 269 | */ |
| @@ -270,10 +277,12 @@ struct drm_gpu_scheduler { | |||
| 270 | wait_queue_head_t job_scheduled; | 277 | wait_queue_head_t job_scheduled; |
| 271 | atomic_t hw_rq_count; | 278 | atomic_t hw_rq_count; |
| 272 | atomic64_t job_id_count; | 279 | atomic64_t job_id_count; |
| 280 | struct delayed_work work_tdr; | ||
| 273 | struct task_struct *thread; | 281 | struct task_struct *thread; |
| 274 | struct list_head ring_mirror_list; | 282 | struct list_head ring_mirror_list; |
| 275 | spinlock_t job_list_lock; | 283 | spinlock_t job_list_lock; |
| 276 | int hang_limit; | 284 | int hang_limit; |
| 285 | atomic_t num_jobs; | ||
| 277 | }; | 286 | }; |
| 278 | 287 | ||
| 279 | int drm_sched_init(struct drm_gpu_scheduler *sched, | 288 | int drm_sched_init(struct drm_gpu_scheduler *sched, |
| @@ -281,6 +290,21 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, | |||
| 281 | uint32_t hw_submission, unsigned hang_limit, long timeout, | 290 | uint32_t hw_submission, unsigned hang_limit, long timeout, |
| 282 | const char *name); | 291 | const char *name); |
| 283 | void drm_sched_fini(struct drm_gpu_scheduler *sched); | 292 | void drm_sched_fini(struct drm_gpu_scheduler *sched); |
| 293 | int drm_sched_job_init(struct drm_sched_job *job, | ||
| 294 | struct drm_sched_entity *entity, | ||
| 295 | void *owner); | ||
| 296 | void drm_sched_wakeup(struct drm_gpu_scheduler *sched); | ||
| 297 | void drm_sched_hw_job_reset(struct drm_gpu_scheduler *sched, | ||
| 298 | struct drm_sched_job *job); | ||
| 299 | void drm_sched_job_recovery(struct drm_gpu_scheduler *sched); | ||
| 300 | bool drm_sched_dependency_optimized(struct dma_fence* fence, | ||
| 301 | struct drm_sched_entity *entity); | ||
| 302 | void drm_sched_job_kickout(struct drm_sched_job *s_job); | ||
| 303 | |||
| 304 | void drm_sched_rq_add_entity(struct drm_sched_rq *rq, | ||
| 305 | struct drm_sched_entity *entity); | ||
| 306 | void drm_sched_rq_remove_entity(struct drm_sched_rq *rq, | ||
| 307 | struct drm_sched_entity *entity); | ||
| 284 | 308 | ||
| 285 | int drm_sched_entity_init(struct drm_sched_entity *entity, | 309 | int drm_sched_entity_init(struct drm_sched_entity *entity, |
| 286 | struct drm_sched_rq **rq_list, | 310 | struct drm_sched_rq **rq_list, |
| @@ -289,23 +313,17 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, | |||
| 289 | long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout); | 313 | long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout); |
| 290 | void drm_sched_entity_fini(struct drm_sched_entity *entity); | 314 | void drm_sched_entity_fini(struct drm_sched_entity *entity); |
| 291 | void drm_sched_entity_destroy(struct drm_sched_entity *entity); | 315 | void drm_sched_entity_destroy(struct drm_sched_entity *entity); |
| 316 | void drm_sched_entity_select_rq(struct drm_sched_entity *entity); | ||
| 317 | struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity *entity); | ||
| 292 | void drm_sched_entity_push_job(struct drm_sched_job *sched_job, | 318 | void drm_sched_entity_push_job(struct drm_sched_job *sched_job, |
| 293 | struct drm_sched_entity *entity); | 319 | struct drm_sched_entity *entity); |
| 294 | void drm_sched_entity_set_rq(struct drm_sched_entity *entity, | 320 | void drm_sched_entity_set_priority(struct drm_sched_entity *entity, |
| 295 | struct drm_sched_rq *rq); | 321 | enum drm_sched_priority priority); |
| 322 | bool drm_sched_entity_is_ready(struct drm_sched_entity *entity); | ||
| 296 | 323 | ||
| 297 | struct drm_sched_fence *drm_sched_fence_create( | 324 | struct drm_sched_fence *drm_sched_fence_create( |
| 298 | struct drm_sched_entity *s_entity, void *owner); | 325 | struct drm_sched_entity *s_entity, void *owner); |
| 299 | void drm_sched_fence_scheduled(struct drm_sched_fence *fence); | 326 | void drm_sched_fence_scheduled(struct drm_sched_fence *fence); |
| 300 | void drm_sched_fence_finished(struct drm_sched_fence *fence); | 327 | void drm_sched_fence_finished(struct drm_sched_fence *fence); |
| 301 | int drm_sched_job_init(struct drm_sched_job *job, | ||
| 302 | struct drm_sched_entity *entity, | ||
| 303 | void *owner); | ||
| 304 | void drm_sched_hw_job_reset(struct drm_gpu_scheduler *sched, | ||
| 305 | struct drm_sched_job *job); | ||
| 306 | void drm_sched_job_recovery(struct drm_gpu_scheduler *sched); | ||
| 307 | bool drm_sched_dependency_optimized(struct dma_fence* fence, | ||
| 308 | struct drm_sched_entity *entity); | ||
| 309 | void drm_sched_job_kickout(struct drm_sched_job *s_job); | ||
| 310 | 328 | ||
| 311 | #endif | 329 | #endif |
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h index fbf5cfc9b352..fd965ffbb92e 100644 --- a/include/drm/i915_pciids.h +++ b/include/drm/i915_pciids.h | |||
| @@ -386,6 +386,7 @@ | |||
| 386 | INTEL_VGA_DEVICE(0x3E91, info), /* SRV GT2 */ \ | 386 | INTEL_VGA_DEVICE(0x3E91, info), /* SRV GT2 */ \ |
| 387 | INTEL_VGA_DEVICE(0x3E92, info), /* SRV GT2 */ \ | 387 | INTEL_VGA_DEVICE(0x3E92, info), /* SRV GT2 */ \ |
| 388 | INTEL_VGA_DEVICE(0x3E96, info), /* SRV GT2 */ \ | 388 | INTEL_VGA_DEVICE(0x3E96, info), /* SRV GT2 */ \ |
| 389 | INTEL_VGA_DEVICE(0x3E98, info), /* SRV GT2 */ \ | ||
| 389 | INTEL_VGA_DEVICE(0x3E9A, info) /* SRV GT2 */ | 390 | INTEL_VGA_DEVICE(0x3E9A, info) /* SRV GT2 */ |
| 390 | 391 | ||
| 391 | /* CFL H */ | 392 | /* CFL H */ |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index a01ba2032f0e..3fc4854dce49 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -51,6 +51,8 @@ struct ttm_placement; | |||
| 51 | 51 | ||
| 52 | struct ttm_place; | 52 | struct ttm_place; |
| 53 | 53 | ||
| 54 | struct ttm_lru_bulk_move; | ||
| 55 | |||
| 54 | /** | 56 | /** |
| 55 | * struct ttm_bus_placement | 57 | * struct ttm_bus_placement |
| 56 | * | 58 | * |
| @@ -311,6 +313,24 @@ ttm_bo_reference(struct ttm_buffer_object *bo) | |||
| 311 | } | 313 | } |
| 312 | 314 | ||
| 313 | /** | 315 | /** |
| 316 | * ttm_bo_get_unless_zero - reference a struct ttm_buffer_object unless | ||
| 317 | * its refcount has already reached zero. | ||
| 318 | * @bo: The buffer object. | ||
| 319 | * | ||
| 320 | * Used to reference a TTM buffer object in lookups where the object is removed | ||
| 321 | * from the lookup structure during the destructor and for RCU lookups. | ||
| 322 | * | ||
| 323 | * Returns: @bo if the referencing was successful, NULL otherwise. | ||
| 324 | */ | ||
| 325 | static inline __must_check struct ttm_buffer_object * | ||
| 326 | ttm_bo_get_unless_zero(struct ttm_buffer_object *bo) | ||
| 327 | { | ||
| 328 | if (!kref_get_unless_zero(&bo->kref)) | ||
| 329 | return NULL; | ||
| 330 | return bo; | ||
| 331 | } | ||
| 332 | |||
| 333 | /** | ||
| 314 | * ttm_bo_wait - wait for buffer idle. | 334 | * ttm_bo_wait - wait for buffer idle. |
| 315 | * | 335 | * |
| 316 | * @bo: The buffer object. | 336 | * @bo: The buffer object. |
| @@ -405,12 +425,24 @@ void ttm_bo_del_from_lru(struct ttm_buffer_object *bo); | |||
| 405 | * ttm_bo_move_to_lru_tail | 425 | * ttm_bo_move_to_lru_tail |
| 406 | * | 426 | * |
| 407 | * @bo: The buffer object. | 427 | * @bo: The buffer object. |
| 428 | * @bulk: optional bulk move structure to remember BO positions | ||
| 408 | * | 429 | * |
| 409 | * Move this BO to the tail of all lru lists used to lookup and reserve an | 430 | * Move this BO to the tail of all lru lists used to lookup and reserve an |
| 410 | * object. This function must be called with struct ttm_bo_global::lru_lock | 431 | * object. This function must be called with struct ttm_bo_global::lru_lock |
| 411 | * held, and is used to make a BO less likely to be considered for eviction. | 432 | * held, and is used to make a BO less likely to be considered for eviction. |
| 412 | */ | 433 | */ |
| 413 | void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo); | 434 | void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, |
| 435 | struct ttm_lru_bulk_move *bulk); | ||
| 436 | |||
| 437 | /** | ||
| 438 | * ttm_bo_bulk_move_lru_tail | ||
| 439 | * | ||
| 440 | * @bulk: bulk move structure | ||
| 441 | * | ||
| 442 | * Bulk move BOs to the LRU tail, only valid to use when driver makes sure that | ||
| 443 | * BO order never changes. Should be called with ttm_bo_global::lru_lock held. | ||
| 444 | */ | ||
| 445 | void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk); | ||
| 414 | 446 | ||
| 415 | /** | 447 | /** |
| 416 | * ttm_bo_lock_delayed_workqueue | 448 | * ttm_bo_lock_delayed_workqueue |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 3234cc322e70..e4fee8e02559 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -491,6 +491,34 @@ struct ttm_bo_device { | |||
| 491 | }; | 491 | }; |
| 492 | 492 | ||
| 493 | /** | 493 | /** |
| 494 | * struct ttm_lru_bulk_move_pos | ||
| 495 | * | ||
| 496 | * @first: first BO in the bulk move range | ||
| 497 | * @last: last BO in the bulk move range | ||
| 498 | * | ||
| 499 | * Positions for a lru bulk move. | ||
| 500 | */ | ||
| 501 | struct ttm_lru_bulk_move_pos { | ||
| 502 | struct ttm_buffer_object *first; | ||
| 503 | struct ttm_buffer_object *last; | ||
| 504 | }; | ||
| 505 | |||
| 506 | /** | ||
| 507 | * struct ttm_lru_bulk_move | ||
| 508 | * | ||
| 509 | * @tt: first/last lru entry for BOs in the TT domain | ||
| 510 | * @vram: first/last lru entry for BOs in the VRAM domain | ||
| 511 | * @swap: first/last lru entry for BOs on the swap list | ||
| 512 | * | ||
| 513 | * Helper structure for bulk moves on the LRU list. | ||
| 514 | */ | ||
| 515 | struct ttm_lru_bulk_move { | ||
| 516 | struct ttm_lru_bulk_move_pos tt[TTM_MAX_BO_PRIORITY]; | ||
| 517 | struct ttm_lru_bulk_move_pos vram[TTM_MAX_BO_PRIORITY]; | ||
| 518 | struct ttm_lru_bulk_move_pos swap[TTM_MAX_BO_PRIORITY]; | ||
| 519 | }; | ||
| 520 | |||
| 521 | /** | ||
| 494 | * ttm_flag_masked | 522 | * ttm_flag_masked |
| 495 | * | 523 | * |
| 496 | * @old: Pointer to the result and original value. | 524 | * @old: Pointer to the result and original value. |
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h deleted file mode 100644 index 0c3af9836863..000000000000 --- a/include/drm/ttm/ttm_lock.h +++ /dev/null | |||
| @@ -1,248 +0,0 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2007-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | |||
| 31 | /** @file ttm_lock.h | ||
| 32 | * This file implements a simple replacement for the buffer manager use | ||
| 33 | * of the DRM heavyweight hardware lock. | ||
| 34 | * The lock is a read-write lock. Taking it in read mode and write mode | ||
| 35 | * is relatively fast, and intended for in-kernel use only. | ||
| 36 | * | ||
| 37 | * The vt mode is used only when there is a need to block all | ||
| 38 | * user-space processes from validating buffers. | ||
| 39 | * It's allowed to leave kernel space with the vt lock held. | ||
| 40 | * If a user-space process dies while having the vt-lock, | ||
| 41 | * it will be released during the file descriptor release. The vt lock | ||
| 42 | * excludes write lock and read lock. | ||
| 43 | * | ||
| 44 | * The suspend mode is used to lock out all TTM users when preparing for | ||
| 45 | * and executing suspend operations. | ||
| 46 | * | ||
| 47 | */ | ||
| 48 | |||
| 49 | #ifndef _TTM_LOCK_H_ | ||
| 50 | #define _TTM_LOCK_H_ | ||
| 51 | |||
| 52 | #include <linux/wait.h> | ||
| 53 | #include <linux/atomic.h> | ||
| 54 | |||
| 55 | #include "ttm_object.h" | ||
| 56 | |||
| 57 | /** | ||
| 58 | * struct ttm_lock | ||
| 59 | * | ||
| 60 | * @base: ttm base object used solely to release the lock if the client | ||
| 61 | * holding the lock dies. | ||
| 62 | * @queue: Queue for processes waiting for lock change-of-status. | ||
| 63 | * @lock: Spinlock protecting some lock members. | ||
| 64 | * @rw: Read-write lock counter. Protected by @lock. | ||
| 65 | * @flags: Lock state. Protected by @lock. | ||
| 66 | * @kill_takers: Boolean whether to kill takers of the lock. | ||
| 67 | * @signal: Signal to send when kill_takers is true. | ||
| 68 | */ | ||
| 69 | |||
| 70 | struct ttm_lock { | ||
| 71 | struct ttm_base_object base; | ||
| 72 | wait_queue_head_t queue; | ||
| 73 | spinlock_t lock; | ||
| 74 | int32_t rw; | ||
| 75 | uint32_t flags; | ||
| 76 | bool kill_takers; | ||
| 77 | int signal; | ||
| 78 | struct ttm_object_file *vt_holder; | ||
| 79 | }; | ||
| 80 | |||
| 81 | |||
| 82 | /** | ||
| 83 | * ttm_lock_init | ||
| 84 | * | ||
| 85 | * @lock: Pointer to a struct ttm_lock | ||
| 86 | * Initializes the lock. | ||
| 87 | */ | ||
| 88 | extern void ttm_lock_init(struct ttm_lock *lock); | ||
| 89 | |||
| 90 | /** | ||
| 91 | * ttm_read_unlock | ||
| 92 | * | ||
| 93 | * @lock: Pointer to a struct ttm_lock | ||
| 94 | * | ||
| 95 | * Releases a read lock. | ||
| 96 | */ | ||
| 97 | extern void ttm_read_unlock(struct ttm_lock *lock); | ||
| 98 | |||
| 99 | /** | ||
| 100 | * ttm_read_lock | ||
| 101 | * | ||
| 102 | * @lock: Pointer to a struct ttm_lock | ||
| 103 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 104 | * | ||
| 105 | * Takes the lock in read mode. | ||
| 106 | * Returns: | ||
| 107 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 108 | */ | ||
| 109 | extern int ttm_read_lock(struct ttm_lock *lock, bool interruptible); | ||
| 110 | |||
| 111 | /** | ||
| 112 | * ttm_read_trylock | ||
| 113 | * | ||
| 114 | * @lock: Pointer to a struct ttm_lock | ||
| 115 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 116 | * | ||
| 117 | * Tries to take the lock in read mode. If the lock is already held | ||
| 118 | * in write mode, the function will return -EBUSY. If the lock is held | ||
| 119 | * in vt or suspend mode, the function will sleep until these modes | ||
| 120 | * are unlocked. | ||
| 121 | * | ||
| 122 | * Returns: | ||
| 123 | * -EBUSY The lock was already held in write mode. | ||
| 124 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 125 | */ | ||
| 126 | extern int ttm_read_trylock(struct ttm_lock *lock, bool interruptible); | ||
| 127 | |||
| 128 | /** | ||
| 129 | * ttm_write_unlock | ||
| 130 | * | ||
| 131 | * @lock: Pointer to a struct ttm_lock | ||
| 132 | * | ||
| 133 | * Releases a write lock. | ||
| 134 | */ | ||
| 135 | extern void ttm_write_unlock(struct ttm_lock *lock); | ||
| 136 | |||
| 137 | /** | ||
| 138 | * ttm_write_lock | ||
| 139 | * | ||
| 140 | * @lock: Pointer to a struct ttm_lock | ||
| 141 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 142 | * | ||
| 143 | * Takes the lock in write mode. | ||
| 144 | * Returns: | ||
| 145 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 146 | */ | ||
| 147 | extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); | ||
| 148 | |||
| 149 | /** | ||
| 150 | * ttm_lock_downgrade | ||
| 151 | * | ||
| 152 | * @lock: Pointer to a struct ttm_lock | ||
| 153 | * | ||
| 154 | * Downgrades a write lock to a read lock. | ||
| 155 | */ | ||
| 156 | extern void ttm_lock_downgrade(struct ttm_lock *lock); | ||
| 157 | |||
| 158 | /** | ||
| 159 | * ttm_suspend_lock | ||
| 160 | * | ||
| 161 | * @lock: Pointer to a struct ttm_lock | ||
| 162 | * | ||
| 163 | * Takes the lock in suspend mode. Excludes read and write mode. | ||
| 164 | */ | ||
| 165 | extern void ttm_suspend_lock(struct ttm_lock *lock); | ||
| 166 | |||
| 167 | /** | ||
| 168 | * ttm_suspend_unlock | ||
| 169 | * | ||
| 170 | * @lock: Pointer to a struct ttm_lock | ||
| 171 | * | ||
| 172 | * Releases a suspend lock | ||
| 173 | */ | ||
| 174 | extern void ttm_suspend_unlock(struct ttm_lock *lock); | ||
| 175 | |||
| 176 | /** | ||
| 177 | * ttm_vt_lock | ||
| 178 | * | ||
| 179 | * @lock: Pointer to a struct ttm_lock | ||
| 180 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 181 | * @tfile: Pointer to a struct ttm_object_file to register the lock with. | ||
| 182 | * | ||
| 183 | * Takes the lock in vt mode. | ||
| 184 | * Returns: | ||
| 185 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 186 | * -ENOMEM: Out of memory when locking. | ||
| 187 | */ | ||
| 188 | extern int ttm_vt_lock(struct ttm_lock *lock, bool interruptible, | ||
| 189 | struct ttm_object_file *tfile); | ||
| 190 | |||
| 191 | /** | ||
| 192 | * ttm_vt_unlock | ||
| 193 | * | ||
| 194 | * @lock: Pointer to a struct ttm_lock | ||
| 195 | * | ||
| 196 | * Releases a vt lock. | ||
| 197 | * Returns: | ||
| 198 | * -EINVAL If the lock was not held. | ||
| 199 | */ | ||
| 200 | extern int ttm_vt_unlock(struct ttm_lock *lock); | ||
| 201 | |||
| 202 | /** | ||
| 203 | * ttm_write_unlock | ||
| 204 | * | ||
| 205 | * @lock: Pointer to a struct ttm_lock | ||
| 206 | * | ||
| 207 | * Releases a write lock. | ||
| 208 | */ | ||
| 209 | extern void ttm_write_unlock(struct ttm_lock *lock); | ||
| 210 | |||
| 211 | /** | ||
| 212 | * ttm_write_lock | ||
| 213 | * | ||
| 214 | * @lock: Pointer to a struct ttm_lock | ||
| 215 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
| 216 | * | ||
| 217 | * Takes the lock in write mode. | ||
| 218 | * Returns: | ||
| 219 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
| 220 | */ | ||
| 221 | extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); | ||
| 222 | |||
| 223 | /** | ||
| 224 | * ttm_lock_set_kill | ||
| 225 | * | ||
| 226 | * @lock: Pointer to a struct ttm_lock | ||
| 227 | * @val: Boolean whether to kill processes taking the lock. | ||
| 228 | * @signal: Signal to send to the process taking the lock. | ||
| 229 | * | ||
| 230 | * The kill-when-taking-lock functionality is used to kill processes that keep | ||
| 231 | * on using the TTM functionality when its resources has been taken down, for | ||
| 232 | * example when the X server exits. A typical sequence would look like this: | ||
| 233 | * - X server takes lock in write mode. | ||
| 234 | * - ttm_lock_set_kill() is called with @val set to true. | ||
| 235 | * - As part of X server exit, TTM resources are taken down. | ||
| 236 | * - X server releases the lock on file release. | ||
| 237 | * - Another dri client wants to render, takes the lock and is killed. | ||
| 238 | * | ||
| 239 | */ | ||
| 240 | static inline void ttm_lock_set_kill(struct ttm_lock *lock, bool val, | ||
| 241 | int signal) | ||
| 242 | { | ||
| 243 | lock->kill_takers = val; | ||
| 244 | if (val) | ||
| 245 | lock->signal = signal; | ||
| 246 | } | ||
| 247 | |||
| 248 | #endif | ||
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h deleted file mode 100644 index a98bfeb4239e..000000000000 --- a/include/drm/ttm/ttm_object.h +++ /dev/null | |||
| @@ -1,354 +0,0 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | /** @file ttm_object.h | ||
| 31 | * | ||
| 32 | * Base- and reference object implementation for the various | ||
| 33 | * ttm objects. Implements reference counting, minimal security checks | ||
| 34 | * and release on file close. | ||
| 35 | */ | ||
| 36 | |||
| 37 | #ifndef _TTM_OBJECT_H_ | ||
| 38 | #define _TTM_OBJECT_H_ | ||
| 39 | |||
| 40 | #include <linux/list.h> | ||
| 41 | #include <drm/drm_hashtab.h> | ||
| 42 | #include <linux/kref.h> | ||
| 43 | #include <linux/rcupdate.h> | ||
| 44 | #include <linux/dma-buf.h> | ||
| 45 | |||
| 46 | #include "ttm_memory.h" | ||
| 47 | |||
| 48 | /** | ||
| 49 | * enum ttm_ref_type | ||
| 50 | * | ||
| 51 | * Describes what type of reference a ref object holds. | ||
| 52 | * | ||
| 53 | * TTM_REF_USAGE is a simple refcount on a base object. | ||
| 54 | * | ||
| 55 | * TTM_REF_SYNCCPU_READ is a SYNCCPU_READ reference on a | ||
| 56 | * buffer object. | ||
| 57 | * | ||
| 58 | * TTM_REF_SYNCCPU_WRITE is a SYNCCPU_WRITE reference on a | ||
| 59 | * buffer object. | ||
| 60 | * | ||
| 61 | */ | ||
| 62 | |||
| 63 | enum ttm_ref_type { | ||
| 64 | TTM_REF_USAGE, | ||
| 65 | TTM_REF_SYNCCPU_READ, | ||
| 66 | TTM_REF_SYNCCPU_WRITE, | ||
| 67 | TTM_REF_NUM | ||
| 68 | }; | ||
| 69 | |||
| 70 | /** | ||
| 71 | * enum ttm_object_type | ||
| 72 | * | ||
| 73 | * One entry per ttm object type. | ||
| 74 | * Device-specific types should use the | ||
| 75 | * ttm_driver_typex types. | ||
| 76 | */ | ||
| 77 | |||
| 78 | enum ttm_object_type { | ||
| 79 | ttm_fence_type, | ||
| 80 | ttm_buffer_type, | ||
| 81 | ttm_lock_type, | ||
| 82 | ttm_prime_type, | ||
| 83 | ttm_driver_type0 = 256, | ||
| 84 | ttm_driver_type1, | ||
| 85 | ttm_driver_type2, | ||
| 86 | ttm_driver_type3, | ||
| 87 | ttm_driver_type4, | ||
| 88 | ttm_driver_type5 | ||
| 89 | }; | ||
| 90 | |||
| 91 | struct ttm_object_file; | ||
| 92 | struct ttm_object_device; | ||
| 93 | |||
| 94 | /** | ||
| 95 | * struct ttm_base_object | ||
| 96 | * | ||
| 97 | * @hash: hash entry for the per-device object hash. | ||
| 98 | * @type: derived type this object is base class for. | ||
| 99 | * @shareable: Other ttm_object_files can access this object. | ||
| 100 | * | ||
| 101 | * @tfile: Pointer to ttm_object_file of the creator. | ||
| 102 | * NULL if the object was not created by a user request. | ||
| 103 | * (kernel object). | ||
| 104 | * | ||
| 105 | * @refcount: Number of references to this object, not | ||
| 106 | * including the hash entry. A reference to a base object can | ||
| 107 | * only be held by a ref object. | ||
| 108 | * | ||
| 109 | * @refcount_release: A function to be called when there are | ||
| 110 | * no more references to this object. This function should | ||
| 111 | * destroy the object (or make sure destruction eventually happens), | ||
| 112 | * and when it is called, the object has | ||
| 113 | * already been taken out of the per-device hash. The parameter | ||
| 114 | * "base" should be set to NULL by the function. | ||
| 115 | * | ||
| 116 | * @ref_obj_release: A function to be called when a reference object | ||
| 117 | * with another ttm_ref_type than TTM_REF_USAGE is deleted. | ||
| 118 | * This function may, for example, release a lock held by a user-space | ||
| 119 | * process. | ||
| 120 | * | ||
| 121 | * This struct is intended to be used as a base struct for objects that | ||
| 122 | * are visible to user-space. It provides a global name, race-safe | ||
| 123 | * access and refcounting, minimal access contol and hooks for unref actions. | ||
| 124 | */ | ||
| 125 | |||
| 126 | struct ttm_base_object { | ||
| 127 | struct rcu_head rhead; | ||
| 128 | struct drm_hash_item hash; | ||
| 129 | enum ttm_object_type object_type; | ||
| 130 | bool shareable; | ||
| 131 | struct ttm_object_file *tfile; | ||
| 132 | struct kref refcount; | ||
| 133 | void (*refcount_release) (struct ttm_base_object **base); | ||
| 134 | void (*ref_obj_release) (struct ttm_base_object *base, | ||
| 135 | enum ttm_ref_type ref_type); | ||
| 136 | }; | ||
| 137 | |||
| 138 | |||
| 139 | /** | ||
| 140 | * struct ttm_prime_object - Modified base object that is prime-aware | ||
| 141 | * | ||
| 142 | * @base: struct ttm_base_object that we derive from | ||
| 143 | * @mutex: Mutex protecting the @dma_buf member. | ||
| 144 | * @size: Size of the dma_buf associated with this object | ||
| 145 | * @real_type: Type of the underlying object. Needed since we're setting | ||
| 146 | * the value of @base::object_type to ttm_prime_type | ||
| 147 | * @dma_buf: Non ref-coutned pointer to a struct dma_buf created from this | ||
| 148 | * object. | ||
| 149 | * @refcount_release: The underlying object's release method. Needed since | ||
| 150 | * we set @base::refcount_release to our own release method. | ||
| 151 | */ | ||
| 152 | |||
| 153 | struct ttm_prime_object { | ||
| 154 | struct ttm_base_object base; | ||
| 155 | struct mutex mutex; | ||
| 156 | size_t size; | ||
| 157 | enum ttm_object_type real_type; | ||
| 158 | struct dma_buf *dma_buf; | ||
| 159 | void (*refcount_release) (struct ttm_base_object **); | ||
| 160 | }; | ||
| 161 | |||
| 162 | /** | ||
| 163 | * ttm_base_object_init | ||
| 164 | * | ||
| 165 | * @tfile: Pointer to a struct ttm_object_file. | ||
| 166 | * @base: The struct ttm_base_object to initialize. | ||
| 167 | * @shareable: This object is shareable with other applcations. | ||
| 168 | * (different @tfile pointers.) | ||
| 169 | * @type: The object type. | ||
| 170 | * @refcount_release: See the struct ttm_base_object description. | ||
| 171 | * @ref_obj_release: See the struct ttm_base_object description. | ||
| 172 | * | ||
| 173 | * Initializes a struct ttm_base_object. | ||
| 174 | */ | ||
| 175 | |||
| 176 | extern int ttm_base_object_init(struct ttm_object_file *tfile, | ||
| 177 | struct ttm_base_object *base, | ||
| 178 | bool shareable, | ||
| 179 | enum ttm_object_type type, | ||
| 180 | void (*refcount_release) (struct ttm_base_object | ||
| 181 | **), | ||
| 182 | void (*ref_obj_release) (struct ttm_base_object | ||
| 183 | *, | ||
| 184 | enum ttm_ref_type | ||
| 185 | ref_type)); | ||
| 186 | |||
| 187 | /** | ||
| 188 | * ttm_base_object_lookup | ||
| 189 | * | ||
| 190 | * @tfile: Pointer to a struct ttm_object_file. | ||
| 191 | * @key: Hash key | ||
| 192 | * | ||
| 193 | * Looks up a struct ttm_base_object with the key @key. | ||
| 194 | */ | ||
| 195 | |||
| 196 | extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file | ||
| 197 | *tfile, uint32_t key); | ||
| 198 | |||
| 199 | /** | ||
| 200 | * ttm_base_object_lookup_for_ref | ||
| 201 | * | ||
| 202 | * @tdev: Pointer to a struct ttm_object_device. | ||
| 203 | * @key: Hash key | ||
| 204 | * | ||
| 205 | * Looks up a struct ttm_base_object with the key @key. | ||
| 206 | * This function should only be used when the struct tfile associated with the | ||
| 207 | * caller doesn't yet have a reference to the base object. | ||
| 208 | */ | ||
| 209 | |||
| 210 | extern struct ttm_base_object * | ||
| 211 | ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key); | ||
| 212 | |||
| 213 | /** | ||
| 214 | * ttm_base_object_unref | ||
| 215 | * | ||
| 216 | * @p_base: Pointer to a pointer referencing a struct ttm_base_object. | ||
| 217 | * | ||
| 218 | * Decrements the base object refcount and clears the pointer pointed to by | ||
| 219 | * p_base. | ||
| 220 | */ | ||
| 221 | |||
| 222 | extern void ttm_base_object_unref(struct ttm_base_object **p_base); | ||
| 223 | |||
| 224 | /** | ||
| 225 | * ttm_ref_object_add. | ||
| 226 | * | ||
| 227 | * @tfile: A struct ttm_object_file representing the application owning the | ||
| 228 | * ref_object. | ||
| 229 | * @base: The base object to reference. | ||
| 230 | * @ref_type: The type of reference. | ||
| 231 | * @existed: Upon completion, indicates that an identical reference object | ||
| 232 | * already existed, and the refcount was upped on that object instead. | ||
| 233 | * @require_existed: Fail with -EPERM if an identical ref object didn't | ||
| 234 | * already exist. | ||
| 235 | * | ||
| 236 | * Checks that the base object is shareable and adds a ref object to it. | ||
| 237 | * | ||
| 238 | * Adding a ref object to a base object is basically like referencing the | ||
| 239 | * base object, but a user-space application holds the reference. When the | ||
| 240 | * file corresponding to @tfile is closed, all its reference objects are | ||
| 241 | * deleted. A reference object can have different types depending on what | ||
| 242 | * it's intended for. It can be refcounting to prevent object destruction, | ||
| 243 | * When user-space takes a lock, it can add a ref object to that lock to | ||
| 244 | * make sure the lock is released if the application dies. A ref object | ||
| 245 | * will hold a single reference on a base object. | ||
| 246 | */ | ||
| 247 | extern int ttm_ref_object_add(struct ttm_object_file *tfile, | ||
| 248 | struct ttm_base_object *base, | ||
| 249 | enum ttm_ref_type ref_type, bool *existed, | ||
| 250 | bool require_existed); | ||
| 251 | |||
| 252 | extern bool ttm_ref_object_exists(struct ttm_object_file *tfile, | ||
| 253 | struct ttm_base_object *base); | ||
| 254 | |||
| 255 | /** | ||
| 256 | * ttm_ref_object_base_unref | ||
| 257 | * | ||
| 258 | * @key: Key representing the base object. | ||
| 259 | * @ref_type: Ref type of the ref object to be dereferenced. | ||
| 260 | * | ||
| 261 | * Unreference a ref object with type @ref_type | ||
| 262 | * on the base object identified by @key. If there are no duplicate | ||
| 263 | * references, the ref object will be destroyed and the base object | ||
| 264 | * will be unreferenced. | ||
| 265 | */ | ||
| 266 | extern int ttm_ref_object_base_unref(struct ttm_object_file *tfile, | ||
| 267 | unsigned long key, | ||
| 268 | enum ttm_ref_type ref_type); | ||
| 269 | |||
| 270 | /** | ||
| 271 | * ttm_object_file_init - initialize a struct ttm_object file | ||
| 272 | * | ||
| 273 | * @tdev: A struct ttm_object device this file is initialized on. | ||
| 274 | * @hash_order: Order of the hash table used to hold the reference objects. | ||
| 275 | * | ||
| 276 | * This is typically called by the file_ops::open function. | ||
| 277 | */ | ||
| 278 | |||
| 279 | extern struct ttm_object_file *ttm_object_file_init(struct ttm_object_device | ||
| 280 | *tdev, | ||
| 281 | unsigned int hash_order); | ||
| 282 | |||
| 283 | /** | ||
| 284 | * ttm_object_file_release - release data held by a ttm_object_file | ||
| 285 | * | ||
| 286 | * @p_tfile: Pointer to pointer to the ttm_object_file object to release. | ||
| 287 | * *p_tfile will be set to NULL by this function. | ||
| 288 | * | ||
| 289 | * Releases all data associated by a ttm_object_file. | ||
| 290 | * Typically called from file_ops::release. The caller must | ||
| 291 | * ensure that there are no concurrent users of tfile. | ||
| 292 | */ | ||
| 293 | |||
| 294 | extern void ttm_object_file_release(struct ttm_object_file **p_tfile); | ||
| 295 | |||
| 296 | /** | ||
| 297 | * ttm_object device init - initialize a struct ttm_object_device | ||
| 298 | * | ||
| 299 | * @mem_glob: struct ttm_mem_global for memory accounting. | ||
| 300 | * @hash_order: Order of hash table used to hash the base objects. | ||
| 301 | * @ops: DMA buf ops for prime objects of this device. | ||
| 302 | * | ||
| 303 | * This function is typically called on device initialization to prepare | ||
| 304 | * data structures needed for ttm base and ref objects. | ||
| 305 | */ | ||
| 306 | |||
| 307 | extern struct ttm_object_device * | ||
| 308 | ttm_object_device_init(struct ttm_mem_global *mem_glob, | ||
| 309 | unsigned int hash_order, | ||
| 310 | const struct dma_buf_ops *ops); | ||
| 311 | |||
| 312 | /** | ||
| 313 | * ttm_object_device_release - release data held by a ttm_object_device | ||
| 314 | * | ||
| 315 | * @p_tdev: Pointer to pointer to the ttm_object_device object to release. | ||
| 316 | * *p_tdev will be set to NULL by this function. | ||
| 317 | * | ||
| 318 | * Releases all data associated by a ttm_object_device. | ||
| 319 | * Typically called from driver::unload before the destruction of the | ||
| 320 | * device private data structure. | ||
| 321 | */ | ||
| 322 | |||
| 323 | extern void ttm_object_device_release(struct ttm_object_device **p_tdev); | ||
| 324 | |||
| 325 | #define ttm_base_object_kfree(__object, __base)\ | ||
| 326 | kfree_rcu(__object, __base.rhead) | ||
| 327 | |||
| 328 | extern int ttm_prime_object_init(struct ttm_object_file *tfile, | ||
| 329 | size_t size, | ||
| 330 | struct ttm_prime_object *prime, | ||
| 331 | bool shareable, | ||
| 332 | enum ttm_object_type type, | ||
| 333 | void (*refcount_release) | ||
| 334 | (struct ttm_base_object **), | ||
| 335 | void (*ref_obj_release) | ||
| 336 | (struct ttm_base_object *, | ||
| 337 | enum ttm_ref_type ref_type)); | ||
| 338 | |||
| 339 | static inline enum ttm_object_type | ||
| 340 | ttm_base_object_type(struct ttm_base_object *base) | ||
| 341 | { | ||
| 342 | return (base->object_type == ttm_prime_type) ? | ||
| 343 | container_of(base, struct ttm_prime_object, base)->real_type : | ||
| 344 | base->object_type; | ||
| 345 | } | ||
| 346 | extern int ttm_prime_fd_to_handle(struct ttm_object_file *tfile, | ||
| 347 | int fd, u32 *handle); | ||
| 348 | extern int ttm_prime_handle_to_fd(struct ttm_object_file *tfile, | ||
| 349 | uint32_t handle, uint32_t flags, | ||
| 350 | int *prime_fd); | ||
| 351 | |||
| 352 | #define ttm_prime_object_kfree(__obj, __prime) \ | ||
| 353 | kfree_rcu(__obj, __prime.base.rhead) | ||
| 354 | #endif | ||
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index fea64f2692a0..ab137f97ecbd 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
| @@ -141,7 +141,6 @@ struct vc_data { | |||
| 141 | struct uni_pagedir *vc_uni_pagedir; | 141 | struct uni_pagedir *vc_uni_pagedir; |
| 142 | struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ | 142 | struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ |
| 143 | struct uni_screen *vc_uni_screen; /* unicode screen content */ | 143 | struct uni_screen *vc_uni_screen; /* unicode screen content */ |
| 144 | bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ | ||
| 145 | /* additional information is in vt_kern.h */ | 144 | /* additional information is in vt_kern.h */ |
| 146 | }; | 145 | }; |
| 147 | 146 | ||
diff --git a/include/linux/fb.h b/include/linux/fb.h index 3e7e75383d32..a3cab6dc9b44 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -456,10 +456,13 @@ struct fb_tile_ops { | |||
| 456 | * and host endianness. Drivers should not use this flag. | 456 | * and host endianness. Drivers should not use this flag. |
| 457 | */ | 457 | */ |
| 458 | #define FBINFO_BE_MATH 0x100000 | 458 | #define FBINFO_BE_MATH 0x100000 |
| 459 | /* | ||
| 460 | * Hide smem_start in the FBIOGET_FSCREENINFO IOCTL. This is used by modern DRM | ||
| 461 | * drivers to stop userspace from trying to share buffers behind the kernel's | ||
| 462 | * back. Instead dma-buf based buffer sharing should be used. | ||
| 463 | */ | ||
| 464 | #define FBINFO_HIDE_SMEM_START 0x200000 | ||
| 459 | 465 | ||
| 460 | /* report to the VT layer that this fb driver can accept forced console | ||
| 461 | output like oopses */ | ||
| 462 | #define FBINFO_CAN_FORCE_OUTPUT 0x200000 | ||
| 463 | 466 | ||
| 464 | struct fb_info { | 467 | struct fb_info { |
| 465 | atomic_t count; | 468 | atomic_t count; |
| @@ -632,6 +635,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, | |||
| 632 | extern int register_framebuffer(struct fb_info *fb_info); | 635 | extern int register_framebuffer(struct fb_info *fb_info); |
| 633 | extern int unregister_framebuffer(struct fb_info *fb_info); | 636 | extern int unregister_framebuffer(struct fb_info *fb_info); |
| 634 | extern int unlink_framebuffer(struct fb_info *fb_info); | 637 | extern int unlink_framebuffer(struct fb_info *fb_info); |
| 638 | extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, | ||
| 639 | const char *name); | ||
| 635 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, | 640 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, |
| 636 | const char *name, bool primary); | 641 | const char *name, bool primary); |
| 637 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); | 642 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
diff --git a/include/linux/list.h b/include/linux/list.h index de04cc5ed536..edb7628e46ed 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -184,6 +184,29 @@ static inline void list_move_tail(struct list_head *list, | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | /** | 186 | /** |
| 187 | * list_bulk_move_tail - move a subsection of a list to its tail | ||
| 188 | * @head: the head that will follow our entry | ||
| 189 | * @first: first entry to move | ||
| 190 | * @last: last entry to move, can be the same as first | ||
| 191 | * | ||
| 192 | * Move all entries between @first and including @last before @head. | ||
| 193 | * All three entries must belong to the same linked list. | ||
| 194 | */ | ||
| 195 | static inline void list_bulk_move_tail(struct list_head *head, | ||
| 196 | struct list_head *first, | ||
| 197 | struct list_head *last) | ||
| 198 | { | ||
| 199 | first->prev->next = last->next; | ||
| 200 | last->next->prev = first->prev; | ||
| 201 | |||
| 202 | head->prev->next = first; | ||
| 203 | first->prev = head->prev; | ||
| 204 | |||
| 205 | last->next = head; | ||
| 206 | head->prev = last; | ||
| 207 | } | ||
| 208 | |||
| 209 | /** | ||
| 187 | * list_is_last - tests whether @list is the last entry in list @head | 210 | * list_is_last - tests whether @list is the last entry in list @head |
| 188 | * @list: the entry to test | 211 | * @list: the entry to test |
| 189 | * @head: the head of the list | 212 | * @head: the head of the list |
diff --git a/include/linux/platform_data/shmob_drm.h b/include/linux/platform_data/shmob_drm.h index ee495d707f17..fe815d7d9f58 100644 --- a/include/linux/platform_data/shmob_drm.h +++ b/include/linux/platform_data/shmob_drm.h | |||
| @@ -1,14 +1,10 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
| 1 | /* | 2 | /* |
| 2 | * shmob_drm.h -- SH Mobile DRM driver | 3 | * shmob_drm.h -- SH Mobile DRM driver |
| 3 | * | 4 | * |
| 4 | * Copyright (C) 2012 Renesas Corporation | 5 | * Copyright (C) 2012 Renesas Corporation |
| 5 | * | 6 | * |
| 6 | * Laurent Pinchart (laurent.pinchart@ideasonboard.com) | 7 | * Laurent Pinchart (laurent.pinchart@ideasonboard.com) |
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2 of the License, or | ||
| 11 | * (at your option) any later version. | ||
| 12 | */ | 8 | */ |
| 13 | 9 | ||
| 14 | #ifndef __SHMOB_DRM_H__ | 10 | #ifndef __SHMOB_DRM_H__ |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 3fd07912909c..8dc77e40bc03 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
| @@ -135,13 +135,6 @@ extern int do_unbind_con_driver(const struct consw *csw, int first, int last, | |||
| 135 | int deflt); | 135 | int deflt); |
| 136 | int vty_init(const struct file_operations *console_fops); | 136 | int vty_init(const struct file_operations *console_fops); |
| 137 | 137 | ||
| 138 | static inline bool vt_force_oops_output(struct vc_data *vc) | ||
| 139 | { | ||
| 140 | if (oops_in_progress && vc->vc_panic_force_write && panic_timeout >= 0) | ||
| 141 | return true; | ||
| 142 | return false; | ||
| 143 | } | ||
| 144 | |||
| 145 | extern char vt_dont_switch; | 138 | extern char vt_dont_switch; |
| 146 | extern int default_utf8; | 139 | extern int default_utf8; |
| 147 | extern int global_cursor_default; | 140 | extern int global_cursor_default; |
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 1ceec56de015..370e9a5536ef 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h | |||
| @@ -665,6 +665,8 @@ struct drm_amdgpu_cs_chunk_data { | |||
| 665 | #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10 | 665 | #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10 |
| 666 | /* Subquery id: Query GFX RLC SRLS firmware version */ | 666 | /* Subquery id: Query GFX RLC SRLS firmware version */ |
| 667 | #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11 | 667 | #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11 |
| 668 | /* Subquery id: Query DMCU firmware version */ | ||
| 669 | #define AMDGPU_INFO_FW_DMCU 0x12 | ||
| 668 | /* number of bytes moved for TTM migration */ | 670 | /* number of bytes moved for TTM migration */ |
| 669 | #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f | 671 | #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f |
| 670 | /* the used VRAM size */ | 672 | /* the used VRAM size */ |
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 721ab7e54d96..0cd40ebfa1b1 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h | |||
| @@ -30,11 +30,50 @@ | |||
| 30 | extern "C" { | 30 | extern "C" { |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | /** | ||
| 34 | * DOC: overview | ||
| 35 | * | ||
| 36 | * In the DRM subsystem, framebuffer pixel formats are described using the | ||
| 37 | * fourcc codes defined in `include/uapi/drm/drm_fourcc.h`. In addition to the | ||
| 38 | * fourcc code, a Format Modifier may optionally be provided, in order to | ||
| 39 | * further describe the buffer's format - for example tiling or compression. | ||
| 40 | * | ||
| 41 | * Format Modifiers | ||
| 42 | * ---------------- | ||
| 43 | * | ||
| 44 | * Format modifiers are used in conjunction with a fourcc code, forming a | ||
| 45 | * unique fourcc:modifier pair. This format:modifier pair must fully define the | ||
| 46 | * format and data layout of the buffer, and should be the only way to describe | ||
| 47 | * that particular buffer. | ||
| 48 | * | ||
| 49 | * Having multiple fourcc:modifier pairs which describe the same layout should | ||
| 50 | * be avoided, as such aliases run the risk of different drivers exposing | ||
| 51 | * different names for the same data format, forcing userspace to understand | ||
| 52 | * that they are aliases. | ||
| 53 | * | ||
| 54 | * Format modifiers may change any property of the buffer, including the number | ||
| 55 | * of planes and/or the required allocation size. Format modifiers are | ||
| 56 | * vendor-namespaced, and as such the relationship between a fourcc code and a | ||
| 57 | * modifier is specific to the modifer being used. For example, some modifiers | ||
| 58 | * may preserve meaning - such as number of planes - from the fourcc code, | ||
| 59 | * whereas others may not. | ||
| 60 | * | ||
| 61 | * Vendors should document their modifier usage in as much detail as | ||
| 62 | * possible, to ensure maximum compatibility across devices, drivers and | ||
| 63 | * applications. | ||
| 64 | * | ||
| 65 | * The authoritative list of format modifier codes is found in | ||
| 66 | * `include/uapi/drm/drm_fourcc.h` | ||
| 67 | */ | ||
| 68 | |||
| 33 | #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ | 69 | #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ |
| 34 | ((__u32)(c) << 16) | ((__u32)(d) << 24)) | 70 | ((__u32)(c) << 16) | ((__u32)(d) << 24)) |
| 35 | 71 | ||
| 36 | #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ | 72 | #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ |
| 37 | 73 | ||
| 74 | /* Reserve 0 for the invalid format specifier */ | ||
| 75 | #define DRM_FORMAT_INVALID 0 | ||
| 76 | |||
| 38 | /* color index */ | 77 | /* color index */ |
| 39 | #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ | 78 | #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ |
| 40 | 79 | ||
| @@ -300,6 +339,15 @@ extern "C" { | |||
| 300 | #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) | 339 | #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) |
| 301 | 340 | ||
| 302 | /* | 341 | /* |
| 342 | * Tiled, 16 (pixels) x 16 (lines) - sized macroblocks | ||
| 343 | * | ||
| 344 | * This is a simple tiled layout using tiles of 16x16 pixels in a row-major | ||
| 345 | * layout. For YCbCr formats Cb/Cr components are taken in such a way that | ||
| 346 | * they correspond to their 16x16 luma block. | ||
| 347 | */ | ||
| 348 | #define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2) | ||
| 349 | |||
| 350 | /* | ||
| 303 | * Qualcomm Compressed Format | 351 | * Qualcomm Compressed Format |
| 304 | * | 352 | * |
| 305 | * Refers to a compressed variant of the base format that is compressed. | 353 | * Refers to a compressed variant of the base format that is compressed. |
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 8d67243952f4..d3e0fe31efc5 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h | |||
| @@ -186,8 +186,9 @@ extern "C" { | |||
| 186 | /* | 186 | /* |
| 187 | * DRM_MODE_REFLECT_<axis> | 187 | * DRM_MODE_REFLECT_<axis> |
| 188 | * | 188 | * |
| 189 | * Signals that the contents of a drm plane is reflected in the <axis> axis, | 189 | * Signals that the contents of a drm plane is reflected along the <axis> axis, |
| 190 | * in the same way as mirroring. | 190 | * in the same way as mirroring. |
| 191 | * See kerneldoc chapter "Plane Composition Properties" for more details. | ||
| 191 | * | 192 | * |
| 192 | * This define is provided as a convenience, looking up the property id | 193 | * This define is provided as a convenience, looking up the property id |
| 193 | * using the name->prop id lookup is the preferred method. | 194 | * using the name->prop id lookup is the preferred method. |
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 7f5634ce8e88..a4446f452040 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h | |||
| @@ -529,6 +529,28 @@ typedef struct drm_i915_irq_wait { | |||
| 529 | */ | 529 | */ |
| 530 | #define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51 | 530 | #define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51 |
| 531 | 531 | ||
| 532 | /* | ||
| 533 | * Once upon a time we supposed that writes through the GGTT would be | ||
| 534 | * immediately in physical memory (once flushed out of the CPU path). However, | ||
| 535 | * on a few different processors and chipsets, this is not necessarily the case | ||
| 536 | * as the writes appear to be buffered internally. Thus a read of the backing | ||
| 537 | * storage (physical memory) via a different path (with different physical tags | ||
| 538 | * to the indirect write via the GGTT) will see stale values from before | ||
| 539 | * the GGTT write. Inside the kernel, we can for the most part keep track of | ||
| 540 | * the different read/write domains in use (e.g. set-domain), but the assumption | ||
| 541 | * of coherency is baked into the ABI, hence reporting its true state in this | ||
| 542 | * parameter. | ||
| 543 | * | ||
| 544 | * Reports true when writes via mmap_gtt are immediately visible following an | ||
| 545 | * lfence to flush the WCB. | ||
| 546 | * | ||
| 547 | * Reports false when writes via mmap_gtt are indeterminately delayed in an in | ||
| 548 | * internal buffer and are _not_ immediately visible to third parties accessing | ||
| 549 | * directly via mmap_cpu/mmap_wc. Use of mmap_gtt as part of an IPC | ||
| 550 | * communications channel when reporting false is strongly disadvised. | ||
| 551 | */ | ||
| 552 | #define I915_PARAM_MMAP_GTT_COHERENT 52 | ||
| 553 | |||
| 532 | typedef struct drm_i915_getparam { | 554 | typedef struct drm_i915_getparam { |
| 533 | __s32 param; | 555 | __s32 param; |
| 534 | /* | 556 | /* |
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h index 01674b56e14f..f5ff8a76e208 100644 --- a/include/uapi/linux/kfd_ioctl.h +++ b/include/uapi/linux/kfd_ioctl.h | |||
| @@ -82,6 +82,14 @@ struct kfd_ioctl_set_cu_mask_args { | |||
| 82 | __u64 cu_mask_ptr; /* to KFD */ | 82 | __u64 cu_mask_ptr; /* to KFD */ |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | struct kfd_ioctl_get_queue_wave_state_args { | ||
| 86 | uint64_t ctl_stack_address; /* to KFD */ | ||
| 87 | uint32_t ctl_stack_used_size; /* from KFD */ | ||
| 88 | uint32_t save_area_used_size; /* from KFD */ | ||
| 89 | uint32_t queue_id; /* to KFD */ | ||
| 90 | uint32_t pad; | ||
| 91 | }; | ||
| 92 | |||
| 85 | /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */ | 93 | /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */ |
| 86 | #define KFD_IOC_CACHE_POLICY_COHERENT 0 | 94 | #define KFD_IOC_CACHE_POLICY_COHERENT 0 |
| 87 | #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1 | 95 | #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1 |
| @@ -475,7 +483,10 @@ struct kfd_ioctl_unmap_memory_from_gpu_args { | |||
| 475 | #define AMDKFD_IOC_SET_CU_MASK \ | 483 | #define AMDKFD_IOC_SET_CU_MASK \ |
| 476 | AMDKFD_IOW(0x1A, struct kfd_ioctl_set_cu_mask_args) | 484 | AMDKFD_IOW(0x1A, struct kfd_ioctl_set_cu_mask_args) |
| 477 | 485 | ||
| 486 | #define AMDKFD_IOC_GET_QUEUE_WAVE_STATE \ | ||
| 487 | AMDKFD_IOWR(0x1B, struct kfd_ioctl_get_queue_wave_state_args) | ||
| 488 | |||
| 478 | #define AMDKFD_COMMAND_START 0x01 | 489 | #define AMDKFD_COMMAND_START 0x01 |
| 479 | #define AMDKFD_COMMAND_END 0x1B | 490 | #define AMDKFD_COMMAND_END 0x1C |
| 480 | 491 | ||
| 481 | #endif | 492 | #endif |
diff --git a/include/uapi/linux/udmabuf.h b/include/uapi/linux/udmabuf.h new file mode 100644 index 000000000000..46b6532ed855 --- /dev/null +++ b/include/uapi/linux/udmabuf.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | #ifndef _UAPI_LINUX_UDMABUF_H | ||
| 3 | #define _UAPI_LINUX_UDMABUF_H | ||
| 4 | |||
| 5 | #include <linux/types.h> | ||
| 6 | #include <linux/ioctl.h> | ||
| 7 | |||
| 8 | #define UDMABUF_FLAGS_CLOEXEC 0x01 | ||
| 9 | |||
| 10 | struct udmabuf_create { | ||
| 11 | __u32 memfd; | ||
| 12 | __u32 flags; | ||
| 13 | __u64 offset; | ||
| 14 | __u64 size; | ||
| 15 | }; | ||
| 16 | |||
| 17 | struct udmabuf_create_item { | ||
| 18 | __u32 memfd; | ||
| 19 | __u32 __pad; | ||
| 20 | __u64 offset; | ||
| 21 | __u64 size; | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct udmabuf_create_list { | ||
| 25 | __u32 flags; | ||
| 26 | __u32 count; | ||
| 27 | struct udmabuf_create_item list[]; | ||
| 28 | }; | ||
| 29 | |||
| 30 | #define UDMABUF_CREATE _IOW('u', 0x42, struct udmabuf_create) | ||
| 31 | #define UDMABUF_CREATE_LIST _IOW('u', 0x43, struct udmabuf_create_list) | ||
| 32 | |||
| 33 | #endif /* _UAPI_LINUX_UDMABUF_H */ | ||
