1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * vsp1_drm.h -- R-Car VSP1 DRM/KMS Interface 4 * 5 * Copyright (C) 2015 Renesas Electronics Corporation 6 * 7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) 8 */ 9 #ifndef __VSP1_DRM_H__ 10 #define __VSP1_DRM_H__ 11 12 #include <linux/mutex.h> 13 #include <linux/videodev2.h> 14 #include <linux/wait.h> 15 16 #include <media/vsp1.h> 17 18 #include "vsp1_pipe.h" 19 20 /** 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 32 */ 33 struct vsp1_drm_pipeline { 34 struct vsp1_pipeline pipe; 35 struct vsp1_partition partition; 36 37 unsigned int width; 38 unsigned int height; 39 40 bool force_brx_release; 41 wait_queue_head_t wait_queue; 42 43 struct vsp1_entity *uif; 44 struct vsp1_du_crc_config crc; 45 46 /* Frame synchronisation */ 47 void (*du_complete)(void *data, unsigned int status, u32 crc); 48 void *du_private; 49 }; 50 51 /** 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) 57 */ 58 struct vsp1_drm { 59 struct vsp1_drm_pipeline pipe[VSP1_MAX_LIF]; 60 struct mutex lock; 61 62 struct { 63 struct v4l2_rect crop; 64 struct v4l2_rect compose; 65 unsigned int zpos; 66 } inputs[VSP1_MAX_RPF]; 67 }; 68 69 static inline struct vsp1_drm_pipeline * 70 to_vsp1_drm_pipeline(struct vsp1_pipeline *pipe) 71 { 72 return container_of(pipe, struct vsp1_drm_pipeline, pipe); 73 } 74 75 int vsp1_drm_init(struct vsp1_device *vsp1); 76 void vsp1_drm_cleanup(struct vsp1_device *vsp1); 77 78 #endif /* __VSP1_DRM_H__ */ 79