Commit 78988144 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dpu: use format-related definitions from mdp_common.xml.h

Instead of having DPU-specific defines, switch to the definitions from
the mdp_common.xml.h file. This is the preparation for merged of DPU and
MDP format tables.
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/590420/
Link: https://lore.kernel.org/r/20240420-dpu-format-v2-1-9e93226cbffd@linaro.org
parent 88148bfe
...@@ -2223,19 +2223,19 @@ void dpu_encoder_helper_phys_setup_cdm(struct dpu_encoder_phys *phys_enc, ...@@ -2223,19 +2223,19 @@ void dpu_encoder_helper_phys_setup_cdm(struct dpu_encoder_phys *phys_enc,
/* enable 10 bit logic */ /* enable 10 bit logic */
switch (cdm_cfg->output_fmt->chroma_sample) { switch (cdm_cfg->output_fmt->chroma_sample) {
case DPU_CHROMA_RGB: case CHROMA_FULL:
cdm_cfg->h_cdwn_type = CDM_CDWN_DISABLE; cdm_cfg->h_cdwn_type = CDM_CDWN_DISABLE;
cdm_cfg->v_cdwn_type = CDM_CDWN_DISABLE; cdm_cfg->v_cdwn_type = CDM_CDWN_DISABLE;
break; break;
case DPU_CHROMA_H2V1: case CHROMA_H2V1:
cdm_cfg->h_cdwn_type = CDM_CDWN_COSITE; cdm_cfg->h_cdwn_type = CDM_CDWN_COSITE;
cdm_cfg->v_cdwn_type = CDM_CDWN_DISABLE; cdm_cfg->v_cdwn_type = CDM_CDWN_DISABLE;
break; break;
case DPU_CHROMA_420: case CHROMA_420:
cdm_cfg->h_cdwn_type = CDM_CDWN_COSITE; cdm_cfg->h_cdwn_type = CDM_CDWN_COSITE;
cdm_cfg->v_cdwn_type = CDM_CDWN_OFFSITE; cdm_cfg->v_cdwn_type = CDM_CDWN_OFFSITE;
break; break;
case DPU_CHROMA_H1V2: case CHROMA_H1V2:
default: default:
DPU_ERROR("[enc:%d] unsupported chroma sampling type\n", DPU_ERROR("[enc:%d] unsupported chroma sampling type\n",
DRMID(phys_enc->parent)); DRMID(phys_enc->parent));
......
...@@ -594,7 +594,7 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc ...@@ -594,7 +594,7 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc
wb_cfg->dest.height = job->fb->height; wb_cfg->dest.height = job->fb->height;
wb_cfg->dest.num_planes = wb_cfg->dest.format->num_planes; wb_cfg->dest.num_planes = wb_cfg->dest.format->num_planes;
if ((wb_cfg->dest.format->fetch_planes == DPU_PLANE_PLANAR) && if ((wb_cfg->dest.format->fetch_planes == MDP_PLANE_PLANAR) &&
(wb_cfg->dest.format->element[0] == C1_B_Cb)) (wb_cfg->dest.format->element[0] == C1_B_Cb))
swap(wb_cfg->dest.plane_addr[1], wb_cfg->dest.plane_addr[2]); swap(wb_cfg->dest.plane_addr[1], wb_cfg->dest.plane_addr[2]);
......
This diff is collapsed.
...@@ -186,7 +186,7 @@ static int dpu_hw_cdm_enable(struct dpu_hw_cdm *ctx, struct dpu_hw_cdm_cfg *cdm) ...@@ -186,7 +186,7 @@ static int dpu_hw_cdm_enable(struct dpu_hw_cdm *ctx, struct dpu_hw_cdm_cfg *cdm)
dpu_hw_cdm_setup_cdwn(ctx, cdm); dpu_hw_cdm_setup_cdwn(ctx, cdm);
if (cdm->output_type == CDM_CDWN_OUTPUT_HDMI) { if (cdm->output_type == CDM_CDWN_OUTPUT_HDMI) {
if (fmt->chroma_sample == DPU_CHROMA_H1V2) if (fmt->chroma_sample == CHROMA_H1V2)
return -EINVAL; /*unsupported format */ return -EINVAL; /*unsupported format */
opmode = CDM_HDMI_PACK_OP_MODE_EN; opmode = CDM_HDMI_PACK_OP_MODE_EN;
opmode |= (fmt->chroma_sample << 1); opmode |= (fmt->chroma_sample << 1);
......
...@@ -201,9 +201,9 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *intf, ...@@ -201,9 +201,9 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *intf,
(0x21 << 8)); (0x21 << 8));
else else
/* Interface treats all the pixel data in RGB888 format */ /* Interface treats all the pixel data in RGB888 format */
panel_format = (COLOR_8BIT | panel_format = (BPC8 |
(COLOR_8BIT << 2) | (BPC8 << 2) |
(COLOR_8BIT << 4) | (BPC8 << 4) |
(0x21 << 8)); (0x21 << 8));
DPU_REG_WRITE(c, INTF_HSYNC_CTL, hsync_ctl); DPU_REG_WRITE(c, INTF_HSYNC_CTL, hsync_ctl);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/err.h> #include <linux/err.h>
#include "msm_drv.h" #include "msm_drv.h"
#include "mdp_common.xml.h"
#define DPU_DBG_NAME "dpu" #define DPU_DBG_NAME "dpu"
...@@ -49,12 +50,12 @@ enum dpu_format_flags { ...@@ -49,12 +50,12 @@ enum dpu_format_flags {
(test_bit(DPU_FORMAT_FLAG_YUV_BIT, (X)->flag)) (test_bit(DPU_FORMAT_FLAG_YUV_BIT, (X)->flag))
#define DPU_FORMAT_IS_DX(X) \ #define DPU_FORMAT_IS_DX(X) \
(test_bit(DPU_FORMAT_FLAG_DX_BIT, (X)->flag)) (test_bit(DPU_FORMAT_FLAG_DX_BIT, (X)->flag))
#define DPU_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == DPU_FETCH_LINEAR) #define DPU_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == MDP_FETCH_LINEAR)
#define DPU_FORMAT_IS_TILE(X) \ #define DPU_FORMAT_IS_TILE(X) \
(((X)->fetch_mode == DPU_FETCH_UBWC) && \ (((X)->fetch_mode == MDP_FETCH_UBWC) && \
!test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) !test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag))
#define DPU_FORMAT_IS_UBWC(X) \ #define DPU_FORMAT_IS_UBWC(X) \
(((X)->fetch_mode == DPU_FETCH_UBWC) && \ (((X)->fetch_mode == MDP_FETCH_UBWC) && \
test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag))
#define DPU_BLEND_FG_ALPHA_FG_CONST (0 << 0) #define DPU_BLEND_FG_ALPHA_FG_CONST (0 << 0)
...@@ -300,57 +301,6 @@ enum { ...@@ -300,57 +301,6 @@ enum {
C3_ALPHA = 3 C3_ALPHA = 3
}; };
/**
* enum dpu_plane_type - defines how the color component pixel packing
* @DPU_PLANE_INTERLEAVED : Color components in single plane
* @DPU_PLANE_PLANAR : Color component in separate planes
* @DPU_PLANE_PSEUDO_PLANAR : Chroma components interleaved in separate plane
*/
enum dpu_plane_type {
DPU_PLANE_INTERLEAVED,
DPU_PLANE_PLANAR,
DPU_PLANE_PSEUDO_PLANAR,
};
/**
* enum dpu_chroma_samp_type - chroma sub-samplng type
* @DPU_CHROMA_RGB : No chroma subsampling
* @DPU_CHROMA_H2V1 : Chroma pixels are horizontally subsampled
* @DPU_CHROMA_H1V2 : Chroma pixels are vertically subsampled
* @DPU_CHROMA_420 : 420 subsampling
*/
enum dpu_chroma_samp_type {
DPU_CHROMA_RGB,
DPU_CHROMA_H2V1,
DPU_CHROMA_H1V2,
DPU_CHROMA_420
};
/**
* dpu_fetch_type - Defines How DPU HW fetches data
* @DPU_FETCH_LINEAR : fetch is line by line
* @DPU_FETCH_TILE : fetches data in Z order from a tile
* @DPU_FETCH_UBWC : fetch and decompress data
*/
enum dpu_fetch_type {
DPU_FETCH_LINEAR,
DPU_FETCH_TILE,
DPU_FETCH_UBWC
};
/**
* Value of enum chosen to fit the number of bits
* expected by the HW programming.
*/
enum {
COLOR_ALPHA_1BIT = 0,
COLOR_ALPHA_4BIT = 1,
COLOR_4BIT = 0,
COLOR_5BIT = 1, /* No 5-bit Alpha */
COLOR_6BIT = 2, /* 6-Bit Alpha also = 2 */
COLOR_8BIT = 3, /* 8-Bit Alpha also = 3 */
};
/** /**
* enum dpu_3d_blend_mode * enum dpu_3d_blend_mode
* Desribes how the 3d data is blended * Desribes how the 3d data is blended
...@@ -390,17 +340,17 @@ enum dpu_3d_blend_mode { ...@@ -390,17 +340,17 @@ enum dpu_3d_blend_mode {
*/ */
struct dpu_format { struct dpu_format {
struct msm_format base; struct msm_format base;
enum dpu_plane_type fetch_planes; enum mdp_fetch_type fetch_planes;
u8 element[DPU_MAX_PLANES]; u8 element[DPU_MAX_PLANES];
u8 bits[DPU_MAX_PLANES]; u8 bits[DPU_MAX_PLANES];
enum dpu_chroma_samp_type chroma_sample; enum mdp_chroma_samp_type chroma_sample;
u8 unpack_align_msb; u8 unpack_align_msb;
u8 unpack_tight; u8 unpack_tight;
u8 unpack_count; u8 unpack_count;
u8 bpp; u8 bpp;
u8 alpha_enable; u8 alpha_enable;
u8 num_planes; u8 num_planes;
enum dpu_fetch_type fetch_mode; enum mdp_fetch_mode fetch_mode;
DECLARE_BITMAP(flag, DPU_FORMAT_FLAG_BIT_MAX); DECLARE_BITMAP(flag, DPU_FORMAT_FLAG_BIT_MAX);
u16 tile_width; u16 tile_width;
u16 tile_height; u16 tile_height;
......
...@@ -241,10 +241,10 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, ...@@ -241,10 +241,10 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,
chroma_samp = fmt->chroma_sample; chroma_samp = fmt->chroma_sample;
if (flags & DPU_SSPP_SOURCE_ROTATED_90) { if (flags & DPU_SSPP_SOURCE_ROTATED_90) {
if (chroma_samp == DPU_CHROMA_H2V1) if (chroma_samp == CHROMA_H2V1)
chroma_samp = DPU_CHROMA_H1V2; chroma_samp = CHROMA_H1V2;
else if (chroma_samp == DPU_CHROMA_H1V2) else if (chroma_samp == CHROMA_H1V2)
chroma_samp = DPU_CHROMA_H2V1; chroma_samp = CHROMA_H2V1;
} }
src_format = (chroma_samp << 23) | (fmt->fetch_planes << 19) | src_format = (chroma_samp << 23) | (fmt->fetch_planes << 19) |
...@@ -254,7 +254,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, ...@@ -254,7 +254,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,
if (flags & DPU_SSPP_ROT_90) if (flags & DPU_SSPP_ROT_90)
src_format |= BIT(11); /* ROT90 */ src_format |= BIT(11); /* ROT90 */
if (fmt->alpha_enable && fmt->fetch_planes == DPU_PLANE_INTERLEAVED) if (fmt->alpha_enable && fmt->fetch_planes == MDP_PLANE_INTERLEAVED)
src_format |= BIT(8); /* SRCC3_EN */ src_format |= BIT(8); /* SRCC3_EN */
if (flags & DPU_SSPP_SOLID_FILL) if (flags & DPU_SSPP_SOLID_FILL)
...@@ -267,7 +267,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, ...@@ -267,7 +267,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,
(fmt->unpack_align_msb << 18) | (fmt->unpack_align_msb << 18) |
((fmt->bpp - 1) << 9); ((fmt->bpp - 1) << 9);
if (fmt->fetch_mode != DPU_FETCH_LINEAR) { if (fmt->fetch_mode != MDP_FETCH_LINEAR) {
if (DPU_FORMAT_IS_UBWC(fmt)) if (DPU_FORMAT_IS_UBWC(fmt))
opmode |= MDSS_MDP_OP_BWC_EN; opmode |= MDSS_MDP_OP_BWC_EN;
src_format |= (fmt->fetch_mode & 3) << 30; /*FRAME_FORMAT */ src_format |= (fmt->fetch_mode & 3) << 30; /*FRAME_FORMAT */
......
...@@ -214,8 +214,8 @@ static int _dpu_plane_calc_fill_level(struct drm_plane *plane, ...@@ -214,8 +214,8 @@ static int _dpu_plane_calc_fill_level(struct drm_plane *plane,
/* FIXME: in multirect case account for the src_width of all the planes */ /* FIXME: in multirect case account for the src_width of all the planes */
if (fmt->fetch_planes == DPU_PLANE_PSEUDO_PLANAR) { if (fmt->fetch_planes == MDP_PLANE_PSEUDO_PLANAR) {
if (fmt->chroma_sample == DPU_CHROMA_420) { if (fmt->chroma_sample == CHROMA_420) {
/* NV12 */ /* NV12 */
total_fl = (fixed_buff_size / 2) / total_fl = (fixed_buff_size / 2) /
((src_width + 32) * fmt->bpp); ((src_width + 32) * fmt->bpp);
......
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