blob: 1841a5f0e28c2db72d2668bae0deb12ed2087cd9 [file]
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
*/
#ifndef __MESON_CRTC_H
#define __MESON_CRTC_H
#include <linux/kernel.h>
#include <drm/drmP.h>
#include <drm/drm_plane.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include "meson_vpu.h"
#include "meson_drv.h"
#include "meson_fb.h"
enum {
MESON_HDR_POLICY_FOLLOW_SINK = 0,
MESON_HDR_POLICY_FOLLOW_SOURCE,
};
enum {
HDMI_EOTF_MESON_DOLBYVISION = (HDMI_EOTF_BT_2100_HLG + 0xf),
HDMI_EOTF_MESON_DOLBYVISION_LL,
};
struct am_meson_crtc_present_fence {
u32 fd;
struct dma_fence *fence;
struct sync_file *sync_file;
/* lock to protect process context and interrupt context */
spinlock_t lock;
};
struct am_meson_crtc_state {
struct drm_crtc_state base;
int uboot_mode_init;
/*policy update by y property*/
u8 crtc_hdr_process_policy; /*follow sink or follow source*/
/*only used to indicate if dv ll mode output now.*/
u8 crtc_eotf_type;
/*dv core enabled, control by usersapce not driver*/
bool crtc_dv_enable;
/*hdr core enabled, always on if soc support hdr.*/
bool crtc_hdr_enable;
};
struct am_meson_crtc {
struct drm_crtc base;
struct drm_device *drm_dev;
struct meson_drm *priv;
unsigned int irq;
struct drm_pending_vblank_event *event;
struct meson_vpu_pipeline *pipeline;
/*debug*/
int dump_enable;
int blank_enable;
int dump_counts;
int dump_index;
char osddump_path[64];
/*present fence*/
struct am_meson_crtc_present_fence present_fence;
int vpp_crc_enable;
};
#define to_am_meson_crtc(x) container_of(x, \
struct am_meson_crtc, base)
#define to_am_meson_crtc_state(x) container_of(x, \
struct am_meson_crtc_state, base)
int am_meson_crtc_create(struct am_meson_crtc *amcrtc);
int meson_crtc_creat_present_fence_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
void set_dolby_vision_policy(int policy);
int get_dolby_vision_policy(void);
void set_dolby_vision_ll_policy(int policy);
void set_dolby_vision_enable(bool enable);
int get_dv_support_info(void);
bool is_dolby_vision_enable(void);
#endif
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM
void set_hdr_policy(int policy);
int get_hdr_policy(void);
#endif
#endif