diff options
| author | Dave Airlie <airlied@redhat.com> | 2019-05-27 18:25:46 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2019-05-27 18:59:11 -0400 |
| commit | 88cd7a2c1b29f61a2a3fab76216a43f3b779e0cd (patch) | |
| tree | b8a4311c8f7edfc92c1055b6a5a86b1a5552878e /include | |
| parent | cd6c84d8f0cdc911df435bb075ba22ce3c605b07 (diff) | |
| parent | 909fa3321d348ef69366aad9e84e1dd9ee0bd060 (diff) | |
Merge tag 'drm-misc-next-2019-05-24' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for v5.3, try #2:
UAPI Changes:
- Add HDR source metadata property.
- Make drm.h compile on GNU/kFreeBSD by including stdint.h
- Clarify how the userspace reviewer has to review new kernel UAPI.
- Clarify that for using new UAPI, merging to drm-next or drm-misc-next should be enough.
Cross-subsystem Changes:
- video/hdmi: Add unpack function for DRM infoframes.
- Device tree bindings:
* Updating a property for Mali Midgard GPUs
* Updating a property for STM32 DSI panel
* Adding support for FriendlyELEC HD702E 800x1280 panel
* Adding support for Evervision VGG804821 800x480 5.0" WVGA TFT panel
* Adding support for the EDT ET035012DM6 3.5" 320x240 QVGA 24-bit RGB TFT.
* Adding support for Three Five displays TFC S9700RTWV43TR-01B 800x480 panel
with resistive touch found on TI's AM335X-EVM.
* Adding support for EDT ETM0430G0DH6 480x272 panel.
- Add OSD101T2587-53TS driver with DT bindings.
- Add Samsung S6E63M0 panel driver with DT bindings.
- Add VXT VL050-8048NT-C01 800x480 panel with DT bindings.
- Dma-buf:
- Make mmap callback actually optional.
- Documentation updates.
- Fix debugfs refcount inbalance.
- Remove unused sync_dump function.
- Fix device tree bindings in drm-misc-next after a botched merge.
Core Changes:
- Add support for HDR infoframes and related EDID parsing.
- Remove prime sg_table caching, now done inside dma-buf.
- Add shiny new drm_gem_vram helpers for simple VRAM drivers;
with some fixes to the new API on top.
- Small fix to job cleanup without timeout handler.
- Documentation fixes to drm_fourcc.
- Replace lookups of drm_format with struct drm_format_info;
remove functions that become obsolete by this conversion.
- Remove double include in bridge/panel.c and some drivers.
- Remove drmP.h include from drm/edid and drm/dp.
- Fix null pointer deref in drm_fb_helper_hotplug_event().
- Remove most members from drm_fb_helper_crtc, only mode_set is kept.
- Remove race of fb helpers with userspace; only restore mode
when userspace is not master.
- Move legacy setup from drm_file.c to drm_legacy_misc.c
- Rework scheduler job destruction.
- drm/bus was removed, remove from TODO.
- Add __drm_atomic_helper_crtc_reset() to subclass crtc_state,
and convert some drivers to use it (conversion is not complete yet).
- Bump vblank timeout wait to 100 ms for atomic.
- Docbook fix for drm_hdmi_infoframe_set_hdr_metadata.
Driver Changes:
- sun4i: Use DRM_GEM_CMA_VMAP_DRIVER_OPS instead of definining manually.
- v3d: Small cleanups, adding support for compute shaders,
reservation/synchronization fixes and job management refactoring,
fixes MMU and debugfs.
- lima: Fix null pointer in irq handler on startup, set default timeout for scheduled jobs.
- stm/ltdc: Assorted fixes and adding FB modifier support.
- amdgpu: Avoid hw reset if guilty job was already signaled.
- virtio: Add seqno to fences, add trace events, use correct flags for fence allocation.
- Convert AST, bochs, mgag200, vboxvideo, hisilicon to the new drm_gem_vram API.
- sun6i_mipi_dsi: Support DSI GENERIC_SHORT_WRITE_2 transfers.
- bochs: Small fix to use PTR_RET_OR_ZERO and driver unload.
- gma500: header fixes
- cirrus: Remove unused files.
- mediatek: Fix compiler warning after merging the HDR series.
- vc4: Rework binner bo handling.
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/052875a5-27ba-3832-60c2-193d950afdff@linux.intel.com
Diffstat (limited to 'include')
| -rw-r--r-- | include/drm/drm_atomic_state_helper.h | 2 | ||||
| -rw-r--r-- | include/drm/drm_connector.h | 14 | ||||
| -rw-r--r-- | include/drm/drm_device.h | 4 | ||||
| -rw-r--r-- | include/drm/drm_edid.h | 5 | ||||
| -rw-r--r-- | include/drm/drm_fb_helper.h | 10 | ||||
| -rw-r--r-- | include/drm/drm_fourcc.h | 50 | ||||
| -rw-r--r-- | include/drm/drm_gem_vram_helper.h | 162 | ||||
| -rw-r--r-- | include/drm/drm_mode_config.h | 7 | ||||
| -rw-r--r-- | include/drm/drm_vram_mm_helper.h | 102 | ||||
| -rw-r--r-- | include/drm/gma_drm.h | 25 | ||||
| -rw-r--r-- | include/drm/gpu_scheduler.h | 8 | ||||
| -rw-r--r-- | include/linux/dma-buf.h | 47 | ||||
| -rw-r--r-- | include/linux/hdmi.h | 55 | ||||
| -rw-r--r-- | include/uapi/drm/drm.h | 1 | ||||
| -rw-r--r-- | include/uapi/drm/drm_mode.h | 23 | ||||
| -rw-r--r-- | include/uapi/drm/v3d_drm.h | 28 |
16 files changed, 488 insertions, 55 deletions
diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 66c92cbd8e16..4e6d2e7a40b8 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h | |||
| @@ -37,6 +37,8 @@ struct drm_private_state; | |||
| 37 | struct drm_modeset_acquire_ctx; | 37 | struct drm_modeset_acquire_ctx; |
| 38 | struct drm_device; | 38 | struct drm_device; |
| 39 | 39 | ||
| 40 | void __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc, | ||
| 41 | struct drm_crtc_state *state); | ||
| 40 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); | 42 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); |
| 41 | void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, | 43 | void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, |
| 42 | struct drm_crtc_state *state); | 44 | struct drm_crtc_state *state); |
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 02a131202add..f0e987df4c1e 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h | |||
| @@ -517,6 +517,10 @@ struct drm_connector_state { | |||
| 517 | * Used by the atomic helpers to select the encoder, through the | 517 | * Used by the atomic helpers to select the encoder, through the |
| 518 | * &drm_connector_helper_funcs.atomic_best_encoder or | 518 | * &drm_connector_helper_funcs.atomic_best_encoder or |
| 519 | * &drm_connector_helper_funcs.best_encoder callbacks. | 519 | * &drm_connector_helper_funcs.best_encoder callbacks. |
| 520 | * | ||
| 521 | * NOTE: Atomic drivers must fill this out (either themselves or through | ||
| 522 | * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will | ||
| 523 | * not return correct data to userspace. | ||
| 520 | */ | 524 | */ |
| 521 | struct drm_encoder *best_encoder; | 525 | struct drm_encoder *best_encoder; |
| 522 | 526 | ||
| @@ -599,6 +603,12 @@ struct drm_connector_state { | |||
| 599 | * and the connector bpc limitations obtained from edid. | 603 | * and the connector bpc limitations obtained from edid. |
| 600 | */ | 604 | */ |
| 601 | u8 max_bpc; | 605 | u8 max_bpc; |
| 606 | |||
| 607 | /** | ||
| 608 | * @hdr_output_metadata: | ||
| 609 | * DRM blob property for HDR output metadata | ||
| 610 | */ | ||
| 611 | struct drm_property_blob *hdr_output_metadata; | ||
| 602 | }; | 612 | }; |
| 603 | 613 | ||
| 604 | /** | 614 | /** |
| @@ -1239,6 +1249,10 @@ struct drm_connector { | |||
| 1239 | * &drm_mode_config.connector_free_work. | 1249 | * &drm_mode_config.connector_free_work. |
| 1240 | */ | 1250 | */ |
| 1241 | struct llist_node free_node; | 1251 | struct llist_node free_node; |
| 1252 | |||
| 1253 | /* HDR metdata */ | ||
| 1254 | struct hdr_output_metadata hdr_output_metadata; | ||
| 1255 | struct hdr_sink_metadata hdr_sink_metadata; | ||
| 1242 | }; | 1256 | }; |
| 1243 | 1257 | ||
| 1244 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) | 1258 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) |
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index 7f9ef709b2b6..1acfc3bbd3fb 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h | |||
| @@ -17,6 +17,7 @@ struct drm_vblank_crtc; | |||
| 17 | struct drm_sg_mem; | 17 | struct drm_sg_mem; |
| 18 | struct drm_local_map; | 18 | struct drm_local_map; |
| 19 | struct drm_vma_offset_manager; | 19 | struct drm_vma_offset_manager; |
| 20 | struct drm_vram_mm; | ||
| 20 | struct drm_fb_helper; | 21 | struct drm_fb_helper; |
| 21 | 22 | ||
| 22 | struct inode; | 23 | struct inode; |
| @@ -286,6 +287,9 @@ struct drm_device { | |||
| 286 | /** @vma_offset_manager: GEM information */ | 287 | /** @vma_offset_manager: GEM information */ |
| 287 | struct drm_vma_offset_manager *vma_offset_manager; | 288 | struct drm_vma_offset_manager *vma_offset_manager; |
| 288 | 289 | ||
| 290 | /** @vram_mm: VRAM MM memory manager */ | ||
| 291 | struct drm_vram_mm *vram_mm; | ||
| 292 | |||
| 289 | /** | 293 | /** |
| 290 | * @switch_power_state: | 294 | * @switch_power_state: |
| 291 | * | 295 | * |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 9d3b5b93102c..0e21e91c4314 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 27 | #include <linux/hdmi.h> | 27 | #include <linux/hdmi.h> |
| 28 | #include <drm/drm_mode.h> | ||
| 28 | 29 | ||
| 29 | struct drm_device; | 30 | struct drm_device; |
| 30 | struct i2c_adapter; | 31 | struct i2c_adapter; |
| @@ -370,6 +371,10 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, | |||
| 370 | const struct drm_display_mode *mode, | 371 | const struct drm_display_mode *mode, |
| 371 | enum hdmi_quantization_range rgb_quant_range); | 372 | enum hdmi_quantization_range rgb_quant_range); |
| 372 | 373 | ||
| 374 | int | ||
| 375 | drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame, | ||
| 376 | const struct drm_connector_state *conn_state); | ||
| 377 | |||
| 373 | /** | 378 | /** |
| 374 | * drm_eld_mnl - Get ELD monitor name length in bytes. | 379 | * drm_eld_mnl - Get ELD monitor name length in bytes. |
| 375 | * @eld: pointer to an eld memory structure with mnl set | 380 | * @eld: pointer to an eld memory structure with mnl set |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 40af2866c26a..2af1c6d3e147 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
| @@ -49,9 +49,6 @@ struct drm_fb_offset { | |||
| 49 | 49 | ||
| 50 | struct drm_fb_helper_crtc { | 50 | struct drm_fb_helper_crtc { |
| 51 | struct drm_mode_set mode_set; | 51 | struct drm_mode_set mode_set; |
| 52 | struct drm_display_mode *desired_mode; | ||
| 53 | int x, y; | ||
| 54 | int rotation; | ||
| 55 | }; | 52 | }; |
| 56 | 53 | ||
| 57 | /** | 54 | /** |
| @@ -152,13 +149,6 @@ struct drm_fb_helper { | |||
| 152 | int connector_count; | 149 | int connector_count; |
| 153 | int connector_info_alloc_count; | 150 | int connector_info_alloc_count; |
| 154 | /** | 151 | /** |
| 155 | * @sw_rotations: | ||
| 156 | * Bitmask of all rotations requested for panel-orientation which | ||
| 157 | * could not be handled in hardware. If only one bit is set | ||
| 158 | * fbdev->fbcon_rotate_hint gets set to the requested rotation. | ||
| 159 | */ | ||
| 160 | int sw_rotations; | ||
| 161 | /** | ||
| 162 | * @connector_info: | 152 | * @connector_info: |
| 163 | * | 153 | * |
| 164 | * Array of per-connector information. Do not iterate directly, but use | 154 | * Array of per-connector information. Do not iterate directly, but use |
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index b3d9d88ab290..306d1efeb5e0 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h | |||
| @@ -260,6 +260,50 @@ drm_format_info_is_yuv_sampling_444(const struct drm_format_info *info) | |||
| 260 | return info->is_yuv && info->hsub == 1 && info->vsub == 1; | 260 | return info->is_yuv && info->hsub == 1 && info->vsub == 1; |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | /** | ||
| 264 | * drm_format_info_plane_width - width of the plane given the first plane | ||
| 265 | * @info: pixel format info | ||
| 266 | * @width: width of the first plane | ||
| 267 | * @plane: plane index | ||
| 268 | * | ||
| 269 | * Returns: | ||
| 270 | * The width of @plane, given that the width of the first plane is @width. | ||
| 271 | */ | ||
| 272 | static inline | ||
| 273 | int drm_format_info_plane_width(const struct drm_format_info *info, int width, | ||
| 274 | int plane) | ||
| 275 | { | ||
| 276 | if (!info || plane >= info->num_planes) | ||
| 277 | return 0; | ||
| 278 | |||
| 279 | if (plane == 0) | ||
| 280 | return width; | ||
| 281 | |||
| 282 | return width / info->hsub; | ||
| 283 | } | ||
| 284 | |||
| 285 | /** | ||
| 286 | * drm_format_info_plane_height - height of the plane given the first plane | ||
| 287 | * @info: pixel format info | ||
| 288 | * @height: height of the first plane | ||
| 289 | * @plane: plane index | ||
| 290 | * | ||
| 291 | * Returns: | ||
| 292 | * The height of @plane, given that the height of the first plane is @height. | ||
| 293 | */ | ||
| 294 | static inline | ||
| 295 | int drm_format_info_plane_height(const struct drm_format_info *info, int height, | ||
| 296 | int plane) | ||
| 297 | { | ||
| 298 | if (!info || plane >= info->num_planes) | ||
| 299 | return 0; | ||
| 300 | |||
| 301 | if (plane == 0) | ||
| 302 | return height; | ||
| 303 | |||
| 304 | return height / info->vsub; | ||
| 305 | } | ||
| 306 | |||
| 263 | const struct drm_format_info *__drm_format_info(u32 format); | 307 | const struct drm_format_info *__drm_format_info(u32 format); |
| 264 | const struct drm_format_info *drm_format_info(u32 format); | 308 | const struct drm_format_info *drm_format_info(u32 format); |
| 265 | const struct drm_format_info * | 309 | const struct drm_format_info * |
| @@ -268,12 +312,6 @@ drm_get_format_info(struct drm_device *dev, | |||
| 268 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); | 312 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); |
| 269 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, | 313 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, |
| 270 | uint32_t bpp, uint32_t depth); | 314 | uint32_t bpp, uint32_t depth); |
| 271 | int drm_format_num_planes(uint32_t format); | ||
| 272 | int drm_format_plane_cpp(uint32_t format, int plane); | ||
| 273 | int drm_format_horz_chroma_subsampling(uint32_t format); | ||
| 274 | int drm_format_vert_chroma_subsampling(uint32_t format); | ||
| 275 | int drm_format_plane_width(int width, uint32_t format, int plane); | ||
| 276 | int drm_format_plane_height(int height, uint32_t format, int plane); | ||
| 277 | unsigned int drm_format_info_block_width(const struct drm_format_info *info, | 315 | unsigned int drm_format_info_block_width(const struct drm_format_info *info, |
| 278 | int plane); | 316 | int plane); |
| 279 | unsigned int drm_format_info_block_height(const struct drm_format_info *info, | 317 | unsigned int drm_format_info_block_height(const struct drm_format_info *info, |
diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h new file mode 100644 index 000000000000..4d1d2c1bf32b --- /dev/null +++ b/include/drm/drm_gem_vram_helper.h | |||
| @@ -0,0 +1,162 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | |||
| 3 | #ifndef DRM_GEM_VRAM_HELPER_H | ||
| 4 | #define DRM_GEM_VRAM_HELPER_H | ||
| 5 | |||
| 6 | #include <drm/drm_gem.h> | ||
| 7 | #include <drm/ttm/ttm_bo_api.h> | ||
| 8 | #include <drm/ttm/ttm_placement.h> | ||
| 9 | #include <linux/kernel.h> /* for container_of() */ | ||
| 10 | |||
| 11 | struct drm_mode_create_dumb; | ||
| 12 | struct drm_vram_mm_funcs; | ||
| 13 | struct filp; | ||
| 14 | struct vm_area_struct; | ||
| 15 | |||
| 16 | #define DRM_GEM_VRAM_PL_FLAG_VRAM TTM_PL_FLAG_VRAM | ||
| 17 | #define DRM_GEM_VRAM_PL_FLAG_SYSTEM TTM_PL_FLAG_SYSTEM | ||
| 18 | |||
| 19 | /* | ||
| 20 | * Buffer-object helpers | ||
| 21 | */ | ||
| 22 | |||
| 23 | /** | ||
| 24 | * struct drm_gem_vram_object - GEM object backed by VRAM | ||
| 25 | * @gem: GEM object | ||
| 26 | * @bo: TTM buffer object | ||
| 27 | * @kmap: Mapping information for @bo | ||
| 28 | * @placement: TTM placement information. Supported placements are \ | ||
| 29 | %TTM_PL_VRAM and %TTM_PL_SYSTEM | ||
| 30 | * @placements: TTM placement information. | ||
| 31 | * @pin_count: Pin counter | ||
| 32 | * | ||
| 33 | * The type struct drm_gem_vram_object represents a GEM object that is | ||
| 34 | * backed by VRAM. It can be used for simple framebuffer devices with | ||
| 35 | * dedicated memory. The buffer object can be evicted to system memory if | ||
| 36 | * video memory becomes scarce. | ||
| 37 | */ | ||
| 38 | struct drm_gem_vram_object { | ||
| 39 | struct drm_gem_object gem; | ||
| 40 | struct ttm_buffer_object bo; | ||
| 41 | struct ttm_bo_kmap_obj kmap; | ||
| 42 | |||
| 43 | /* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ | ||
| 44 | struct ttm_placement placement; | ||
| 45 | struct ttm_place placements[2]; | ||
| 46 | |||
| 47 | int pin_count; | ||
| 48 | }; | ||
| 49 | |||
| 50 | /** | ||
| 51 | * Returns the container of type &struct drm_gem_vram_object | ||
| 52 | * for field bo. | ||
| 53 | * @bo: the VRAM buffer object | ||
| 54 | * Returns: The containing GEM VRAM object | ||
| 55 | */ | ||
| 56 | static inline struct drm_gem_vram_object *drm_gem_vram_of_bo( | ||
| 57 | struct ttm_buffer_object *bo) | ||
| 58 | { | ||
| 59 | return container_of(bo, struct drm_gem_vram_object, bo); | ||
| 60 | } | ||
| 61 | |||
| 62 | /** | ||
| 63 | * Returns the container of type &struct drm_gem_vram_object | ||
| 64 | * for field gem. | ||
| 65 | * @gem: the GEM object | ||
| 66 | * Returns: The containing GEM VRAM object | ||
| 67 | */ | ||
| 68 | static inline struct drm_gem_vram_object *drm_gem_vram_of_gem( | ||
| 69 | struct drm_gem_object *gem) | ||
| 70 | { | ||
| 71 | return container_of(gem, struct drm_gem_vram_object, gem); | ||
| 72 | } | ||
| 73 | |||
| 74 | struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev, | ||
| 75 | struct ttm_bo_device *bdev, | ||
| 76 | size_t size, | ||
| 77 | unsigned long pg_align, | ||
| 78 | bool interruptible); | ||
| 79 | void drm_gem_vram_put(struct drm_gem_vram_object *gbo); | ||
| 80 | int drm_gem_vram_lock(struct drm_gem_vram_object *gbo, bool no_wait); | ||
| 81 | void drm_gem_vram_unlock(struct drm_gem_vram_object *gbo); | ||
| 82 | u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo); | ||
| 83 | s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo); | ||
| 84 | int drm_gem_vram_pin(struct drm_gem_vram_object *gbo, unsigned long pl_flag); | ||
| 85 | int drm_gem_vram_pin_locked(struct drm_gem_vram_object *gbo, | ||
| 86 | unsigned long pl_flag); | ||
| 87 | int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo); | ||
| 88 | int drm_gem_vram_unpin_locked(struct drm_gem_vram_object *gbo); | ||
| 89 | void *drm_gem_vram_kmap_at(struct drm_gem_vram_object *gbo, bool map, | ||
| 90 | bool *is_iomem, struct ttm_bo_kmap_obj *kmap); | ||
| 91 | void *drm_gem_vram_kmap(struct drm_gem_vram_object *gbo, bool map, | ||
| 92 | bool *is_iomem); | ||
| 93 | void drm_gem_vram_kunmap_at(struct drm_gem_vram_object *gbo, | ||
| 94 | struct ttm_bo_kmap_obj *kmap); | ||
| 95 | void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo); | ||
| 96 | |||
| 97 | int drm_gem_vram_fill_create_dumb(struct drm_file *file, | ||
| 98 | struct drm_device *dev, | ||
| 99 | struct ttm_bo_device *bdev, | ||
| 100 | unsigned long pg_align, | ||
| 101 | bool interruptible, | ||
| 102 | struct drm_mode_create_dumb *args); | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Helpers for struct ttm_bo_driver | ||
| 106 | */ | ||
| 107 | |||
| 108 | void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo, | ||
| 109 | struct ttm_placement *pl); | ||
| 110 | |||
| 111 | int drm_gem_vram_bo_driver_verify_access(struct ttm_buffer_object *bo, | ||
| 112 | struct file *filp); | ||
| 113 | |||
| 114 | extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs; | ||
| 115 | |||
| 116 | /* | ||
| 117 | * Helpers for struct drm_driver | ||
| 118 | */ | ||
| 119 | |||
| 120 | void drm_gem_vram_driver_gem_free_object_unlocked(struct drm_gem_object *gem); | ||
| 121 | int drm_gem_vram_driver_dumb_create(struct drm_file *file, | ||
| 122 | struct drm_device *dev, | ||
| 123 | struct drm_mode_create_dumb *args); | ||
| 124 | int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, | ||
| 125 | struct drm_device *dev, | ||
| 126 | uint32_t handle, uint64_t *offset); | ||
| 127 | |||
| 128 | /** | ||
| 129 | * define DRM_GEM_VRAM_DRIVER - default callback functions for \ | ||
| 130 | &struct drm_driver | ||
| 131 | * | ||
| 132 | * Drivers that use VRAM MM and GEM VRAM can use this macro to initialize | ||
| 133 | * &struct drm_driver with default functions. | ||
| 134 | */ | ||
| 135 | #define DRM_GEM_VRAM_DRIVER \ | ||
| 136 | .gem_free_object_unlocked = \ | ||
| 137 | drm_gem_vram_driver_gem_free_object_unlocked, \ | ||
| 138 | .dumb_create = drm_gem_vram_driver_dumb_create, \ | ||
| 139 | .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset | ||
| 140 | |||
| 141 | /* | ||
| 142 | * PRIME helpers for struct drm_driver | ||
| 143 | */ | ||
| 144 | |||
| 145 | int drm_gem_vram_driver_gem_prime_pin(struct drm_gem_object *obj); | ||
| 146 | void drm_gem_vram_driver_gem_prime_unpin(struct drm_gem_object *obj); | ||
| 147 | void *drm_gem_vram_driver_gem_prime_vmap(struct drm_gem_object *obj); | ||
| 148 | void drm_gem_vram_driver_gem_prime_vunmap(struct drm_gem_object *obj, | ||
| 149 | void *vaddr); | ||
| 150 | int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *obj, | ||
| 151 | struct vm_area_struct *vma); | ||
| 152 | |||
| 153 | #define DRM_GEM_VRAM_DRIVER_PRIME \ | ||
| 154 | .gem_prime_export = drm_gem_prime_export, \ | ||
| 155 | .gem_prime_import = drm_gem_prime_import, \ | ||
| 156 | .gem_prime_pin = drm_gem_vram_driver_gem_prime_pin, \ | ||
| 157 | .gem_prime_unpin = drm_gem_vram_driver_gem_prime_unpin, \ | ||
| 158 | .gem_prime_vmap = drm_gem_vram_driver_gem_prime_vmap, \ | ||
| 159 | .gem_prime_vunmap = drm_gem_vram_driver_gem_prime_vunmap, \ | ||
| 160 | .gem_prime_mmap = drm_gem_vram_driver_gem_prime_mmap | ||
| 161 | |||
| 162 | #endif | ||
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 7f60e8eb269a..c031b5a9d8d1 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h | |||
| @@ -836,6 +836,13 @@ struct drm_mode_config { | |||
| 836 | */ | 836 | */ |
| 837 | struct drm_property *writeback_out_fence_ptr_property; | 837 | struct drm_property *writeback_out_fence_ptr_property; |
| 838 | 838 | ||
| 839 | /** | ||
| 840 | * hdr_output_metadata_property: Connector property containing hdr | ||
| 841 | * metatda. This will be provided by userspace compositors based | ||
| 842 | * on HDR content | ||
| 843 | */ | ||
| 844 | struct drm_property *hdr_output_metadata_property; | ||
| 845 | |||
| 839 | /* dumb ioctl parameters */ | 846 | /* dumb ioctl parameters */ |
| 840 | uint32_t preferred_depth, prefer_shadow; | 847 | uint32_t preferred_depth, prefer_shadow; |
| 841 | 848 | ||
diff --git a/include/drm/drm_vram_mm_helper.h b/include/drm/drm_vram_mm_helper.h new file mode 100644 index 000000000000..a8ffd8599b08 --- /dev/null +++ b/include/drm/drm_vram_mm_helper.h | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | |||
| 3 | #ifndef DRM_VRAM_MM_HELPER_H | ||
| 4 | #define DRM_VRAM_MM_HELPER_H | ||
| 5 | |||
| 6 | #include <drm/ttm/ttm_bo_driver.h> | ||
| 7 | |||
| 8 | struct drm_device; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * struct drm_vram_mm_funcs - Callback functions for &struct drm_vram_mm | ||
| 12 | * @evict_flags: Provides an implementation for struct \ | ||
| 13 | &ttm_bo_driver.evict_flags | ||
| 14 | * @verify_access: Provides an implementation for \ | ||
| 15 | struct &ttm_bo_driver.verify_access | ||
| 16 | * | ||
| 17 | * These callback function integrate VRAM MM with TTM buffer objects. New | ||
| 18 | * functions can be added if necessary. | ||
| 19 | */ | ||
| 20 | struct drm_vram_mm_funcs { | ||
| 21 | void (*evict_flags)(struct ttm_buffer_object *bo, | ||
| 22 | struct ttm_placement *placement); | ||
| 23 | int (*verify_access)(struct ttm_buffer_object *bo, struct file *filp); | ||
| 24 | }; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * struct drm_vram_mm - An instance of VRAM MM | ||
| 28 | * @vram_base: Base address of the managed video memory | ||
| 29 | * @vram_size: Size of the managed video memory in bytes | ||
| 30 | * @bdev: The TTM BO device. | ||
| 31 | * @funcs: TTM BO functions | ||
| 32 | * | ||
| 33 | * The fields &struct drm_vram_mm.vram_base and | ||
| 34 | * &struct drm_vram_mm.vrm_size are managed by VRAM MM, but are | ||
| 35 | * available for public read access. Use the field | ||
| 36 | * &struct drm_vram_mm.bdev to access the TTM BO device. | ||
| 37 | */ | ||
| 38 | struct drm_vram_mm { | ||
| 39 | uint64_t vram_base; | ||
| 40 | size_t vram_size; | ||
| 41 | |||
| 42 | struct ttm_bo_device bdev; | ||
| 43 | |||
| 44 | const struct drm_vram_mm_funcs *funcs; | ||
| 45 | }; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * drm_vram_mm_of_bdev() - \ | ||
| 49 | Returns the container of type &struct ttm_bo_device for field bdev. | ||
| 50 | * @bdev: the TTM BO device | ||
| 51 | * | ||
| 52 | * Returns: | ||
| 53 | * The containing instance of &struct drm_vram_mm | ||
| 54 | */ | ||
| 55 | static inline struct drm_vram_mm *drm_vram_mm_of_bdev( | ||
| 56 | struct ttm_bo_device *bdev) | ||
| 57 | { | ||
| 58 | return container_of(bdev, struct drm_vram_mm, bdev); | ||
| 59 | } | ||
| 60 | |||
| 61 | int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev, | ||
| 62 | uint64_t vram_base, size_t vram_size, | ||
| 63 | const struct drm_vram_mm_funcs *funcs); | ||
| 64 | void drm_vram_mm_cleanup(struct drm_vram_mm *vmm); | ||
| 65 | |||
| 66 | int drm_vram_mm_mmap(struct file *filp, struct vm_area_struct *vma, | ||
| 67 | struct drm_vram_mm *vmm); | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Helpers for integration with struct drm_device | ||
| 71 | */ | ||
| 72 | |||
| 73 | struct drm_vram_mm *drm_vram_helper_alloc_mm( | ||
| 74 | struct drm_device *dev, uint64_t vram_base, size_t vram_size, | ||
| 75 | const struct drm_vram_mm_funcs *funcs); | ||
| 76 | void drm_vram_helper_release_mm(struct drm_device *dev); | ||
| 77 | |||
| 78 | /* | ||
| 79 | * Helpers for &struct file_operations | ||
| 80 | */ | ||
| 81 | |||
| 82 | int drm_vram_mm_file_operations_mmap( | ||
| 83 | struct file *filp, struct vm_area_struct *vma); | ||
| 84 | |||
| 85 | /** | ||
| 86 | * define DRM_VRAM_MM_FILE_OPERATIONS - default callback functions for \ | ||
| 87 | &struct file_operations | ||
| 88 | * | ||
| 89 | * Drivers that use VRAM MM can use this macro to initialize | ||
| 90 | * &struct file_operations with default functions. | ||
| 91 | */ | ||
| 92 | #define DRM_VRAM_MM_FILE_OPERATIONS \ | ||
| 93 | .llseek = no_llseek, \ | ||
| 94 | .read = drm_read, \ | ||
| 95 | .poll = drm_poll, \ | ||
| 96 | .unlocked_ioctl = drm_ioctl, \ | ||
| 97 | .compat_ioctl = drm_compat_ioctl, \ | ||
| 98 | .mmap = drm_vram_mm_file_operations_mmap, \ | ||
| 99 | .open = drm_open, \ | ||
| 100 | .release = drm_release \ | ||
| 101 | |||
| 102 | #endif | ||
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h deleted file mode 100644 index 87ac5e6ca551..000000000000 --- a/include/drm/gma_drm.h +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * Copyright (c) 2007-2011, Intel Corporation. | ||
| 3 | * All Rights Reserved. | ||
| 4 | * Copyright (c) 2008, Tungsten Graphics Inc. Cedar Park, TX., USA. | ||
| 5 | * All Rights Reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms and conditions of the GNU General Public License, | ||
| 9 | * version 2, as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | * more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along with | ||
| 17 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef _GMA_DRM_H_ | ||
| 23 | #define _GMA_DRM_H_ | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 0daca4d8dad9..57b4121c750a 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h | |||
| @@ -167,9 +167,6 @@ struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f); | |||
| 167 | * @sched: the scheduler instance on which this job is scheduled. | 167 | * @sched: the scheduler instance on which this job is scheduled. |
| 168 | * @s_fence: contains the fences for the scheduling of job. | 168 | * @s_fence: contains the fences for the scheduling of job. |
| 169 | * @finish_cb: the callback for the finished fence. | 169 | * @finish_cb: the callback for the finished fence. |
| 170 | * @finish_work: schedules the function @drm_sched_job_finish once the job has | ||
| 171 | * finished to remove the job from the | ||
| 172 | * @drm_gpu_scheduler.ring_mirror_list. | ||
| 173 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. | 170 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. |
| 174 | * @id: a unique id assigned to each job scheduled on the scheduler. | 171 | * @id: a unique id assigned to each job scheduled on the scheduler. |
| 175 | * @karma: increment on every hang caused by this job. If this exceeds the hang | 172 | * @karma: increment on every hang caused by this job. If this exceeds the hang |
| @@ -188,7 +185,6 @@ struct drm_sched_job { | |||
| 188 | struct drm_gpu_scheduler *sched; | 185 | struct drm_gpu_scheduler *sched; |
| 189 | struct drm_sched_fence *s_fence; | 186 | struct drm_sched_fence *s_fence; |
| 190 | struct dma_fence_cb finish_cb; | 187 | struct dma_fence_cb finish_cb; |
| 191 | struct work_struct finish_work; | ||
| 192 | struct list_head node; | 188 | struct list_head node; |
| 193 | uint64_t id; | 189 | uint64_t id; |
| 194 | atomic_t karma; | 190 | atomic_t karma; |
| @@ -263,6 +259,7 @@ struct drm_sched_backend_ops { | |||
| 263 | * guilty and it will be considered for scheduling further. | 259 | * guilty and it will be considered for scheduling further. |
| 264 | * @num_jobs: the number of jobs in queue in the scheduler | 260 | * @num_jobs: the number of jobs in queue in the scheduler |
| 265 | * @ready: marks if the underlying HW is ready to work | 261 | * @ready: marks if the underlying HW is ready to work |
| 262 | * @free_guilty: A hit to time out handler to free the guilty job. | ||
| 266 | * | 263 | * |
| 267 | * One scheduler is implemented for each hardware ring. | 264 | * One scheduler is implemented for each hardware ring. |
| 268 | */ | 265 | */ |
| @@ -283,6 +280,7 @@ struct drm_gpu_scheduler { | |||
| 283 | int hang_limit; | 280 | int hang_limit; |
| 284 | atomic_t num_jobs; | 281 | atomic_t num_jobs; |
| 285 | bool ready; | 282 | bool ready; |
| 283 | bool free_guilty; | ||
| 286 | }; | 284 | }; |
| 287 | 285 | ||
| 288 | int drm_sched_init(struct drm_gpu_scheduler *sched, | 286 | int drm_sched_init(struct drm_gpu_scheduler *sched, |
| @@ -296,7 +294,7 @@ int drm_sched_job_init(struct drm_sched_job *job, | |||
| 296 | void *owner); | 294 | void *owner); |
| 297 | void drm_sched_job_cleanup(struct drm_sched_job *job); | 295 | void drm_sched_job_cleanup(struct drm_sched_job *job); |
| 298 | void drm_sched_wakeup(struct drm_gpu_scheduler *sched); | 296 | void drm_sched_wakeup(struct drm_gpu_scheduler *sched); |
| 299 | void drm_sched_stop(struct drm_gpu_scheduler *sched); | 297 | void drm_sched_stop(struct drm_gpu_scheduler *sched, struct drm_sched_job *bad); |
| 300 | void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery); | 298 | void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery); |
| 301 | void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched); | 299 | void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched); |
| 302 | void drm_sched_increase_karma(struct drm_sched_job *bad); | 300 | void drm_sched_increase_karma(struct drm_sched_job *bad); |
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 58725f890b5b..8a327566d7f4 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
| @@ -39,19 +39,21 @@ struct dma_buf_attachment; | |||
| 39 | 39 | ||
| 40 | /** | 40 | /** |
| 41 | * struct dma_buf_ops - operations possible on struct dma_buf | 41 | * struct dma_buf_ops - operations possible on struct dma_buf |
| 42 | * @map_atomic: [optional] maps a page from the buffer into kernel address | ||
| 43 | * space, users may not block until the subsequent unmap call. | ||
| 44 | * This callback must not sleep. | ||
| 45 | * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. | ||
| 46 | * This Callback must not sleep. | ||
| 47 | * @map: [optional] maps a page from the buffer into kernel address space. | ||
| 48 | * @unmap: [optional] unmaps a page from the buffer. | ||
| 49 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel | 42 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel |
| 50 | * address space. Same restrictions as for vmap and friends apply. | 43 | * address space. Same restrictions as for vmap and friends apply. |
| 51 | * @vunmap: [optional] unmaps a vmap from the buffer | 44 | * @vunmap: [optional] unmaps a vmap from the buffer |
| 52 | */ | 45 | */ |
| 53 | struct dma_buf_ops { | 46 | struct dma_buf_ops { |
| 54 | /** | 47 | /** |
| 48 | * @cache_sgt_mapping: | ||
| 49 | * | ||
| 50 | * If true the framework will cache the first mapping made for each | ||
| 51 | * attachment. This avoids creating mappings for attachments multiple | ||
| 52 | * times. | ||
| 53 | */ | ||
| 54 | bool cache_sgt_mapping; | ||
| 55 | |||
| 56 | /** | ||
| 55 | * @attach: | 57 | * @attach: |
| 56 | * | 58 | * |
| 57 | * This is called from dma_buf_attach() to make sure that a given | 59 | * This is called from dma_buf_attach() to make sure that a given |
| @@ -205,8 +207,6 @@ struct dma_buf_ops { | |||
| 205 | * to be restarted. | 207 | * to be restarted. |
| 206 | */ | 208 | */ |
| 207 | int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); | 209 | int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); |
| 208 | void *(*map)(struct dma_buf *, unsigned long); | ||
| 209 | void (*unmap)(struct dma_buf *, unsigned long, void *); | ||
| 210 | 210 | ||
| 211 | /** | 211 | /** |
| 212 | * @mmap: | 212 | * @mmap: |
| @@ -245,6 +245,31 @@ struct dma_buf_ops { | |||
| 245 | */ | 245 | */ |
| 246 | int (*mmap)(struct dma_buf *, struct vm_area_struct *vma); | 246 | int (*mmap)(struct dma_buf *, struct vm_area_struct *vma); |
| 247 | 247 | ||
| 248 | /** | ||
| 249 | * @map: | ||
| 250 | * | ||
| 251 | * Maps a page from the buffer into kernel address space. The page is | ||
| 252 | * specified by offset into the buffer in PAGE_SIZE units. | ||
| 253 | * | ||
| 254 | * This callback is optional. | ||
| 255 | * | ||
| 256 | * Returns: | ||
| 257 | * | ||
| 258 | * Virtual address pointer where requested page can be accessed. NULL | ||
| 259 | * on error or when this function is unimplemented by the exporter. | ||
| 260 | */ | ||
| 261 | void *(*map)(struct dma_buf *, unsigned long); | ||
| 262 | |||
| 263 | /** | ||
| 264 | * @unmap: | ||
| 265 | * | ||
| 266 | * Unmaps a page from the buffer. Page offset and address pointer should | ||
| 267 | * be the same as the one passed to and returned by matching call to map. | ||
| 268 | * | ||
| 269 | * This callback is optional. | ||
| 270 | */ | ||
| 271 | void (*unmap)(struct dma_buf *, unsigned long, void *); | ||
| 272 | |||
| 248 | void *(*vmap)(struct dma_buf *); | 273 | void *(*vmap)(struct dma_buf *); |
| 249 | void (*vunmap)(struct dma_buf *, void *vaddr); | 274 | void (*vunmap)(struct dma_buf *, void *vaddr); |
| 250 | }; | 275 | }; |
| @@ -307,6 +332,8 @@ struct dma_buf { | |||
| 307 | * @dmabuf: buffer for this attachment. | 332 | * @dmabuf: buffer for this attachment. |
| 308 | * @dev: device attached to the buffer. | 333 | * @dev: device attached to the buffer. |
| 309 | * @node: list of dma_buf_attachment. | 334 | * @node: list of dma_buf_attachment. |
| 335 | * @sgt: cached mapping. | ||
| 336 | * @dir: direction of cached mapping. | ||
| 310 | * @priv: exporter specific attachment data. | 337 | * @priv: exporter specific attachment data. |
| 311 | * | 338 | * |
| 312 | * This structure holds the attachment information between the dma_buf buffer | 339 | * This structure holds the attachment information between the dma_buf buffer |
| @@ -322,6 +349,8 @@ struct dma_buf_attachment { | |||
| 322 | struct dma_buf *dmabuf; | 349 | struct dma_buf *dmabuf; |
| 323 | struct device *dev; | 350 | struct device *dev; |
| 324 | struct list_head node; | 351 | struct list_head node; |
| 352 | struct sg_table *sgt; | ||
| 353 | enum dma_data_direction dir; | ||
| 325 | void *priv; | 354 | void *priv; |
| 326 | }; | 355 | }; |
| 327 | 356 | ||
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index 927ad6451105..ee55ba589cdc 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h | |||
| @@ -47,6 +47,7 @@ enum hdmi_infoframe_type { | |||
| 47 | HDMI_INFOFRAME_TYPE_AVI = 0x82, | 47 | HDMI_INFOFRAME_TYPE_AVI = 0x82, |
| 48 | HDMI_INFOFRAME_TYPE_SPD = 0x83, | 48 | HDMI_INFOFRAME_TYPE_SPD = 0x83, |
| 49 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, | 49 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, |
| 50 | HDMI_INFOFRAME_TYPE_DRM = 0x87, | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | #define HDMI_IEEE_OUI 0x000c03 | 53 | #define HDMI_IEEE_OUI 0x000c03 |
| @@ -55,6 +56,7 @@ enum hdmi_infoframe_type { | |||
| 55 | #define HDMI_AVI_INFOFRAME_SIZE 13 | 56 | #define HDMI_AVI_INFOFRAME_SIZE 13 |
| 56 | #define HDMI_SPD_INFOFRAME_SIZE 25 | 57 | #define HDMI_SPD_INFOFRAME_SIZE 25 |
| 57 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 | 58 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 |
| 59 | #define HDMI_DRM_INFOFRAME_SIZE 26 | ||
| 58 | 60 | ||
| 59 | #define HDMI_INFOFRAME_SIZE(type) \ | 61 | #define HDMI_INFOFRAME_SIZE(type) \ |
| 60 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) | 62 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) |
| @@ -152,6 +154,17 @@ enum hdmi_content_type { | |||
| 152 | HDMI_CONTENT_TYPE_GAME, | 154 | HDMI_CONTENT_TYPE_GAME, |
| 153 | }; | 155 | }; |
| 154 | 156 | ||
| 157 | enum hdmi_metadata_type { | ||
| 158 | HDMI_STATIC_METADATA_TYPE1 = 1, | ||
| 159 | }; | ||
| 160 | |||
| 161 | enum hdmi_eotf { | ||
| 162 | HDMI_EOTF_TRADITIONAL_GAMMA_SDR, | ||
| 163 | HDMI_EOTF_TRADITIONAL_GAMMA_HDR, | ||
| 164 | HDMI_EOTF_SMPTE_ST2084, | ||
| 165 | HDMI_EOTF_BT_2100_HLG, | ||
| 166 | }; | ||
| 167 | |||
| 155 | struct hdmi_avi_infoframe { | 168 | struct hdmi_avi_infoframe { |
| 156 | enum hdmi_infoframe_type type; | 169 | enum hdmi_infoframe_type type; |
| 157 | unsigned char version; | 170 | unsigned char version; |
| @@ -175,12 +188,37 @@ struct hdmi_avi_infoframe { | |||
| 175 | unsigned short right_bar; | 188 | unsigned short right_bar; |
| 176 | }; | 189 | }; |
| 177 | 190 | ||
| 191 | /* DRM Infoframe as per CTA 861.G spec */ | ||
| 192 | struct hdmi_drm_infoframe { | ||
| 193 | enum hdmi_infoframe_type type; | ||
| 194 | unsigned char version; | ||
| 195 | unsigned char length; | ||
| 196 | enum hdmi_eotf eotf; | ||
| 197 | enum hdmi_metadata_type metadata_type; | ||
| 198 | struct { | ||
| 199 | u16 x, y; | ||
| 200 | } display_primaries[3]; | ||
| 201 | struct { | ||
| 202 | u16 x, y; | ||
| 203 | } white_point; | ||
| 204 | u16 max_display_mastering_luminance; | ||
| 205 | u16 min_display_mastering_luminance; | ||
| 206 | u16 max_cll; | ||
| 207 | u16 max_fall; | ||
| 208 | }; | ||
| 209 | |||
| 178 | int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame); | 210 | int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame); |
| 179 | ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, | 211 | ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, |
| 180 | size_t size); | 212 | size_t size); |
| 181 | ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame, | 213 | ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame, |
| 182 | void *buffer, size_t size); | 214 | void *buffer, size_t size); |
| 183 | int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame); | 215 | int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame); |
| 216 | int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame); | ||
| 217 | ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer, | ||
| 218 | size_t size); | ||
| 219 | ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame, | ||
| 220 | void *buffer, size_t size); | ||
| 221 | int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame); | ||
| 184 | 222 | ||
| 185 | enum hdmi_spd_sdi { | 223 | enum hdmi_spd_sdi { |
| 186 | HDMI_SPD_SDI_UNKNOWN, | 224 | HDMI_SPD_SDI_UNKNOWN, |
| @@ -320,6 +358,22 @@ struct hdmi_vendor_infoframe { | |||
| 320 | unsigned int s3d_ext_data; | 358 | unsigned int s3d_ext_data; |
| 321 | }; | 359 | }; |
| 322 | 360 | ||
| 361 | /* HDR Metadata as per 861.G spec */ | ||
| 362 | struct hdr_static_metadata { | ||
| 363 | __u8 eotf; | ||
| 364 | __u8 metadata_type; | ||
| 365 | __u16 max_cll; | ||
| 366 | __u16 max_fall; | ||
| 367 | __u16 min_cll; | ||
| 368 | }; | ||
| 369 | |||
| 370 | struct hdr_sink_metadata { | ||
| 371 | __u32 metadata_type; | ||
| 372 | union { | ||
| 373 | struct hdr_static_metadata hdmi_type1; | ||
| 374 | }; | ||
| 375 | }; | ||
| 376 | |||
| 323 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); | 377 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); |
| 324 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, | 378 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, |
| 325 | void *buffer, size_t size); | 379 | void *buffer, size_t size); |
| @@ -355,6 +409,7 @@ union hdmi_infoframe { | |||
| 355 | struct hdmi_spd_infoframe spd; | 409 | struct hdmi_spd_infoframe spd; |
| 356 | union hdmi_vendor_any_infoframe vendor; | 410 | union hdmi_vendor_any_infoframe vendor; |
| 357 | struct hdmi_audio_infoframe audio; | 411 | struct hdmi_audio_infoframe audio; |
| 412 | struct hdmi_drm_infoframe drm; | ||
| 358 | }; | 413 | }; |
| 359 | 414 | ||
| 360 | ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, | 415 | ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, |
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 661d73f9a919..8a5b2f8f8eb9 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h | |||
| @@ -50,6 +50,7 @@ typedef unsigned int drm_handle_t; | |||
| 50 | 50 | ||
| 51 | #else /* One of the BSDs */ | 51 | #else /* One of the BSDs */ |
| 52 | 52 | ||
| 53 | #include <stdint.h> | ||
| 53 | #include <sys/ioccom.h> | 54 | #include <sys/ioccom.h> |
| 54 | #include <sys/types.h> | 55 | #include <sys/types.h> |
| 55 | typedef int8_t __s8; | 56 | typedef int8_t __s8; |
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 83cd1636b9be..997a7e05c0c6 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h | |||
| @@ -630,6 +630,29 @@ struct drm_color_lut { | |||
| 630 | __u16 reserved; | 630 | __u16 reserved; |
| 631 | }; | 631 | }; |
| 632 | 632 | ||
| 633 | /* HDR Metadata Infoframe as per 861.G spec */ | ||
| 634 | struct hdr_metadata_infoframe { | ||
| 635 | __u8 eotf; | ||
| 636 | __u8 metadata_type; | ||
| 637 | struct { | ||
| 638 | __u16 x, y; | ||
| 639 | } display_primaries[3]; | ||
| 640 | struct { | ||
| 641 | __u16 x, y; | ||
| 642 | } white_point; | ||
| 643 | __u16 max_display_mastering_luminance; | ||
| 644 | __u16 min_display_mastering_luminance; | ||
| 645 | __u16 max_cll; | ||
| 646 | __u16 max_fall; | ||
| 647 | }; | ||
| 648 | |||
| 649 | struct hdr_output_metadata { | ||
| 650 | __u32 metadata_type; | ||
| 651 | union { | ||
| 652 | struct hdr_metadata_infoframe hdmi_metadata_type1; | ||
| 653 | }; | ||
| 654 | }; | ||
| 655 | |||
| 633 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 | 656 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 |
| 634 | #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 | 657 | #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 |
| 635 | #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 | 658 | #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 |
diff --git a/include/uapi/drm/v3d_drm.h b/include/uapi/drm/v3d_drm.h index ea70669d2138..58fbe48c91e9 100644 --- a/include/uapi/drm/v3d_drm.h +++ b/include/uapi/drm/v3d_drm.h | |||
| @@ -37,6 +37,7 @@ extern "C" { | |||
| 37 | #define DRM_V3D_GET_PARAM 0x04 | 37 | #define DRM_V3D_GET_PARAM 0x04 |
| 38 | #define DRM_V3D_GET_BO_OFFSET 0x05 | 38 | #define DRM_V3D_GET_BO_OFFSET 0x05 |
| 39 | #define DRM_V3D_SUBMIT_TFU 0x06 | 39 | #define DRM_V3D_SUBMIT_TFU 0x06 |
| 40 | #define DRM_V3D_SUBMIT_CSD 0x07 | ||
| 40 | 41 | ||
| 41 | #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl) | 42 | #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl) |
| 42 | #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo) | 43 | #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo) |
| @@ -45,6 +46,7 @@ extern "C" { | |||
| 45 | #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param) | 46 | #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param) |
| 46 | #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset) | 47 | #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset) |
| 47 | #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu) | 48 | #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu) |
| 49 | #define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd) | ||
| 48 | 50 | ||
| 49 | /** | 51 | /** |
| 50 | * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D | 52 | * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D |
| @@ -190,6 +192,7 @@ enum drm_v3d_param { | |||
| 190 | DRM_V3D_PARAM_V3D_CORE0_IDENT1, | 192 | DRM_V3D_PARAM_V3D_CORE0_IDENT1, |
| 191 | DRM_V3D_PARAM_V3D_CORE0_IDENT2, | 193 | DRM_V3D_PARAM_V3D_CORE0_IDENT2, |
| 192 | DRM_V3D_PARAM_SUPPORTS_TFU, | 194 | DRM_V3D_PARAM_SUPPORTS_TFU, |
| 195 | DRM_V3D_PARAM_SUPPORTS_CSD, | ||
| 193 | }; | 196 | }; |
| 194 | 197 | ||
| 195 | struct drm_v3d_get_param { | 198 | struct drm_v3d_get_param { |
| @@ -230,6 +233,31 @@ struct drm_v3d_submit_tfu { | |||
| 230 | __u32 out_sync; | 233 | __u32 out_sync; |
| 231 | }; | 234 | }; |
| 232 | 235 | ||
| 236 | /* Submits a compute shader for dispatch. This job will block on any | ||
| 237 | * previous compute shaders submitted on this fd, and any other | ||
| 238 | * synchronization must be performed with in_sync/out_sync. | ||
| 239 | */ | ||
| 240 | struct drm_v3d_submit_csd { | ||
| 241 | __u32 cfg[7]; | ||
| 242 | __u32 coef[4]; | ||
| 243 | |||
| 244 | /* Pointer to a u32 array of the BOs that are referenced by the job. | ||
| 245 | */ | ||
| 246 | __u64 bo_handles; | ||
| 247 | |||
| 248 | /* Number of BO handles passed in (size is that times 4). */ | ||
| 249 | __u32 bo_handle_count; | ||
| 250 | |||
| 251 | /* sync object to block on before running the CSD job. Each | ||
| 252 | * CSD job will execute in the order submitted to its FD. | ||
| 253 | * Synchronization against rendering/TFU jobs or CSD from | ||
| 254 | * other fds requires using sync objects. | ||
| 255 | */ | ||
| 256 | __u32 in_sync; | ||
| 257 | /* Sync object to signal when the CSD job is done. */ | ||
| 258 | __u32 out_sync; | ||
| 259 | }; | ||
| 260 | |||
| 233 | #if defined(__cplusplus) | 261 | #if defined(__cplusplus) |
| 234 | } | 262 | } |
| 235 | #endif | 263 | #endif |
