Home | History | Annotate | Line # | Download | only in hw
      1 /*	$NetBSD: mcif_wb.h,v 1.2 2021/12/18 23:45:05 riastradh Exp $	*/
      2 
      3 /* Copyright 2012-17 Advanced Micro Devices, Inc.
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining a
      6  * copy of this software and associated documentation files (the "Software"),
      7  * to deal in the Software without restriction, including without limitation
      8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      9  * and/or sell copies of the Software, and to permit persons to whom the
     10  * Software is furnished to do so, subject to the following conditions:
     11  *
     12  * The above copyright notice and this permission notice shall be included in
     13  * all copies or substantial portions of the Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     18  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     21  * OTHER DEALINGS IN THE SOFTWARE.
     22  *
     23  * Authors: AMD
     24  *
     25  */
     26 
     27 #ifndef __DC_MCIF_WB_H__
     28 #define __DC_MCIF_WB_H__
     29 
     30 #include "dc_hw_types.h"
     31 
     32 
     33 enum mmhubbub_wbif_mode {
     34 	PACKED_444 = 0,
     35 	PACKED_444_FP16 = 1,
     36 	PLANAR_420_8BPC = 2,
     37 	PLANAR_420_10BPC = 3
     38 };
     39 
     40 struct mcif_arb_params {
     41 
     42 	unsigned int		time_per_pixel;
     43 	unsigned int		cli_watermark[4];
     44 	unsigned int		pstate_watermark[4];
     45 	unsigned int		arbitration_slice;
     46 	unsigned int		slice_lines;
     47 	unsigned int		max_scaled_time;
     48 };
     49 
     50 struct mcif_irq_params {
     51 	unsigned int		sw_int_en;
     52 	unsigned int		sw_slice_int_en;
     53 	unsigned int		sw_overrun_int_en;
     54 	unsigned int		vce_int_en;
     55 	unsigned int		vce_slice_int_en;
     56 };
     57 
     58 
     59 /* / - mcif_wb_frame_dump_info is the info of the dumping WB data */
     60 struct mcif_wb_frame_dump_info {
     61 	unsigned int		size;
     62 	unsigned int		width;
     63 	unsigned int		height;
     64 	unsigned int		luma_pitch;
     65 	unsigned int		chroma_pitch;
     66 	enum dwb_scaler_mode	format;
     67 };
     68 
     69 struct mcif_wb {
     70 	const struct mcif_wb_funcs *funcs;
     71 	struct dc_context *ctx;
     72 	int inst;
     73 };
     74 
     75 struct mcif_wb_funcs {
     76 
     77 	void (*enable_mcif)(struct mcif_wb *mcif_wb);
     78 
     79 	void (*disable_mcif)(struct mcif_wb *mcif_wb);
     80 
     81 	void (*config_mcif_buf)(
     82 		struct mcif_wb *mcif_wb,
     83 		struct mcif_buf_params *params,
     84 		unsigned int dest_height);
     85 
     86 	 void (*config_mcif_arb)(
     87 		struct mcif_wb *mcif_wb,
     88 		struct mcif_arb_params *params);
     89 
     90 	 void (*config_mcif_irq)(
     91 		struct mcif_wb *mcif_wb,
     92 		struct mcif_irq_params *params);
     93 
     94 	void (*dump_frame)(
     95 		struct mcif_wb *mcif_wb,
     96 		struct mcif_buf_params *mcif_params,
     97 		enum dwb_scaler_mode out_format,
     98 		unsigned int dest_width,
     99 		unsigned int dest_height,
    100 		struct mcif_wb_frame_dump_info *dump_info,
    101 		unsigned char *luma_buffer,
    102 		unsigned char *chroma_buffer,
    103 		unsigned char *dest_luma_buffer,
    104 		unsigned char *dest_chroma_buffer);
    105 };
    106 
    107 #endif
    108