Commit 345429a6 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Add DCN2 DWB

Add support to program the DCN2 DWB (Display Writeback)

HW Blocks:

 +--------++------+       +----------+
 | HUBBUB || HUBP |  <--  | MMHUBBUB |
 +--------++------+       +----------+
        |                     ^
        v                     |
    +--------+            +--------+
    |  DPP   |            |  DWB   |
    +--------+            +--------+
        |
        v                      ^
    +--------+                 |
    |  MPC   |                 |
    +--------+                 |
        |                      |
        v                      |
    +-------+                  |
    |  OPP  |                  |
    +-------+                  |
        |                      |
        v                      |
    +--------+                /
    |  OPTC  |  --------------
    +--------+
        |
        v
    +--------+       +--------+
    |  DIO   |       |  DCCG  |
    +--------+       +--------+
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent fa0d2c98
......@@ -421,6 +421,32 @@ enum display_content_type {
DISPLAY_CONTENT_TYPE_GAME = 8
};
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
/* writeback */
struct dc_dwb_cnv_params {
unsigned int src_width; /* input active width */
unsigned int src_height; /* input active height (half-active height in interlaced mode) */
unsigned int crop_width; /* cropped window width at cnv output */
bool crop_en; /* window cropping enable in cnv */
unsigned int crop_height; /* cropped window height at cnv output */
unsigned int crop_x; /* cropped window start x value at cnv output */
unsigned int crop_y; /* cropped window start y value at cnv output */
enum dwb_cnv_out_bpc cnv_out_bpc; /* cnv output pixel depth - 8bpc or 10bpc */
};
struct dc_dwb_params {
struct dc_dwb_cnv_params cnv_params; /* CNV source size and cropping window parameters */
unsigned int dest_width; /* Destination width */
unsigned int dest_height; /* Destination height */
enum dwb_scaler_mode out_format; /* default = YUV420 - TODO: limit this to 0 and 1 on dcn3 */
enum dwb_output_depth output_depth; /* output pixel depth - 8bpc or 10bpc */
enum dwb_capture_rate capture_rate; /* controls the frame capture rate */
struct scaling_taps scaler_taps; /* Scaling taps */
enum dwb_subsample_position subsample_position;
struct dc_transfer_func *out_transfer_func;
};
#endif
/* audio*/
union audio_sample_rates {
......
/*
* Copyright 2012-17 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
#include "reg_helper.h"
#include "resource.h"
#include "dwb.h"
#include "dcn10_dwb.h"
#define REG(reg)\
dwbc10->dwbc_regs->reg
#define CTX \
dwbc10->base.ctx
#undef FN
#define FN(reg_name, field_name) \
dwbc10->dwbc_shift->field_name, dwbc10->dwbc_mask->field_name
#define TO_DCN10_DWBC(dwbc_base) \
container_of(dwbc_base, struct dcn10_dwbc, base)
static bool dwb1_get_caps(struct dwbc *dwbc, struct dwb_caps *caps)
{
if (caps) {
caps->adapter_id = 0; /* we only support 1 adapter currently */
caps->hw_version = DCN_VERSION_1_0;
caps->num_pipes = 2;
memset(&caps->reserved, 0, sizeof(caps->reserved));
memset(&caps->reserved2, 0, sizeof(caps->reserved2));
caps->sw_version = dwb_ver_1_0;
caps->caps.support_dwb = true;
caps->caps.support_ogam = false;
caps->caps.support_wbscl = true;
caps->caps.support_ocsc = false;
return true;
} else {
return false;
}
}
static bool dwb1_enable(struct dwbc *dwbc, struct dc_dwb_params *params)
{
struct dcn10_dwbc *dwbc10 = TO_DCN10_DWBC(dwbc);
/* disable first. */
dwbc->funcs->disable(dwbc);
/* disable power gating */
REG_UPDATE_5(WB_EC_CONFIG, DISPCLK_R_WB_GATE_DIS, 1,
DISPCLK_G_WB_GATE_DIS, 1, DISPCLK_G_WBSCL_GATE_DIS, 1,
WB_LB_LS_DIS, 1, WB_LUT_LS_DIS, 1);
REG_UPDATE(WB_ENABLE, WB_ENABLE, 1);
return true;
}
static bool dwb1_disable(struct dwbc *dwbc)
{
struct dcn10_dwbc *dwbc10 = TO_DCN10_DWBC(dwbc);
/* disable CNV */
REG_UPDATE(CNV_MODE, CNV_FRAME_CAPTURE_EN, 0);
/* disable WB */
REG_UPDATE(WB_ENABLE, WB_ENABLE, 0);
/* soft reset */
REG_UPDATE(WB_SOFT_RESET, WB_SOFT_RESET, 1);
REG_UPDATE(WB_SOFT_RESET, WB_SOFT_RESET, 0);
/* enable power gating */
REG_UPDATE_5(WB_EC_CONFIG, DISPCLK_R_WB_GATE_DIS, 0,
DISPCLK_G_WB_GATE_DIS, 0, DISPCLK_G_WBSCL_GATE_DIS, 0,
WB_LB_LS_DIS, 0, WB_LUT_LS_DIS, 0);
return true;
}
const struct dwbc_funcs dcn10_dwbc_funcs = {
.get_caps = dwb1_get_caps,
.enable = dwb1_enable,
.disable = dwb1_disable,
.update = NULL,
.set_stereo = NULL,
.set_new_content = NULL,
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
.set_warmup = NULL,
#endif
.dwb_set_scaler = NULL,
};
void dcn10_dwbc_construct(struct dcn10_dwbc *dwbc10,
struct dc_context *ctx,
const struct dcn10_dwbc_registers *dwbc_regs,
const struct dcn10_dwbc_shift *dwbc_shift,
const struct dcn10_dwbc_mask *dwbc_mask,
int inst)
{
dwbc10->base.ctx = ctx;
dwbc10->base.inst = inst;
dwbc10->base.funcs = &dcn10_dwbc_funcs;
dwbc10->dwbc_regs = dwbc_regs;
dwbc10->dwbc_shift = dwbc_shift;
dwbc10->dwbc_mask = dwbc_mask;
}
#endif
This diff is collapsed.
/*
* Copyright 2012-17 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#include "reg_helper.h"
#include "resource.h"
#include "dwb.h"
#include "dcn20_dwb.h"
#define REG(reg)\
dwbc20->dwbc_regs->reg
#define CTX \
dwbc20->base.ctx
#undef FN
#define FN(reg_name, field_name) \
dwbc20->dwbc_shift->field_name, dwbc20->dwbc_mask->field_name
enum dwb_outside_pix_strategy {
DWB_OUTSIDE_PIX_STRATEGY_BLACK = 0,
DWB_OUTSIDE_PIX_STRATEGY_EDGE = 1
};
static bool dwb2_get_caps(struct dwbc *dwbc, struct dwb_caps *caps)
{
if (caps) {
caps->adapter_id = 0; /* we only support 1 adapter currently */
caps->hw_version = DCN_VERSION_2_0;
caps->num_pipes = 1;
memset(&caps->reserved, 0, sizeof(caps->reserved));
memset(&caps->reserved2, 0, sizeof(caps->reserved2));
caps->sw_version = dwb_ver_1_0;
caps->caps.support_dwb = true;
caps->caps.support_ogam = false;
caps->caps.support_wbscl = false;
caps->caps.support_ocsc = false;
return true;
} else {
return false;
}
}
void dwb2_config_dwb_cnv(struct dwbc *dwbc, struct dc_dwb_params *params)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
/* Set DWB source size */
REG_UPDATE_2(CNV_SOURCE_SIZE, CNV_SOURCE_WIDTH, params->cnv_params.src_width,
CNV_SOURCE_HEIGHT, params->cnv_params.src_height);
/* source size is not equal the source size, then enable cropping. */
if (params->cnv_params.crop_en) {
REG_UPDATE(CNV_MODE, CNV_WINDOW_CROP_EN, 1);
REG_UPDATE(CNV_WINDOW_START, CNV_WINDOW_START_X, params->cnv_params.crop_x);
REG_UPDATE(CNV_WINDOW_START, CNV_WINDOW_START_Y, params->cnv_params.crop_y);
REG_UPDATE(CNV_WINDOW_SIZE, CNV_WINDOW_WIDTH, params->cnv_params.crop_width);
REG_UPDATE(CNV_WINDOW_SIZE, CNV_WINDOW_HEIGHT, params->cnv_params.crop_height);
} else {
REG_UPDATE(CNV_MODE, CNV_WINDOW_CROP_EN, 0);
}
/* Set CAPTURE_RATE */
REG_UPDATE(CNV_MODE, CNV_FRAME_CAPTURE_RATE, params->capture_rate);
/* Set CNV output pixel depth */
REG_UPDATE(CNV_MODE, CNV_OUT_BPC, params->cnv_params.cnv_out_bpc);
}
static bool dwb2_enable(struct dwbc *dwbc, struct dc_dwb_params *params)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
/* Only chroma scaling (sub-sampling) is supported in DCN2 */
if ((params->cnv_params.src_width != params->dest_width)
|| (params->cnv_params.src_height != params->dest_height)) {
return false;
}
/* disable power gating */
//REG_UPDATE_5(WB_EC_CONFIG, DISPCLK_R_WB_GATE_DIS, 1,
// DISPCLK_G_WB_GATE_DIS, 1, DISPCLK_G_WBSCL_GATE_DIS, 1,
// WB_LB_LS_DIS, 1, WB_LUT_LS_DIS, 1);
/* Set WB_ENABLE (not double buffered; capture not enabled) */
REG_UPDATE(WB_ENABLE, WB_ENABLE, 1);
/* Set CNV parameters */
dwb2_config_dwb_cnv(dwbc, params);
/* Set scaling parameters */
dwb2_set_scaler(dwbc, params);
/* Enable DWB capture enable (double buffered) */
REG_UPDATE(CNV_MODE, CNV_FRAME_CAPTURE_EN, DWB_FRAME_CAPTURE_ENABLE);
// disable warmup
REG_UPDATE(WB_WARM_UP_MODE_CTL1, GMC_WARM_UP_ENABLE, 0);
return true;
}
bool dwb2_disable(struct dwbc *dwbc)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
/* disable CNV */
REG_UPDATE(CNV_MODE, CNV_FRAME_CAPTURE_EN, DWB_FRAME_CAPTURE_DISABLE);
/* disable WB */
REG_UPDATE(WB_ENABLE, WB_ENABLE, 0);
/* soft reset */
REG_UPDATE(WB_SOFT_RESET, WB_SOFT_RESET, 1);
REG_UPDATE(WB_SOFT_RESET, WB_SOFT_RESET, 0);
/* enable power gating */
//REG_UPDATE_5(WB_EC_CONFIG, DISPCLK_R_WB_GATE_DIS, 0,
// DISPCLK_G_WB_GATE_DIS, 0, DISPCLK_G_WBSCL_GATE_DIS, 0,
// WB_LB_LS_DIS, 0, WB_LUT_LS_DIS, 0);
return true;
}
static bool dwb2_update(struct dwbc *dwbc, struct dc_dwb_params *params)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
unsigned int pre_locked;
/* Only chroma scaling (sub-sampling) is supported in DCN2 */
if ((params->cnv_params.src_width != params->dest_width)
|| (params->cnv_params.src_height != params->dest_height)) {
return false;
}
/*
* Check if the caller has already locked CNV registers.
* If so: assume the caller will unlock, so don't touch the lock.
* If not: lock them for this update, then unlock after the
* update is complete.
*/
REG_GET(CNV_UPDATE, CNV_UPDATE_LOCK, &pre_locked);
if (pre_locked == 0) {
/* Lock DWB registers */
REG_UPDATE(CNV_UPDATE, CNV_UPDATE_LOCK, 1);
}
/* Set CNV parameters */
dwb2_config_dwb_cnv(dwbc, params);
/* Set scaling parameters */
dwb2_set_scaler(dwbc, params);
if (pre_locked == 0) {
/* Unlock DWB registers */
REG_UPDATE(CNV_UPDATE, CNV_UPDATE_LOCK, 0);
}
return true;
}
bool dwb2_is_enabled(struct dwbc *dwbc)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
unsigned int wb_enabled = 0;
unsigned int cnv_frame_capture_en = 0;
REG_GET(WB_ENABLE, WB_ENABLE, &wb_enabled);
REG_GET(CNV_MODE, CNV_FRAME_CAPTURE_EN, &cnv_frame_capture_en);
return ((wb_enabled != 0) && (cnv_frame_capture_en != 0));
}
void dwb2_set_stereo(struct dwbc *dwbc,
struct dwb_stereo_params *stereo_params)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
if (stereo_params->stereo_enabled) {
REG_UPDATE(CNV_MODE, CNV_STEREO_TYPE, stereo_params->stereo_type);
REG_UPDATE(CNV_MODE, CNV_EYE_SELECTION, stereo_params->stereo_eye_select);
REG_UPDATE(CNV_MODE, CNV_STEREO_POLARITY, stereo_params->stereo_polarity);
} else {
REG_UPDATE(CNV_MODE, CNV_EYE_SELECTION, 0);
}
}
void dwb2_set_new_content(struct dwbc *dwbc,
bool is_new_content)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
REG_UPDATE(CNV_MODE, CNV_NEW_CONTENT, is_new_content);
}
static void dwb2_set_warmup(struct dwbc *dwbc,
struct dwb_warmup_params *warmup_params)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
REG_UPDATE(WB_WARM_UP_MODE_CTL1, GMC_WARM_UP_ENABLE, warmup_params->warmup_en);
REG_UPDATE(WB_WARM_UP_MODE_CTL1, WIDTH_WARMUP, warmup_params->warmup_width);
REG_UPDATE(WB_WARM_UP_MODE_CTL1, HEIGHT_WARMUP, warmup_params->warmup_height);
REG_UPDATE(WB_WARM_UP_MODE_CTL2, DATA_VALUE_WARMUP, warmup_params->warmup_data);
REG_UPDATE(WB_WARM_UP_MODE_CTL2, MODE_WARMUP, warmup_params->warmup_mode);
REG_UPDATE(WB_WARM_UP_MODE_CTL2, DATA_DEPTH_WARMUP, warmup_params->warmup_depth);
}
void dwb2_set_scaler(struct dwbc *dwbc, struct dc_dwb_params *params)
{
struct dcn20_dwbc *dwbc20 = TO_DCN20_DWBC(dwbc);
/* Program scaling mode */
REG_UPDATE_2(WBSCL_MODE, WBSCL_MODE, params->out_format,
WBSCL_OUT_BIT_DEPTH, params->output_depth);
if (params->out_format != dwb_scaler_mode_bypass444) {
/* Program output size */
REG_UPDATE(WBSCL_DEST_SIZE, WBSCL_DEST_WIDTH, params->dest_width);
REG_UPDATE(WBSCL_DEST_SIZE, WBSCL_DEST_HEIGHT, params->dest_height);
/* Program round offsets */
REG_UPDATE(WBSCL_ROUND_OFFSET, WBSCL_ROUND_OFFSET_Y_RGB, 0x40);
REG_UPDATE(WBSCL_ROUND_OFFSET, WBSCL_ROUND_OFFSET_CBCR, 0x200);
/* Program clamp values */
REG_UPDATE(WBSCL_CLAMP_Y_RGB, WBSCL_CLAMP_UPPER_Y_RGB, 0x3fe);
REG_UPDATE(WBSCL_CLAMP_Y_RGB, WBSCL_CLAMP_LOWER_Y_RGB, 0x1);
REG_UPDATE(WBSCL_CLAMP_CBCR, WBSCL_CLAMP_UPPER_CBCR, 0x3fe);
REG_UPDATE(WBSCL_CLAMP_CBCR, WBSCL_CLAMP_LOWER_CBCR, 0x1);
/* Program outside pixel strategy to use edge pixels */
REG_UPDATE(WBSCL_OUTSIDE_PIX_STRATEGY, WBSCL_OUTSIDE_PIX_STRATEGY, DWB_OUTSIDE_PIX_STRATEGY_EDGE);
if (params->cnv_params.crop_en) {
/* horizontal scale */
dwb_program_horz_scalar(dwbc20, params->cnv_params.crop_width,
params->dest_width,
params->scaler_taps);
/* vertical scale */
dwb_program_vert_scalar(dwbc20, params->cnv_params.crop_height,
params->dest_height,
params->scaler_taps,
params->subsample_position);
} else {
/* horizontal scale */
dwb_program_horz_scalar(dwbc20, params->cnv_params.src_width,
params->dest_width,
params->scaler_taps);
/* vertical scale */
dwb_program_vert_scalar(dwbc20, params->cnv_params.src_height,
params->dest_height,
params->scaler_taps,
params->subsample_position);
}
}
}
const struct dwbc_funcs dcn20_dwbc_funcs = {
.get_caps = dwb2_get_caps,
.enable = dwb2_enable,
.disable = dwb2_disable,
.update = dwb2_update,
.is_enabled = dwb2_is_enabled,
.set_stereo = dwb2_set_stereo,
.set_new_content = dwb2_set_new_content,
.set_warmup = dwb2_set_warmup,
.dwb_set_scaler = dwb2_set_scaler,
};
void dcn20_dwbc_construct(struct dcn20_dwbc *dwbc20,
struct dc_context *ctx,
const struct dcn20_dwbc_registers *dwbc_regs,
const struct dcn20_dwbc_shift *dwbc_shift,
const struct dcn20_dwbc_mask *dwbc_mask,
int inst)
{
dwbc20->base.ctx = ctx;
dwbc20->base.inst = inst;
dwbc20->base.funcs = &dcn20_dwbc_funcs;
dwbc20->dwbc_regs = dwbc_regs;
dwbc20->dwbc_shift = dwbc_shift;
dwbc20->dwbc_mask = dwbc_mask;
}
This diff is collapsed.
This diff is collapsed.
......@@ -36,6 +36,10 @@
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
#include "mpc.h"
#endif
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
#include "dwb.h"
#include "mcif_wb.h"
#endif
#define MAX_CLOCK_SOURCES 7
......@@ -126,7 +130,18 @@ struct resource_funcs {
struct resource_context *res_ctx,
const struct resource_pool *pool,
struct dc_stream_state *stream);
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
void (*populate_dml_writeback_from_context)(
struct dc *dc,
struct resource_context *res_ctx,
display_e2e_pipe_params_st *pipes);
void (*set_mcif_arb_params)(
struct dc *dc,
struct dc_state *context,
display_e2e_pipe_params_st *pipes,
int pipe_cnt);
#endif
};
struct audio_support{
......@@ -154,6 +169,17 @@ struct resource_pool {
struct dce_i2c_sw *sw_i2cs[MAX_PIPES];
bool i2c_hw_buffer_in_use;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
struct dwbc *dwbc[MAX_DWB_PIPES];
struct mcif_wb *mcif_wb[MAX_DWB_PIPES];
struct {
unsigned int gsl_0:1;
unsigned int gsl_1:1;
unsigned int gsl_2:1;
} gsl_groups;
#endif
unsigned int pipe_count;
unsigned int underlay_pipe_index;
unsigned int stream_enc_count;
......@@ -164,7 +190,11 @@ struct resource_pool {
unsigned int dchub_ref_clock_inKhz;
} ref_clocks;
unsigned int timing_generator_count;
unsigned int mpcc_count;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
unsigned int writeback_pipe_count;
#endif
/*
* reserved clock source for DP
*/
......@@ -201,6 +231,12 @@ struct stream_resource {
struct encoder_info_frame encoder_info_frame;
struct abm *abm;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
/* There are only (num_pipes+1)/2 groups. 0 means unassigned,
* otherwise it's using group number 'gsl_group-1'
*/
uint8_t gsl_group;
#endif
};
struct plane_resource {
......@@ -257,6 +293,10 @@ struct pipe_ctx {
struct _vcs_dpi_display_pipe_dest_params_st pipe_dlg_param;
#endif
union pipe_update_flags update_flags;
#ifdef CONFIG_DRM_AMD_DC_DCN2_0
struct dwbc *dwbc;
struct mcif_wb *mcif_wb;
#endif
};
struct resource_context {
......@@ -265,6 +305,9 @@ struct resource_context {
bool is_audio_acquired[MAX_PIPES];
uint8_t clock_source_ref_count[MAX_CLOCK_SOURCES];
uint8_t dp_clock_source_ref_count;
#ifdef CONFIG_DRM_AMD_DC_DCN2_0
bool is_dsc_acquired[MAX_PIPES];
#endif
};
struct dce_bw_output {
......@@ -284,9 +327,18 @@ struct dce_bw_output {
int blackout_recovery_time_us;
};
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
struct dcn_bw_writeback {
struct mcif_arb_params mcif_wb_arb[MAX_DWB_PIPES];
};
#endif
struct dcn_bw_output {
struct dc_clocks clk;
struct dcn_watermark_set watermarks;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
struct dcn_bw_writeback bw_writeback;
#endif
};
union bw_output {
......
/* Copyright 2012-17 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DC_DWBC_H__
#define __DC_DWBC_H__
#include "dc_hw_types.h"
#define DWB_SW_V2 1
#define DWB_MCIF_BUF_COUNT 4
/* forward declaration of mcif_wb struct */
struct mcif_wb;
enum dce_version;
enum dwb_sw_version {
dwb_ver_1_0 = 1,
};
enum dwb_source {
dwb_src_scl = 0, /* for DCE7x/9x, DCN won't support. */
dwb_src_blnd, /* for DCE7x/9x */
dwb_src_fmt, /* for DCE7x/9x */
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
dwb_src_otg0 = 0x100, /* for DCN1.x/DCN2.x, register: mmDWB_SOURCE_SELECT */
dwb_src_otg1, /* for DCN1.x/DCN2.x */
dwb_src_otg2, /* for DCN1.x/DCN2.x */
dwb_src_otg3, /* for DCN1.x/DCN2.x */
#else
dwb_src_otg0 = 0x100, /* for DCN1.x, register: mmDWB_SOURCE_SELECT */
dwb_src_otg1, /* for DCN1.x */
dwb_src_otg2, /* for DCN1.x */
dwb_src_otg3, /* for DCN1.x */
#endif
dwb_src_mpc0 = 0x200, /* for DCN2, register: mmMPC_DWB0_MUX, mmMPC_DWB1_MUX, mmMPC_DWB2_MUX */
dwb_src_mpc1, /* for DCN2 */
dwb_src_mpc2, /* for DCN2 */
dwb_src_mpc3, /* for DCN2 */
dwb_src_mpc4, /* for DCN2 */
};
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
/* DCN1.x, DCN2.x support 2 pipes */
#else
/* DCN1.x supports 2 pipes */
#endif
enum dwb_pipe {
dwb_pipe0 = 0,
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
dwb_pipe1,
#endif
dwb_pipe_max_num,
};
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
enum dwb_frame_capture_enable {
DWB_FRAME_CAPTURE_DISABLE = 0,
DWB_FRAME_CAPTURE_ENABLE = 1,
};
enum dwb_stereo_eye_select {
DWB_STEREO_EYE_LEFT = 1, /* Capture left eye only */
DWB_STEREO_EYE_RIGHT = 2, /* Capture right eye only */
};
enum dwb_stereo_type {
DWB_STEREO_TYPE_FRAME_PACKING = 0, /* Frame packing */
DWB_STEREO_TYPE_FRAME_SEQUENTIAL = 3, /* Frame sequential */
};
enum wbscl_coef_filter_type_sel {
WBSCL_COEF_LUMA_VERT_FILTER = 0,
WBSCL_COEF_CHROMA_VERT_FILTER = 1,
WBSCL_COEF_LUMA_HORZ_FILTER = 2,
WBSCL_COEF_CHROMA_HORZ_FILTER = 3
};
#endif
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
struct dwb_stereo_params {
bool stereo_enabled; /* false: normal mode, true: 3D stereo */
enum dwb_stereo_type stereo_type; /* indicates stereo format */
bool stereo_polarity; /* indicates left eye or right eye comes first in stereo mode */
enum dwb_stereo_eye_select stereo_eye_select; /* indicate which eye should be captured */
};
struct dwb_warmup_params {
bool warmup_en; /* false: normal mode, true: enable pattern generator */
bool warmup_mode; /* false: 420, true: 444 */
bool warmup_depth; /* false: 8bit, true: 10bit */
int warmup_data; /* Data to be sent by pattern generator (same for each pixel component) */
int warmup_width; /* Pattern width (pixels) */
int warmup_height; /* Pattern height (lines) */
};
#endif
struct dwb_caps {
enum dce_version hw_version; /* DCN engine version. */
enum dwb_sw_version sw_version; /* DWB sw implementation version. */
unsigned int reserved[6]; /* Reserved for future use, MUST BE 0. */
unsigned int adapter_id;
unsigned int num_pipes; /* number of DWB pipes */
struct {
unsigned int support_dwb :1;
unsigned int support_ogam :1;
unsigned int support_wbscl :1;
unsigned int support_ocsc :1;
} caps;
unsigned int reserved2[10]; /* Reserved for future use, MUST BE 0. */
};
struct dwbc {
const struct dwbc_funcs *funcs;
struct dc_context *ctx;
int inst;
struct mcif_wb *mcif;
bool status;
int inputSrcSelect;
bool dwb_output_black;
enum dc_transfer_func_predefined tf;
enum dc_color_space output_color_space;
};
struct dwbc_funcs {
bool (*get_caps)(
struct dwbc *dwbc,
struct dwb_caps *caps);
bool (*enable)(
struct dwbc *dwbc,
struct dc_dwb_params *params);
bool (*disable)(struct dwbc *dwbc);
bool (*update)(
struct dwbc *dwbc,
struct dc_dwb_params *params);
bool (*is_enabled)(
struct dwbc *dwbc);
void (*set_stereo)(
struct dwbc *dwbc,
struct dwb_stereo_params *stereo_params);
void (*set_new_content)(
struct dwbc *dwbc,
bool is_new_content);
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
void (*set_warmup)(
struct dwbc *dwbc,
struct dwb_warmup_params *warmup_params);
#endif
void (*dwb_set_scaler)(
struct dwbc *dwbc,
struct dc_dwb_params *params);
};
#endif
/* Copyright 2012-17 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DC_MCIF_WB_H__
#define __DC_MCIF_WB_H__
#include "dc_hw_types.h"
enum mmhubbub_wbif_mode {
PACKED_444 = 0,
PACKED_444_FP16 = 1,
PLANAR_420_8BPC = 2,
PLANAR_420_10BPC = 3
};
struct mcif_arb_params {
unsigned int time_per_pixel;
unsigned int cli_watermark[4];
unsigned int pstate_watermark[4];
unsigned int arbitration_slice;
unsigned int slice_lines;
unsigned int max_scaled_time;
};
struct mcif_irq_params {
unsigned int sw_int_en;
unsigned int sw_slice_int_en;
unsigned int sw_overrun_int_en;
unsigned int vce_int_en;
unsigned int vce_slice_int_en;
};
/* / - mcif_wb_frame_dump_info is the info of the dumping WB data */
struct mcif_wb_frame_dump_info {
unsigned int size;
unsigned int width;
unsigned int height;
unsigned int luma_pitch;
unsigned int chroma_pitch;
enum dwb_scaler_mode format;
};
struct mcif_wb {
const struct mcif_wb_funcs *funcs;
struct dc_context *ctx;
int inst;
};
struct mcif_wb_funcs {
void (*enable_mcif)(struct mcif_wb *mcif_wb);
void (*disable_mcif)(struct mcif_wb *mcif_wb);
void (*config_mcif_buf)(
struct mcif_wb *mcif_wb,
struct mcif_buf_params *params,
unsigned int dest_height);
void (*config_mcif_arb)(
struct mcif_wb *mcif_wb,
struct mcif_arb_params *params);
void (*config_mcif_irq)(
struct mcif_wb *mcif_wb,
struct mcif_irq_params *params);
void (*dump_frame)(
struct mcif_wb *mcif_wb,
struct mcif_buf_params *mcif_params,
enum dwb_scaler_mode out_format,
unsigned int dest_width,
unsigned int dest_height,
struct mcif_wb_frame_dump_info *dump_info,
unsigned char *luma_buffer,
unsigned char *chroma_buffer,
unsigned char *dest_luma_buffer,
unsigned char *dest_chroma_buffer);
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment