diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drm_client.h | 2 | ||||
-rw-r--r-- | include/drm/drm_fb_helper.h | 23 | ||||
-rw-r--r-- | include/drm/drm_format_helper.h | 11 | ||||
-rw-r--r-- | include/drm/drm_gem.h | 7 | ||||
-rw-r--r-- | include/linux/dma-fence.h | 21 | ||||
-rw-r--r-- | include/linux/io-pgtable.h | 7 | ||||
-rw-r--r-- | include/uapi/drm/panfrost_drm.h | 142 | ||||
-rw-r--r-- | include/uapi/linux/virtio_gpu.h | 12 |
8 files changed, 188 insertions, 37 deletions
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 8b552b1a6ce9..268b2cf0052a 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h | |||
@@ -90,7 +90,7 @@ struct drm_client_dev { | |||
90 | int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, | 90 | int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, |
91 | const char *name, const struct drm_client_funcs *funcs); | 91 | const char *name, const struct drm_client_funcs *funcs); |
92 | void drm_client_release(struct drm_client_dev *client); | 92 | void drm_client_release(struct drm_client_dev *client); |
93 | void drm_client_add(struct drm_client_dev *client); | 93 | void drm_client_register(struct drm_client_dev *client); |
94 | 94 | ||
95 | void drm_client_dev_unregister(struct drm_device *dev); | 95 | void drm_client_dev_unregister(struct drm_device *dev); |
96 | void drm_client_dev_hotplug(struct drm_device *dev); | 96 | void drm_client_dev_hotplug(struct drm_device *dev); |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 17857e458ac3..40af2866c26a 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
@@ -102,29 +102,6 @@ struct drm_fb_helper_funcs { | |||
102 | */ | 102 | */ |
103 | int (*fb_probe)(struct drm_fb_helper *helper, | 103 | int (*fb_probe)(struct drm_fb_helper *helper, |
104 | struct drm_fb_helper_surface_size *sizes); | 104 | struct drm_fb_helper_surface_size *sizes); |
105 | |||
106 | /** | ||
107 | * @initial_config: | ||
108 | * | ||
109 | * Driver callback to setup an initial fbdev display configuration. | ||
110 | * Drivers can use this callback to tell the fbdev emulation what the | ||
111 | * preferred initial configuration is. This is useful to implement | ||
112 | * smooth booting where the fbdev (and subsequently all userspace) never | ||
113 | * changes the mode, but always inherits the existing configuration. | ||
114 | * | ||
115 | * This callback is optional. | ||
116 | * | ||
117 | * RETURNS: | ||
118 | * | ||
119 | * The driver should return true if a suitable initial configuration has | ||
120 | * been filled out and false when the fbdev helper should fall back to | ||
121 | * the default probing logic. | ||
122 | */ | ||
123 | bool (*initial_config)(struct drm_fb_helper *fb_helper, | ||
124 | struct drm_fb_helper_crtc **crtcs, | ||
125 | struct drm_display_mode **modes, | ||
126 | struct drm_fb_offset *offsets, | ||
127 | bool *enabled, int width, int height); | ||
128 | }; | 105 | }; |
129 | 106 | ||
130 | struct drm_fb_helper_connector { | 107 | struct drm_fb_helper_connector { |
diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helper.h index 6f84380757ee..085d63faee12 100644 --- a/include/drm/drm_format_helper.h +++ b/include/drm/drm_format_helper.h | |||
@@ -15,17 +15,18 @@ struct drm_rect; | |||
15 | 15 | ||
16 | void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, | 16 | void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, |
17 | struct drm_rect *clip); | 17 | struct drm_rect *clip); |
18 | void drm_fb_memcpy_dstclip(void *dst, void *vaddr, struct drm_framebuffer *fb, | 18 | void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr, |
19 | struct drm_framebuffer *fb, | ||
19 | struct drm_rect *clip); | 20 | struct drm_rect *clip); |
20 | void drm_fb_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, | 21 | void drm_fb_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, |
21 | struct drm_rect *clip); | 22 | struct drm_rect *clip); |
22 | void drm_fb_xrgb8888_to_rgb565(void *dst, void *vaddr, | 23 | void drm_fb_xrgb8888_to_rgb565(void *dst, void *vaddr, |
23 | struct drm_framebuffer *fb, | 24 | struct drm_framebuffer *fb, |
24 | struct drm_rect *clip, bool swap); | 25 | struct drm_rect *clip, bool swab); |
25 | void drm_fb_xrgb8888_to_rgb565_dstclip(void *dst, unsigned int dst_pitch, | 26 | void drm_fb_xrgb8888_to_rgb565_dstclip(void __iomem *dst, unsigned int dst_pitch, |
26 | void *vaddr, struct drm_framebuffer *fb, | 27 | void *vaddr, struct drm_framebuffer *fb, |
27 | struct drm_rect *clip, bool swap); | 28 | struct drm_rect *clip, bool swab); |
28 | void drm_fb_xrgb8888_to_rgb888_dstclip(void *dst, unsigned int dst_pitch, | 29 | void drm_fb_xrgb8888_to_rgb888_dstclip(void __iomem *dst, unsigned int dst_pitch, |
29 | void *vaddr, struct drm_framebuffer *fb, | 30 | void *vaddr, struct drm_framebuffer *fb, |
30 | struct drm_rect *clip); | 31 | struct drm_rect *clip); |
31 | void drm_fb_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, | 32 | void drm_fb_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, |
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 2955aaab3dca..5047c7ee25f5 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h | |||
@@ -381,6 +381,8 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj); | |||
381 | void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, | 381 | void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, |
382 | bool dirty, bool accessed); | 382 | bool dirty, bool accessed); |
383 | 383 | ||
384 | int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles, | ||
385 | int count, struct drm_gem_object ***objs_out); | ||
384 | struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 handle); | 386 | struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 handle); |
385 | long drm_gem_reservation_object_wait(struct drm_file *filep, u32 handle, | 387 | long drm_gem_reservation_object_wait(struct drm_file *filep, u32 handle, |
386 | bool wait_all, unsigned long timeout); | 388 | bool wait_all, unsigned long timeout); |
@@ -388,6 +390,11 @@ int drm_gem_lock_reservations(struct drm_gem_object **objs, int count, | |||
388 | struct ww_acquire_ctx *acquire_ctx); | 390 | struct ww_acquire_ctx *acquire_ctx); |
389 | void drm_gem_unlock_reservations(struct drm_gem_object **objs, int count, | 391 | void drm_gem_unlock_reservations(struct drm_gem_object **objs, int count, |
390 | struct ww_acquire_ctx *acquire_ctx); | 392 | struct ww_acquire_ctx *acquire_ctx); |
393 | int drm_gem_fence_array_add(struct xarray *fence_array, | ||
394 | struct dma_fence *fence); | ||
395 | int drm_gem_fence_array_add_implicit(struct xarray *fence_array, | ||
396 | struct drm_gem_object *obj, | ||
397 | bool write); | ||
391 | int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, | 398 | int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, |
392 | u32 handle, u64 *offset); | 399 | u32 handle, u64 *offset); |
393 | int drm_gem_dumb_destroy(struct drm_file *file, | 400 | int drm_gem_dumb_destroy(struct drm_file *file, |
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index 6b788467b2e3..974717d6ac0c 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h | |||
@@ -112,6 +112,14 @@ struct dma_fence_cb { | |||
112 | */ | 112 | */ |
113 | struct dma_fence_ops { | 113 | struct dma_fence_ops { |
114 | /** | 114 | /** |
115 | * @use_64bit_seqno: | ||
116 | * | ||
117 | * True if this dma_fence implementation uses 64bit seqno, false | ||
118 | * otherwise. | ||
119 | */ | ||
120 | bool use_64bit_seqno; | ||
121 | |||
122 | /** | ||
115 | * @get_driver_name: | 123 | * @get_driver_name: |
116 | * | 124 | * |
117 | * Returns the driver name. This is a callback to allow drivers to | 125 | * Returns the driver name. This is a callback to allow drivers to |
@@ -410,18 +418,19 @@ dma_fence_is_signaled(struct dma_fence *fence) | |||
410 | * __dma_fence_is_later - return if f1 is chronologically later than f2 | 418 | * __dma_fence_is_later - return if f1 is chronologically later than f2 |
411 | * @f1: the first fence's seqno | 419 | * @f1: the first fence's seqno |
412 | * @f2: the second fence's seqno from the same context | 420 | * @f2: the second fence's seqno from the same context |
421 | * @ops: dma_fence_ops associated with the seqno | ||
413 | * | 422 | * |
414 | * Returns true if f1 is chronologically later than f2. Both fences must be | 423 | * Returns true if f1 is chronologically later than f2. Both fences must be |
415 | * from the same context, since a seqno is not common across contexts. | 424 | * from the same context, since a seqno is not common across contexts. |
416 | */ | 425 | */ |
417 | static inline bool __dma_fence_is_later(u64 f1, u64 f2) | 426 | static inline bool __dma_fence_is_later(u64 f1, u64 f2, |
427 | const struct dma_fence_ops *ops) | ||
418 | { | 428 | { |
419 | /* This is for backward compatibility with drivers which can only handle | 429 | /* This is for backward compatibility with drivers which can only handle |
420 | * 32bit sequence numbers. Use a 64bit compare when any of the higher | 430 | * 32bit sequence numbers. Use a 64bit compare when the driver says to |
421 | * bits are none zero, otherwise use a 32bit compare with wrap around | 431 | * do so. |
422 | * handling. | ||
423 | */ | 432 | */ |
424 | if (upper_32_bits(f1) || upper_32_bits(f2)) | 433 | if (ops->use_64bit_seqno) |
425 | return f1 > f2; | 434 | return f1 > f2; |
426 | 435 | ||
427 | return (int)(lower_32_bits(f1) - lower_32_bits(f2)) > 0; | 436 | return (int)(lower_32_bits(f1) - lower_32_bits(f2)) > 0; |
@@ -441,7 +450,7 @@ static inline bool dma_fence_is_later(struct dma_fence *f1, | |||
441 | if (WARN_ON(f1->context != f2->context)) | 450 | if (WARN_ON(f1->context != f2->context)) |
442 | return false; | 451 | return false; |
443 | 452 | ||
444 | return __dma_fence_is_later(f1->seqno, f2->seqno); | 453 | return __dma_fence_is_later(f1->seqno, f2->seqno, f1->ops); |
445 | } | 454 | } |
446 | 455 | ||
447 | /** | 456 | /** |
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h index 47d5ae559329..76969a564831 100644 --- a/include/linux/io-pgtable.h +++ b/include/linux/io-pgtable.h | |||
@@ -12,6 +12,7 @@ enum io_pgtable_fmt { | |||
12 | ARM_64_LPAE_S1, | 12 | ARM_64_LPAE_S1, |
13 | ARM_64_LPAE_S2, | 13 | ARM_64_LPAE_S2, |
14 | ARM_V7S, | 14 | ARM_V7S, |
15 | ARM_MALI_LPAE, | ||
15 | IO_PGTABLE_NUM_FMTS, | 16 | IO_PGTABLE_NUM_FMTS, |
16 | }; | 17 | }; |
17 | 18 | ||
@@ -108,6 +109,11 @@ struct io_pgtable_cfg { | |||
108 | u32 nmrr; | 109 | u32 nmrr; |
109 | u32 prrr; | 110 | u32 prrr; |
110 | } arm_v7s_cfg; | 111 | } arm_v7s_cfg; |
112 | |||
113 | struct { | ||
114 | u64 transtab; | ||
115 | u64 memattr; | ||
116 | } arm_mali_lpae_cfg; | ||
111 | }; | 117 | }; |
112 | }; | 118 | }; |
113 | 119 | ||
@@ -209,5 +215,6 @@ extern struct io_pgtable_init_fns io_pgtable_arm_32_lpae_s2_init_fns; | |||
209 | extern struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns; | 215 | extern struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns; |
210 | extern struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s2_init_fns; | 216 | extern struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s2_init_fns; |
211 | extern struct io_pgtable_init_fns io_pgtable_arm_v7s_init_fns; | 217 | extern struct io_pgtable_init_fns io_pgtable_arm_v7s_init_fns; |
218 | extern struct io_pgtable_init_fns io_pgtable_arm_mali_lpae_init_fns; | ||
212 | 219 | ||
213 | #endif /* __IO_PGTABLE_H */ | 220 | #endif /* __IO_PGTABLE_H */ |
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h new file mode 100644 index 000000000000..a52e0283b90d --- /dev/null +++ b/include/uapi/drm/panfrost_drm.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* SPDX-License-Identifier: MIT */ | ||
2 | /* | ||
3 | * Copyright © 2014-2018 Broadcom | ||
4 | * Copyright © 2019 Collabora ltd. | ||
5 | */ | ||
6 | #ifndef _PANFROST_DRM_H_ | ||
7 | #define _PANFROST_DRM_H_ | ||
8 | |||
9 | #include "drm.h" | ||
10 | |||
11 | #if defined(__cplusplus) | ||
12 | extern "C" { | ||
13 | #endif | ||
14 | |||
15 | #define DRM_PANFROST_SUBMIT 0x00 | ||
16 | #define DRM_PANFROST_WAIT_BO 0x01 | ||
17 | #define DRM_PANFROST_CREATE_BO 0x02 | ||
18 | #define DRM_PANFROST_MMAP_BO 0x03 | ||
19 | #define DRM_PANFROST_GET_PARAM 0x04 | ||
20 | #define DRM_PANFROST_GET_BO_OFFSET 0x05 | ||
21 | |||
22 | #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) | ||
23 | #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) | ||
24 | #define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo) | ||
25 | #define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo) | ||
26 | #define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) | ||
27 | #define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset) | ||
28 | |||
29 | #define PANFROST_JD_REQ_FS (1 << 0) | ||
30 | /** | ||
31 | * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D | ||
32 | * engine. | ||
33 | * | ||
34 | * This asks the kernel to have the GPU execute a render command list. | ||
35 | */ | ||
36 | struct drm_panfrost_submit { | ||
37 | |||
38 | /** Address to GPU mapping of job descriptor */ | ||
39 | __u64 jc; | ||
40 | |||
41 | /** An optional array of sync objects to wait on before starting this job. */ | ||
42 | __u64 in_syncs; | ||
43 | |||
44 | /** Number of sync objects to wait on before starting this job. */ | ||
45 | __u32 in_sync_count; | ||
46 | |||
47 | /** An optional sync object to place the completion fence in. */ | ||
48 | __u32 out_sync; | ||
49 | |||
50 | /** Pointer to a u32 array of the BOs that are referenced by the job. */ | ||
51 | __u64 bo_handles; | ||
52 | |||
53 | /** Number of BO handles passed in (size is that times 4). */ | ||
54 | __u32 bo_handle_count; | ||
55 | |||
56 | /** A combination of PANFROST_JD_REQ_* */ | ||
57 | __u32 requirements; | ||
58 | }; | ||
59 | |||
60 | /** | ||
61 | * struct drm_panfrost_wait_bo - ioctl argument for waiting for | ||
62 | * completion of the last DRM_PANFROST_SUBMIT on a BO. | ||
63 | * | ||
64 | * This is useful for cases where multiple processes might be | ||
65 | * rendering to a BO and you want to wait for all rendering to be | ||
66 | * completed. | ||
67 | */ | ||
68 | struct drm_panfrost_wait_bo { | ||
69 | __u32 handle; | ||
70 | __u32 pad; | ||
71 | __s64 timeout_ns; /* absolute */ | ||
72 | }; | ||
73 | |||
74 | /** | ||
75 | * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs. | ||
76 | * | ||
77 | * There are currently no values for the flags argument, but it may be | ||
78 | * used in a future extension. | ||
79 | */ | ||
80 | struct drm_panfrost_create_bo { | ||
81 | __u32 size; | ||
82 | __u32 flags; | ||
83 | /** Returned GEM handle for the BO. */ | ||
84 | __u32 handle; | ||
85 | /* Pad, must be zero-filled. */ | ||
86 | __u32 pad; | ||
87 | /** | ||
88 | * Returned offset for the BO in the GPU address space. This offset | ||
89 | * is private to the DRM fd and is valid for the lifetime of the GEM | ||
90 | * handle. | ||
91 | * | ||
92 | * This offset value will always be nonzero, since various HW | ||
93 | * units treat 0 specially. | ||
94 | */ | ||
95 | __u64 offset; | ||
96 | }; | ||
97 | |||
98 | /** | ||
99 | * struct drm_panfrost_mmap_bo - ioctl argument for mapping Panfrost BOs. | ||
100 | * | ||
101 | * This doesn't actually perform an mmap. Instead, it returns the | ||
102 | * offset you need to use in an mmap on the DRM device node. This | ||
103 | * means that tools like valgrind end up knowing about the mapped | ||
104 | * memory. | ||
105 | * | ||
106 | * There are currently no values for the flags argument, but it may be | ||
107 | * used in a future extension. | ||
108 | */ | ||
109 | struct drm_panfrost_mmap_bo { | ||
110 | /** Handle for the object being mapped. */ | ||
111 | __u32 handle; | ||
112 | __u32 flags; | ||
113 | /** offset into the drm node to use for subsequent mmap call. */ | ||
114 | __u64 offset; | ||
115 | }; | ||
116 | |||
117 | enum drm_panfrost_param { | ||
118 | DRM_PANFROST_PARAM_GPU_PROD_ID, | ||
119 | }; | ||
120 | |||
121 | struct drm_panfrost_get_param { | ||
122 | __u32 param; | ||
123 | __u32 pad; | ||
124 | __u64 value; | ||
125 | }; | ||
126 | |||
127 | /** | ||
128 | * Returns the offset for the BO in the GPU address space for this DRM fd. | ||
129 | * This is the same value returned by drm_panfrost_create_bo, if that was called | ||
130 | * from this DRM fd. | ||
131 | */ | ||
132 | struct drm_panfrost_get_bo_offset { | ||
133 | __u32 handle; | ||
134 | __u32 pad; | ||
135 | __u64 offset; | ||
136 | }; | ||
137 | |||
138 | #if defined(__cplusplus) | ||
139 | } | ||
140 | #endif | ||
141 | |||
142 | #endif /* _PANFROST_DRM_H_ */ | ||
diff --git a/include/uapi/linux/virtio_gpu.h b/include/uapi/linux/virtio_gpu.h index 8e88eba1fa7a..0c85914d9369 100644 --- a/include/uapi/linux/virtio_gpu.h +++ b/include/uapi/linux/virtio_gpu.h | |||
@@ -40,8 +40,16 @@ | |||
40 | 40 | ||
41 | #include <linux/types.h> | 41 | #include <linux/types.h> |
42 | 42 | ||
43 | #define VIRTIO_GPU_F_VIRGL 0 | 43 | /* |
44 | #define VIRTIO_GPU_F_EDID 1 | 44 | * VIRTIO_GPU_CMD_CTX_* |
45 | * VIRTIO_GPU_CMD_*_3D | ||
46 | */ | ||
47 | #define VIRTIO_GPU_F_VIRGL 0 | ||
48 | |||
49 | /* | ||
50 | * VIRTIO_GPU_CMD_GET_EDID | ||
51 | */ | ||
52 | #define VIRTIO_GPU_F_EDID 1 | ||
45 | 53 | ||
46 | enum virtio_gpu_ctrl_type { | 54 | enum virtio_gpu_ctrl_type { |
47 | VIRTIO_GPU_UNDEFINED = 0, | 55 | VIRTIO_GPU_UNDEFINED = 0, |