Commit 7120d8a0 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dpu: pull format flag definitions to mdp_format.h

In preparation to merger of formats databases, pull format flag
definitions to mdp_format.h header, so that they are visibile to both
dpu and mdp drivers.
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/590425/
Link: https://lore.kernel.org/r/20240420-dpu-format-v2-4-9e93226cbffd@linaro.org
parent 932733b8
This diff is collapsed.
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
#include <linux/err.h> #include <linux/err.h>
#include "msm_drv.h" #include "msm_drv.h"
#include "mdp_common.xml.h"
#include "disp/mdp_format.h"
#define DPU_DBG_NAME "dpu" #define DPU_DBG_NAME "dpu"
...@@ -36,25 +37,11 @@ ...@@ -36,25 +37,11 @@
#define DPU_MAX_DE_CURVES 3 #define DPU_MAX_DE_CURVES 3
#endif #endif
enum dpu_format_flags { #define DPU_FORMAT_IS_YUV(X) MSM_FORMAT_IS_YUV(&(X)->base)
DPU_FORMAT_FLAG_YUV_BIT, #define DPU_FORMAT_IS_DX(X) MSM_FORMAT_IS_DX(&(X)->base)
DPU_FORMAT_FLAG_DX_BIT, #define DPU_FORMAT_IS_LINEAR(X) MSM_FORMAT_IS_LINEAR(&(X)->base)
DPU_FORMAT_FLAG_COMPRESSED_BIT, #define DPU_FORMAT_IS_TILE(X) MSM_FORMAT_IS_TILE(&(X)->base)
}; #define DPU_FORMAT_IS_UBWC(X) MSM_FORMAT_IS_UBWC(&(X)->base)
#define DPU_FORMAT_FLAG_YUV BIT(DPU_FORMAT_FLAG_YUV_BIT)
#define DPU_FORMAT_FLAG_DX BIT(DPU_FORMAT_FLAG_DX_BIT)
#define DPU_FORMAT_FLAG_COMPRESSED BIT(DPU_FORMAT_FLAG_COMPRESSED_BIT)
#define DPU_FORMAT_IS_YUV(X) ((X)->flags & DPU_FORMAT_FLAG_YUV)
#define DPU_FORMAT_IS_DX(X) ((X)->flags & DPU_FORMAT_FLAG_DX)
#define DPU_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == MDP_FETCH_LINEAR)
#define DPU_FORMAT_IS_TILE(X) \
(((X)->fetch_mode == MDP_FETCH_UBWC) && \
!((X)->flags & DPU_FORMAT_FLAG_COMPRESSED))
#define DPU_FORMAT_IS_UBWC(X) \
(((X)->fetch_mode == MDP_FETCH_UBWC) && \
((X)->flags & DPU_FORMAT_FLAG_COMPRESSED))
#define DPU_BLEND_FG_ALPHA_FG_CONST (0 << 0) #define DPU_BLEND_FG_ALPHA_FG_CONST (0 << 0)
#define DPU_BLEND_FG_ALPHA_BG_CONST (1 << 0) #define DPU_BLEND_FG_ALPHA_BG_CONST (1 << 0)
...@@ -331,8 +318,6 @@ enum dpu_3d_blend_mode { ...@@ -331,8 +318,6 @@ enum dpu_3d_blend_mode {
* @bpp: bytes per pixel * @bpp: bytes per pixel
* @alpha_enable: whether the format has an alpha channel * @alpha_enable: whether the format has an alpha channel
* @num_planes: number of planes (including meta data planes) * @num_planes: number of planes (including meta data planes)
* @fetch_mode: linear, tiled, or ubwc hw fetch behavior
* @flags: usage bit flags
* @tile_width: format tile width * @tile_width: format tile width
* @tile_height: format tile height * @tile_height: format tile height
*/ */
...@@ -348,8 +333,6 @@ struct dpu_format { ...@@ -348,8 +333,6 @@ struct dpu_format {
u8 bpp; u8 bpp;
u8 alpha_enable; u8 alpha_enable;
u8 num_planes; u8 num_planes;
enum mdp_fetch_mode fetch_mode;
unsigned long flags;
u16 tile_width; u16 tile_width;
u16 tile_height; u16 tile_height;
}; };
......
...@@ -267,10 +267,10 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, ...@@ -267,10 +267,10 @@ 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 != MDP_FETCH_LINEAR) { if (!DPU_FORMAT_IS_LINEAR(fmt)) {
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->base.fetch_mode & 3) << 30; /*FRAME_FORMAT */
DPU_REG_WRITE(c, SSPP_FETCH_CONFIG, DPU_REG_WRITE(c, SSPP_FETCH_CONFIG,
DPU_FETCH_CONFIG_RESET_VALUE | DPU_FETCH_CONFIG_RESET_VALUE |
ctx->ubwc->highest_bank_bit << 18); ctx->ubwc->highest_bank_bit << 18);
......
...@@ -294,14 +294,14 @@ static void _dpu_plane_set_qos_lut(struct drm_plane *plane, ...@@ -294,14 +294,14 @@ static void _dpu_plane_set_qos_lut(struct drm_plane *plane,
trace_dpu_perf_set_danger_luts(pdpu->pipe - SSPP_VIG0, trace_dpu_perf_set_danger_luts(pdpu->pipe - SSPP_VIG0,
(fmt) ? fmt->base.pixel_format : 0, (fmt) ? fmt->base.pixel_format : 0,
(fmt) ? fmt->fetch_mode : 0, (fmt) ? fmt->base.fetch_mode : 0,
cfg.danger_lut, cfg.danger_lut,
cfg.safe_lut); cfg.safe_lut);
DPU_DEBUG_PLANE(pdpu, "pnum:%d fmt: %p4cc mode:%d luts[0x%x, 0x%x]\n", DPU_DEBUG_PLANE(pdpu, "pnum:%d fmt: %p4cc mode:%d luts[0x%x, 0x%x]\n",
pdpu->pipe - SSPP_VIG0, pdpu->pipe - SSPP_VIG0,
fmt ? &fmt->base.pixel_format : NULL, fmt ? &fmt->base.pixel_format : NULL,
fmt ? fmt->fetch_mode : -1, fmt ? fmt->base.fetch_mode : -1,
cfg.danger_lut, cfg.danger_lut,
cfg.safe_lut); cfg.safe_lut);
......
...@@ -634,10 +634,10 @@ static uint32_t get_scale_config(const struct mdp_format *format, ...@@ -634,10 +634,10 @@ static uint32_t get_scale_config(const struct mdp_format *format,
uint32_t src, uint32_t dst, bool horz) uint32_t src, uint32_t dst, bool horz)
{ {
const struct drm_format_info *info = drm_format_info(format->base.pixel_format); const struct drm_format_info *info = drm_format_info(format->base.pixel_format);
bool scaling = format->is_yuv ? true : (src != dst); bool yuv = MDP_FORMAT_IS_YUV(format);
bool scaling = yuv ? true : (src != dst);
uint32_t sub; uint32_t sub;
uint32_t ya_filter, uv_filter; uint32_t ya_filter, uv_filter;
bool yuv = format->is_yuv;
if (!scaling) if (!scaling)
return 0; return 0;
...@@ -666,7 +666,7 @@ static void calc_pixel_ext(const struct mdp_format *format, ...@@ -666,7 +666,7 @@ static void calc_pixel_ext(const struct mdp_format *format,
int pix_ext_edge1[COMP_MAX], int pix_ext_edge2[COMP_MAX], int pix_ext_edge1[COMP_MAX], int pix_ext_edge2[COMP_MAX],
bool horz) bool horz)
{ {
bool scaling = format->is_yuv ? true : (src != dst); bool scaling = MDP_FORMAT_IS_YUV(format) ? true : (src != dst);
int i; int i;
/* /*
...@@ -696,7 +696,7 @@ static void mdp5_write_pixel_ext(struct mdp5_kms *mdp5_kms, enum mdp5_pipe pipe, ...@@ -696,7 +696,7 @@ static void mdp5_write_pixel_ext(struct mdp5_kms *mdp5_kms, enum mdp5_pipe pipe,
uint32_t roi_w = src_w; uint32_t roi_w = src_w;
uint32_t roi_h = src_h; uint32_t roi_h = src_h;
if (format->is_yuv && i == COMP_1_2) { if (MDP_FORMAT_IS_YUV(format) && i == COMP_1_2) {
roi_w /= info->hsub; roi_w /= info->hsub;
roi_h /= info->vsub; roi_h /= info->vsub;
} }
......
...@@ -63,7 +63,10 @@ static struct csc_cfg csc_convert[CSC_MAX] = { ...@@ -63,7 +63,10 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
}; };
#define FMT(name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt, fp, cs, yuv) { \ #define FMT(name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt, fp, cs, yuv) { \
.base = { .pixel_format = DRM_FORMAT_ ## name }, \ .base = { \
.pixel_format = DRM_FORMAT_ ## name, \
.flags = yuv ? MSM_FORMAT_FLAG_YUV : 0, \
}, \
.bpc_a = BPC ## a ## A, \ .bpc_a = BPC ## a ## A, \
.bpc_r = BPC ## r, \ .bpc_r = BPC ## r, \
.bpc_g = BPC ## g, \ .bpc_g = BPC ## g, \
...@@ -75,7 +78,6 @@ static struct csc_cfg csc_convert[CSC_MAX] = { ...@@ -75,7 +78,6 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
.unpack_count = cnt, \ .unpack_count = cnt, \
.fetch_type = fp, \ .fetch_type = fp, \
.chroma_sample = cs, \ .chroma_sample = cs, \
.is_yuv = yuv, \
} }
#define BPC0A 0 #define BPC0A 0
......
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*/
#ifndef __MSM_FORMAT_H__
#define __MSM_FORMAT_H__
#include "mdp_common.xml.h"
enum msm_format_flags {
MSM_FORMAT_FLAG_YUV_BIT,
MSM_FORMAT_FLAG_DX_BIT,
MSM_FORMAT_FLAG_COMPRESSED_BIT,
};
#define MSM_FORMAT_FLAG_YUV BIT(MSM_FORMAT_FLAG_YUV_BIT)
#define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT)
#define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT)
struct msm_format {
uint32_t pixel_format;
unsigned long flags;
enum mdp_fetch_mode fetch_mode;
};
#define MSM_FORMAT_IS_YUV(X) ((X)->flags & MSM_FORMAT_FLAG_YUV)
#define MSM_FORMAT_IS_DX(X) ((X)->flags & MSM_FORMAT_FLAG_DX)
#define MSM_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == MDP_FETCH_LINEAR)
#define MSM_FORMAT_IS_TILE(X) \
(((X)->fetch_mode == MDP_FETCH_UBWC) && \
!((X)->flags & MSM_FORMAT_FLAG_COMPRESSED))
#define MSM_FORMAT_IS_UBWC(X) \
(((X)->fetch_mode == MDP_FETCH_UBWC) && \
((X)->flags & MSM_FORMAT_FLAG_COMPRESSED))
#endif
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include "mdp_format.h"
#include "msm_drv.h" #include "msm_drv.h"
#include "msm_kms.h" #include "msm_kms.h"
#include "mdp_common.xml.h" #include "mdp_common.xml.h"
...@@ -86,10 +87,9 @@ struct mdp_format { ...@@ -86,10 +87,9 @@ struct mdp_format {
uint8_t cpp, unpack_count; uint8_t cpp, unpack_count;
enum mdp_fetch_type fetch_type; enum mdp_fetch_type fetch_type;
enum mdp_chroma_samp_type chroma_sample; enum mdp_chroma_samp_type chroma_sample;
bool is_yuv;
}; };
#define to_mdp_format(x) container_of(x, struct mdp_format, base) #define to_mdp_format(x) container_of(x, struct mdp_format, base)
#define MDP_FORMAT_IS_YUV(mdp_format) ((mdp_format)->is_yuv) #define MDP_FORMAT_IS_YUV(mdp_format) (MSM_FORMAT_IS_YUV(&(mdp_format)->base))
const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format, uint64_t modifier); const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format, uint64_t modifier);
......
...@@ -239,10 +239,6 @@ struct msm_drm_private { ...@@ -239,10 +239,6 @@ struct msm_drm_private {
bool disable_err_irq; bool disable_err_irq;
}; };
struct msm_format {
uint32_t pixel_format;
};
struct msm_pending_timer; struct msm_pending_timer;
int msm_atomic_init_pending_timer(struct msm_pending_timer *timer, int msm_atomic_init_pending_timer(struct msm_pending_timer *timer,
......
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