1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * vsp1_drm.h -- R-Car VSP1 DRM/KMS Interface
5 * Copyright (C) 2015 Renesas Electronics Corporation
10 #define __VSP1_DRM_H__
12 #include <linux/mutex.h>
13 #include <linux/videodev2.h>
14 #include <linux/wait.h>
16 #include <media/vsp1.h>
18 #include "vsp1_pipe.h"
21 * struct vsp1_drm_pipeline - State for the API exposed to the DRM driver
22 * @pipe: the VSP1 pipeline used for display
23 * @partition: the pre-calculated partition used by the pipeline
24 * @width: output display width
25 * @height: output display height
26 * @force_brx_release: when set, release the BRx during the next reconfiguration
27 * @wait_queue: wait queue to wait for BRx release completion
28 * @uif: UIF entity if available for the pipeline
29 * @crc: CRC computation configuration
30 * @du_complete: frame completion callback for the DU driver (optional)
31 * @du_private: data to be passed to the du_complete callback
33 struct vsp1_drm_pipeline {
34 struct vsp1_pipeline pipe;
35 struct vsp1_partition partition;
40 bool force_brx_release;
41 wait_queue_head_t wait_queue;
43 struct vsp1_entity *uif;
44 struct vsp1_du_crc_config crc;
46 /* Frame synchronisation */
47 void (*du_complete)(void *data, unsigned int status, u32 crc);
52 * struct vsp1_drm - State for the API exposed to the DRM driver
53 * @pipe: the VSP1 DRM pipeline used for display
54 * @lock: protects the BRU and BRS allocation
55 * @inputs: source crop rectangle, destination compose rectangle and z-order
56 * position for every input (indexed by RPF index)
59 struct vsp1_drm_pipeline pipe[VSP1_MAX_LIF];
63 struct v4l2_rect crop;
64 struct v4l2_rect compose;
66 } inputs[VSP1_MAX_RPF];
69 static inline struct vsp1_drm_pipeline *
70 to_vsp1_drm_pipeline(struct vsp1_pipeline *pipe)
72 return container_of(pipe, struct vsp1_drm_pipeline, pipe);
75 int vsp1_drm_init(struct vsp1_device *vsp1);
76 void vsp1_drm_cleanup(struct vsp1_device *vsp1);
78 #endif /* __VSP1_DRM_H__ */