Skip to content

Commit 62f2104

Browse files
keith-packardairlied
authored andcommitted
drm: Advertise async page flip ability through GETCAP ioctl
Let applications know whether the kernel supports asynchronous page flipping. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@gmail.com>
1 parent 9bba0c4 commit 62f2104

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎drivers/gpu/drm/drm_crtc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
35083508
page_flip->reserved != 0)
35093509
return -EINVAL;
35103510

3511+
if ((page_flip->flags & DRM_MODE_PAGE_FLIP_ASYNC) && !dev->mode_config.async_page_flip)
3512+
return -EINVAL;
3513+
35113514
obj = drm_mode_object_find(dev, page_flip->crtc_id, DRM_MODE_OBJECT_CRTC);
35123515
if (!obj)
35133516
return -EINVAL;

‎drivers/gpu/drm/drm_ioctl.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
293293
case DRM_CAP_TIMESTAMP_MONOTONIC:
294294
req->value = drm_timestamp_monotonic;
295295
break;
296+
case DRM_CAP_ASYNC_PAGE_FLIP:
297+
req->value = dev->mode_config.async_page_flip;
298+
break;
296299
default:
297300
return -EINVAL;
298301
}

‎include/drm/drm_crtc.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ struct drm_mode_config {
842842

843843
/* dumb ioctl parameters */
844844
uint32_t preferred_depth, prefer_shadow;
845+
846+
/* whether async page flip is supported or not */
847+
bool async_page_flip;
845848
};
846849

847850
#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)

‎include/uapi/drm/drm.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ struct drm_event_vblank {
780780
#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
781781
#define DRM_CAP_PRIME 0x5
782782
#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
783+
#define DRM_CAP_ASYNC_PAGE_FLIP 0x7
783784

784785
#define DRM_PRIME_CAP_IMPORT 0x1
785786
#define DRM_PRIME_CAP_EXPORT 0x2

0 commit comments

Comments
 (0)