@@ -787,10 +787,13 @@ static void drm_send_event_helper(struct drm_device *dev,
}
if (e->fence) {
- if (timestamp)
- dma_fence_signal_timestamp(e->fence, timestamp);
- else
- dma_fence_signal(e->fence);
+ if (!dev->mode_config.deferred_out_fence) {
+ if (timestamp)
+ dma_fence_signal_timestamp(e->fence, timestamp);
+ else
+ dma_fence_signal(e->fence);
+ }
+
dma_fence_put(e->fence);
}
@@ -302,6 +302,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
case DRM_CAP_CRTC_IN_VBLANK_EVENT:
req->value = 1;
break;
+ case DRM_CAP_DEFERRED_OUT_FENCE:
+ req->value = dev->mode_config.deferred_out_fence;
+ break;
default:
return -EINVAL;
}
@@ -929,6 +929,15 @@ struct drm_mode_config {
*/
bool normalize_zpos;
+ /**
+ * @deferred_out_fence:
+ *
+ * If this option is set, the drm core would no longer signal the
+ * out_fence at pageflip completion time. Instead, the driver would
+ * signal the out_fence at a time when it deems appropriate.
+ */
+ bool deferred_out_fence;
+
/**
* @modifiers_property: Plane property to list support modifier/format
* combination.
@@ -767,6 +767,7 @@ struct drm_gem_open {
* Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
*/
#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
+#define DRM_CAP_DEFERRED_OUT_FENCE 0x15
/* DRM_IOCTL_GET_CAP ioctl argument type */
struct drm_get_cap {
If a driver supports this capability, it means that it will take ownership of signalling the OUT_FENCE from drm core. Therefore, the OUT_FENCE will no longer be signalled at pageflip completion time but instead at a later time as chosen by the driver. This capability may only be relevant for VKMS drivers. And, it can provide a potential solution for: https://gitlab.freedesktop.org/wayland/weston/-/issues/514 Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> --- drivers/gpu/drm/drm_file.c | 11 +++++++---- drivers/gpu/drm/drm_ioctl.c | 3 +++ include/drm/drm_mode_config.h | 9 +++++++++ include/uapi/drm/drm.h | 1 + 4 files changed, 20 insertions(+), 4 deletions(-)