Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) STMicroelectronics SA 2014
0004  * Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics.
0005  */
0006 
0007 #ifndef _STI_PLANE_H_
0008 #define _STI_PLANE_H_
0009 
0010 #include <drm/drm_atomic_helper.h>
0011 #include <drm/drm_plane_helper.h>
0012 
0013 #define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
0014 
0015 #define STI_PLANE_TYPE_SHIFT 8
0016 #define STI_PLANE_TYPE_MASK (~((1 << STI_PLANE_TYPE_SHIFT) - 1))
0017 
0018 enum sti_plane_type {
0019     STI_GDP = 1 << STI_PLANE_TYPE_SHIFT,
0020     STI_VDP = 2 << STI_PLANE_TYPE_SHIFT,
0021     STI_CUR = 3 << STI_PLANE_TYPE_SHIFT,
0022     STI_BCK = 4 << STI_PLANE_TYPE_SHIFT
0023 };
0024 
0025 enum sti_plane_id_of_type {
0026     STI_ID_0 = 0,
0027     STI_ID_1 = 1,
0028     STI_ID_2 = 2,
0029     STI_ID_3 = 3
0030 };
0031 
0032 enum sti_plane_desc {
0033     STI_GDP_0       = STI_GDP | STI_ID_0,
0034     STI_GDP_1       = STI_GDP | STI_ID_1,
0035     STI_GDP_2       = STI_GDP | STI_ID_2,
0036     STI_GDP_3       = STI_GDP | STI_ID_3,
0037     STI_HQVDP_0     = STI_VDP | STI_ID_0,
0038     STI_CURSOR      = STI_CUR,
0039     STI_BACK        = STI_BCK
0040 };
0041 
0042 enum sti_plane_status {
0043     STI_PLANE_READY,
0044     STI_PLANE_UPDATED,
0045     STI_PLANE_DISABLING,
0046     STI_PLANE_FLUSHING,
0047     STI_PLANE_DISABLED,
0048 };
0049 
0050 #define FPS_LENGTH 128
0051 struct sti_fps_info {
0052     bool output;
0053     unsigned int curr_frame_counter;
0054     unsigned int last_frame_counter;
0055     unsigned int curr_field_counter;
0056     unsigned int last_field_counter;
0057     ktime_t      last_timestamp;
0058     char fps_str[FPS_LENGTH];
0059     char fips_str[FPS_LENGTH];
0060 };
0061 
0062 /**
0063  * STI plane structure
0064  *
0065  * @plane:              drm plane it is bound to (if any)
0066  * @desc:               plane type & id
0067  * @status:             to know the status of the plane
0068  * @fps_info:           frame per second info
0069  */
0070 struct sti_plane {
0071     struct drm_plane drm_plane;
0072     enum sti_plane_desc desc;
0073     enum sti_plane_status status;
0074     struct sti_fps_info fps_info;
0075 };
0076 
0077 const char *sti_plane_to_str(struct sti_plane *plane);
0078 void sti_plane_update_fps(struct sti_plane *plane,
0079               bool new_frame,
0080               bool new_field);
0081 
0082 void sti_plane_init_property(struct sti_plane *plane,
0083                  enum drm_plane_type type);
0084 #endif