GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / media / platform / vsp1 / vsp1_drm.h
1 /*
2  * vsp1_drm.h  --  R-Car VSP1 DRM/KMS Interface
3  *
4  * Copyright (C) 2015 Renesas Electronics Corporation
5  *
6  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  */
13 #ifndef __VSP1_DRM_H__
14 #define __VSP1_DRM_H__
15
16 #include <linux/videodev2.h>
17
18 #include "vsp1_pipe.h"
19
20 /**
21  * vsp1_drm_pipeline - State for the API exposed to the DRM driver
22  * @pipe: the VSP1 pipeline used for display
23  * @enabled: pipeline state at the beginning of an update
24  * @du_complete: frame completion callback for the DU driver (optional)
25  * @du_private: data to be passed to the du_complete callback
26  */
27 struct vsp1_drm_pipeline {
28         struct vsp1_pipeline pipe;
29         bool enabled;
30
31         /* Frame synchronisation */
32         void (*du_complete)(void *, bool);
33         void *du_private;
34 };
35
36 /**
37  * vsp1_drm - State for the API exposed to the DRM driver
38  * @pipe: the VSP1 DRM pipeline used for display
39  * @inputs: source crop rectangle, destination compose rectangle and z-order
40  *      position for every input (indexed by RPF index)
41  */
42 struct vsp1_drm {
43         struct vsp1_drm_pipeline pipe[VSP1_MAX_LIF];
44
45         struct {
46                 struct v4l2_rect crop;
47                 struct v4l2_rect compose;
48                 unsigned int zpos;
49         } inputs[VSP1_MAX_RPF];
50 };
51
52 static inline struct vsp1_drm_pipeline *
53 to_vsp1_drm_pipeline(struct vsp1_pipeline *pipe)
54 {
55         return container_of(pipe, struct vsp1_drm_pipeline, pipe);
56 }
57
58 int vsp1_drm_init(struct vsp1_device *vsp1);
59 void vsp1_drm_cleanup(struct vsp1_device *vsp1);
60
61 #endif /* __VSP1_DRM_H__ */