blob: c70989b933874e37f4ee125c50e8b1c20abb7112 [file] [log] [blame]
Liviu Dudauad49f862016-03-07 10:00:53 +00001/*
2 * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
3 * Author: Liviu Dudau <Liviu.Dudau@arm.com>
4 *
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
8 * of such GNU licence.
9 *
10 * ARM Mali DP500/DP550/DP650 KMS/DRM driver structures
11 */
12
13#ifndef __MALIDP_DRV_H__
14#define __MALIDP_DRV_H__
15
16#include <linux/mutex.h>
17#include <linux/wait.h>
Liviu Dudaucf4c8872016-10-06 18:01:39 +010018#include <drm/drmP.h>
Liviu Dudauad49f862016-03-07 10:00:53 +000019#include "malidp_hw.h"
20
21struct malidp_drm {
22 struct malidp_hw_device *dev;
Liviu Dudauad49f862016-03-07 10:00:53 +000023 struct drm_crtc crtc;
24 wait_queue_head_t wq;
Liviu Dudaud862b2d2018-03-01 16:38:02 +000025 struct drm_pending_vblank_event *event;
Liviu Dudauad49f862016-03-07 10:00:53 +000026 atomic_t config_valid;
Liviu Dudau50c75122017-04-05 11:55:26 +010027 u32 core_id;
Liviu Dudauad49f862016-03-07 10:00:53 +000028};
29
30#define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc)
31
32struct malidp_plane {
33 struct drm_plane base;
34 struct malidp_hw_device *hwdev;
35 const struct malidp_layer *layer;
36};
37
38struct malidp_plane_state {
39 struct drm_plane_state base;
40
41 /* size of the required rotation memory if plane is rotated */
42 u32 rotmem_size;
Brian Starkey70c94a32016-10-11 15:26:09 +010043 /* internal format ID */
44 u8 format;
45 u8 n_planes;
Liviu Dudauad49f862016-03-07 10:00:53 +000046};
47
48#define to_malidp_plane(x) container_of(x, struct malidp_plane, base)
49#define to_malidp_plane_state(x) container_of(x, struct malidp_plane_state, base)
50
Mihail Atanassov99665d02017-02-01 14:48:49 +000051struct malidp_crtc_state {
52 struct drm_crtc_state base;
Mihail Atanassov02725d32017-02-01 14:48:50 +000053 u32 gamma_coeffs[MALIDP_COEFFTAB_NUM_COEFFS];
Mihail Atanassov6954f242017-02-13 12:49:03 +000054 u32 coloradj_coeffs[MALIDP_COLORADJ_NUM_COEFFS];
Mihail Atanassov28ce6752017-02-13 15:14:05 +000055 struct malidp_se_config scaler_config;
56 /* Bitfield of all the planes that have requested a scaled output. */
57 u8 scaled_planes_mask;
Mihail Atanassov99665d02017-02-01 14:48:49 +000058};
59
60#define to_malidp_crtc_state(x) container_of(x, struct malidp_crtc_state, base)
61
Liviu Dudauad49f862016-03-07 10:00:53 +000062int malidp_de_planes_init(struct drm_device *drm);
Liviu Dudauad49f862016-03-07 10:00:53 +000063int malidp_crtc_init(struct drm_device *drm);
64
65/* often used combination of rotational bits */
Robert Fossc2c446a2017-05-19 16:50:17 -040066#define MALIDP_ROTATED_MASK (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270)
Liviu Dudauad49f862016-03-07 10:00:53 +000067
68#endif /* __MALIDP_DRV_H__ */