vsp1_drm.h 2.0 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0+ */
2 3 4 5 6 7 8 9 10 11
/*
 * vsp1_drm.h  --  R-Car VSP1 DRM/KMS Interface
 *
 * Copyright (C) 2015 Renesas Electronics Corporation
 *
 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
 */
#ifndef __VSP1_DRM_H__
#define __VSP1_DRM_H__

12
#include <linux/mutex.h>
13
#include <linux/videodev2.h>
14
#include <linux/wait.h>
15

16 17
#include <media/vsp1.h>

18 19
#include "vsp1_pipe.h"

20
/**
21
 * vsp1_drm_pipeline - State for the API exposed to the DRM driver
22
 * @pipe: the VSP1 pipeline used for display
23 24
 * @width: output display width
 * @height: output display height
25 26
 * @force_brx_release: when set, release the BRx during the next reconfiguration
 * @wait_queue: wait queue to wait for BRx release completion
27 28
 * @uif: UIF entity if available for the pipeline
 * @crc: CRC computation configuration
29 30
 * @du_complete: frame completion callback for the DU driver (optional)
 * @du_private: data to be passed to the du_complete callback
31
 */
32
struct vsp1_drm_pipeline {
33
	struct vsp1_pipeline pipe;
34

35 36 37
	unsigned int width;
	unsigned int height;

38
	bool force_brx_release;
39 40
	wait_queue_head_t wait_queue;

41 42 43
	struct vsp1_entity *uif;
	struct vsp1_du_crc_config crc;

44
	/* Frame synchronisation */
45
	void (*du_complete)(void *data, bool completed, u32 crc);
46 47 48 49 50 51
	void *du_private;
};

/**
 * vsp1_drm - State for the API exposed to the DRM driver
 * @pipe: the VSP1 DRM pipeline used for display
52
 * @lock: protects the BRU and BRS allocation
53 54 55 56 57
 * @inputs: source crop rectangle, destination compose rectangle and z-order
 *	position for every input (indexed by RPF index)
 */
struct vsp1_drm {
	struct vsp1_drm_pipeline pipe[VSP1_MAX_LIF];
58
	struct mutex lock;
59

60 61 62 63 64
	struct {
		struct v4l2_rect crop;
		struct v4l2_rect compose;
		unsigned int zpos;
	} inputs[VSP1_MAX_RPF];
65 66
};

67 68
static inline struct vsp1_drm_pipeline *
to_vsp1_drm_pipeline(struct vsp1_pipeline *pipe)
69
{
70
	return container_of(pipe, struct vsp1_drm_pipeline, pipe);
71 72
}

73
int vsp1_drm_init(struct vsp1_device *vsp1);
74
void vsp1_drm_cleanup(struct vsp1_device *vsp1);
75 76

#endif /* __VSP1_DRM_H__ */