2016-03-07 18:00:53 +08:00
|
|
|
/*
|
|
|
|
* (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
|
|
|
|
* Author: Liviu Dudau <Liviu.Dudau@arm.com>
|
|
|
|
*
|
|
|
|
* This program is free software and is provided to you under the terms of the
|
|
|
|
* GNU General Public License version 2 as published by the Free Software
|
|
|
|
* Foundation, and any use by you of this program is subject to the terms
|
|
|
|
* of such GNU licence.
|
|
|
|
*
|
|
|
|
* ARM Mali DP500/DP550/DP650 KMS/DRM driver structures
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MALIDP_DRV_H__
|
|
|
|
#define __MALIDP_DRV_H__
|
|
|
|
|
2017-11-03 00:49:51 +08:00
|
|
|
#include <drm/drm_writeback.h>
|
|
|
|
#include <drm/drm_encoder.h>
|
2016-03-07 18:00:53 +08:00
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/wait.h>
|
2018-05-15 18:18:50 +08:00
|
|
|
#include <linux/spinlock.h>
|
2016-10-07 01:01:39 +08:00
|
|
|
#include <drm/drmP.h>
|
2016-03-07 18:00:53 +08:00
|
|
|
#include "malidp_hw.h"
|
|
|
|
|
2018-04-11 00:25:57 +08:00
|
|
|
#define MALIDP_CONFIG_VALID_INIT 0
|
|
|
|
#define MALIDP_CONFIG_VALID_DONE 1
|
|
|
|
#define MALIDP_CONFIG_START 0xd0
|
|
|
|
|
2018-05-15 18:18:50 +08:00
|
|
|
struct malidp_error_stats {
|
|
|
|
s32 num_errors;
|
|
|
|
u32 last_error_status;
|
|
|
|
s64 last_error_vblank;
|
|
|
|
};
|
|
|
|
|
2016-03-07 18:00:53 +08:00
|
|
|
struct malidp_drm {
|
|
|
|
struct malidp_hw_device *dev;
|
|
|
|
struct drm_crtc crtc;
|
2017-11-03 00:49:51 +08:00
|
|
|
struct drm_writeback_connector mw_connector;
|
2016-03-07 18:00:53 +08:00
|
|
|
wait_queue_head_t wq;
|
2018-03-02 00:38:02 +08:00
|
|
|
struct drm_pending_vblank_event *event;
|
2016-03-07 18:00:53 +08:00
|
|
|
atomic_t config_valid;
|
2017-04-05 18:55:26 +08:00
|
|
|
u32 core_id;
|
2018-05-15 18:18:50 +08:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct malidp_error_stats de_errors;
|
|
|
|
struct malidp_error_stats se_errors;
|
|
|
|
/* Protects errors stats */
|
|
|
|
spinlock_t errors_lock;
|
|
|
|
#endif
|
2016-03-07 18:00:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc)
|
|
|
|
|
|
|
|
struct malidp_plane {
|
|
|
|
struct drm_plane base;
|
|
|
|
struct malidp_hw_device *hwdev;
|
|
|
|
const struct malidp_layer *layer;
|
|
|
|
};
|
|
|
|
|
2018-10-01 21:39:07 +08:00
|
|
|
enum mmu_prefetch_mode {
|
|
|
|
MALIDP_PREFETCH_MODE_NONE,
|
|
|
|
MALIDP_PREFETCH_MODE_PARTIAL,
|
|
|
|
MALIDP_PREFETCH_MODE_FULL,
|
|
|
|
};
|
|
|
|
|
2016-03-07 18:00:53 +08:00
|
|
|
struct malidp_plane_state {
|
|
|
|
struct drm_plane_state base;
|
|
|
|
|
|
|
|
/* size of the required rotation memory if plane is rotated */
|
|
|
|
u32 rotmem_size;
|
2016-10-11 22:26:09 +08:00
|
|
|
/* internal format ID */
|
|
|
|
u8 format;
|
|
|
|
u8 n_planes;
|
2018-10-01 21:39:07 +08:00
|
|
|
enum mmu_prefetch_mode mmu_prefetch_mode;
|
|
|
|
u32 mmu_prefetch_pgsize;
|
2016-03-07 18:00:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define to_malidp_plane(x) container_of(x, struct malidp_plane, base)
|
|
|
|
#define to_malidp_plane_state(x) container_of(x, struct malidp_plane_state, base)
|
|
|
|
|
2017-02-01 22:48:49 +08:00
|
|
|
struct malidp_crtc_state {
|
|
|
|
struct drm_crtc_state base;
|
2017-02-01 22:48:50 +08:00
|
|
|
u32 gamma_coeffs[MALIDP_COEFFTAB_NUM_COEFFS];
|
2017-02-13 20:49:03 +08:00
|
|
|
u32 coloradj_coeffs[MALIDP_COLORADJ_NUM_COEFFS];
|
2017-02-13 23:14:05 +08:00
|
|
|
struct malidp_se_config scaler_config;
|
|
|
|
/* Bitfield of all the planes that have requested a scaled output. */
|
|
|
|
u8 scaled_planes_mask;
|
2017-02-01 22:48:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define to_malidp_crtc_state(x) container_of(x, struct malidp_crtc_state, base)
|
|
|
|
|
2016-03-07 18:00:53 +08:00
|
|
|
int malidp_de_planes_init(struct drm_device *drm);
|
|
|
|
int malidp_crtc_init(struct drm_device *drm);
|
|
|
|
|
2018-07-17 19:11:09 +08:00
|
|
|
bool malidp_hw_format_is_linear_only(u32 format);
|
|
|
|
bool malidp_hw_format_is_afbc_only(u32 format);
|
|
|
|
|
|
|
|
bool malidp_format_mod_supported(struct drm_device *drm,
|
|
|
|
u32 format, u64 modifier);
|
|
|
|
|
2018-05-15 18:18:50 +08:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
void malidp_error(struct malidp_drm *malidp,
|
|
|
|
struct malidp_error_stats *error_stats, u32 status,
|
|
|
|
u64 vblank);
|
|
|
|
#endif
|
|
|
|
|
2016-03-07 18:00:53 +08:00
|
|
|
/* often used combination of rotational bits */
|
2017-05-20 04:50:17 +08:00
|
|
|
#define MALIDP_ROTATED_MASK (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270)
|
2016-03-07 18:00:53 +08:00
|
|
|
|
|
|
|
#endif /* __MALIDP_DRV_H__ */
|