2017-12-06 18:29:47 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2014-07-31 14:39:11 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) STMicroelectronics SA 2014
|
|
|
|
* Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics.
|
|
|
|
*/
|
|
|
|
|
2015-07-31 16:32:34 +07:00
|
|
|
#ifndef _STI_PLANE_H_
|
|
|
|
#define _STI_PLANE_H_
|
2014-07-31 14:39:11 +07:00
|
|
|
|
|
|
|
#include <drm/drmP.h>
|
2015-08-03 19:22:16 +07:00
|
|
|
#include <drm/drm_atomic_helper.h>
|
|
|
|
#include <drm/drm_plane_helper.h>
|
|
|
|
|
2015-07-31 16:32:13 +07:00
|
|
|
#define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
|
|
|
|
|
|
|
|
#define STI_PLANE_TYPE_SHIFT 8
|
|
|
|
#define STI_PLANE_TYPE_MASK (~((1 << STI_PLANE_TYPE_SHIFT) - 1))
|
|
|
|
|
|
|
|
enum sti_plane_type {
|
|
|
|
STI_GDP = 1 << STI_PLANE_TYPE_SHIFT,
|
|
|
|
STI_VDP = 2 << STI_PLANE_TYPE_SHIFT,
|
|
|
|
STI_CUR = 3 << STI_PLANE_TYPE_SHIFT,
|
|
|
|
STI_BCK = 4 << STI_PLANE_TYPE_SHIFT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum sti_plane_id_of_type {
|
|
|
|
STI_ID_0 = 0,
|
|
|
|
STI_ID_1 = 1,
|
|
|
|
STI_ID_2 = 2,
|
|
|
|
STI_ID_3 = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
enum sti_plane_desc {
|
|
|
|
STI_GDP_0 = STI_GDP | STI_ID_0,
|
|
|
|
STI_GDP_1 = STI_GDP | STI_ID_1,
|
|
|
|
STI_GDP_2 = STI_GDP | STI_ID_2,
|
|
|
|
STI_GDP_3 = STI_GDP | STI_ID_3,
|
|
|
|
STI_HQVDP_0 = STI_VDP | STI_ID_0,
|
|
|
|
STI_CURSOR = STI_CUR,
|
|
|
|
STI_BACK = STI_BCK
|
|
|
|
};
|
|
|
|
|
2015-08-03 19:22:16 +07:00
|
|
|
enum sti_plane_status {
|
|
|
|
STI_PLANE_READY,
|
|
|
|
STI_PLANE_UPDATED,
|
|
|
|
STI_PLANE_DISABLING,
|
|
|
|
STI_PLANE_FLUSHING,
|
|
|
|
STI_PLANE_DISABLED,
|
|
|
|
};
|
|
|
|
|
2016-11-15 21:33:34 +07:00
|
|
|
#define FPS_LENGTH 128
|
2016-02-08 17:34:31 +07:00
|
|
|
struct sti_fps_info {
|
|
|
|
bool output;
|
|
|
|
unsigned int curr_frame_counter;
|
|
|
|
unsigned int last_frame_counter;
|
|
|
|
unsigned int curr_field_counter;
|
|
|
|
unsigned int last_field_counter;
|
2016-04-13 16:28:02 +07:00
|
|
|
ktime_t last_timestamp;
|
2016-02-08 17:34:31 +07:00
|
|
|
char fps_str[FPS_LENGTH];
|
|
|
|
char fips_str[FPS_LENGTH];
|
|
|
|
};
|
|
|
|
|
2015-07-31 16:32:13 +07:00
|
|
|
/**
|
|
|
|
* STI plane structure
|
|
|
|
*
|
|
|
|
* @plane: drm plane it is bound to (if any)
|
|
|
|
* @desc: plane type & id
|
2015-08-03 19:22:16 +07:00
|
|
|
* @status: to know the status of the plane
|
2016-02-08 17:34:31 +07:00
|
|
|
* @fps_info: frame per second info
|
2015-07-31 16:32:13 +07:00
|
|
|
*/
|
|
|
|
struct sti_plane {
|
|
|
|
struct drm_plane drm_plane;
|
|
|
|
enum sti_plane_desc desc;
|
2015-08-03 19:22:16 +07:00
|
|
|
enum sti_plane_status status;
|
2016-02-08 17:34:31 +07:00
|
|
|
struct sti_fps_info fps_info;
|
2015-07-31 16:32:13 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
const char *sti_plane_to_str(struct sti_plane *plane);
|
2016-02-08 17:34:31 +07:00
|
|
|
void sti_plane_update_fps(struct sti_plane *plane,
|
|
|
|
bool new_frame,
|
|
|
|
bool new_field);
|
2016-06-21 20:09:39 +07:00
|
|
|
|
2015-08-03 19:22:16 +07:00
|
|
|
void sti_plane_init_property(struct sti_plane *plane,
|
|
|
|
enum drm_plane_type type);
|
2016-03-24 23:18:20 +07:00
|
|
|
void sti_plane_reset(struct drm_plane *plane);
|
2014-07-31 14:39:11 +07:00
|
|
|
#endif
|