int (*calc_scaling) (unsigned long pclk, unsigned long lclk,
const struct videomode *vm,
u16 width, u16 height, u16 out_width, u16 out_height,
- u32 color_mode, bool *five_taps,
+ u32 fourcc, bool *five_taps,
int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
u16 pos_x, unsigned long *core_clk, bool mem_to_mem);
unsigned long (*calc_core_clk) (unsigned long pclk,
dispc_write_reg(DISPC_OVL_ROW_INC(plane), inc);
}
-static void dispc_ovl_set_color_mode(enum omap_plane_id plane,
- u32 color_mode)
+static void dispc_ovl_set_color_mode(enum omap_plane_id plane, u32 fourcc)
{
u32 m = 0;
if (plane != OMAP_DSS_GFX) {
- switch (color_mode) {
+ switch (fourcc) {
case DRM_FORMAT_NV12:
m = 0x0; break;
case DRM_FORMAT_XRGB4444:
BUG(); return;
}
} else {
- switch (color_mode) {
+ switch (fourcc) {
case DRM_FORMAT_RGBX4444:
m = 0x4; break;
case DRM_FORMAT_ARGB4444:
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1);
}
-static bool format_is_yuv(u32 color_mode)
+static bool format_is_yuv(u32 fourcc)
{
- switch (color_mode) {
+ switch (fourcc) {
case DRM_FORMAT_YUYV:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_NV12:
static void dispc_ovl_set_accu_uv(enum omap_plane_id plane,
u16 orig_width, u16 orig_height, u16 out_width, u16 out_height,
- bool ilace, u32 color_mode, u8 rotation)
+ bool ilace, u32 fourcc, u8 rotation)
{
int h_accu2_0, h_accu2_1;
int v_accu2_0, v_accu2_1;
return;
}
- switch (color_mode) {
+ switch (fourcc) {
case DRM_FORMAT_NV12:
if (ilace)
accu_table = accu_nv12_ilace;
u16 orig_width, u16 orig_height,
u16 out_width, u16 out_height,
bool ilace, bool five_taps,
- bool fieldmode, u32 color_mode,
+ bool fieldmode, u32 fourcc,
u8 rotation)
{
int accu0 = 0;
u16 orig_width, u16 orig_height,
u16 out_width, u16 out_height,
bool ilace, bool five_taps,
- bool fieldmode, u32 color_mode,
+ bool fieldmode, u32 fourcc,
u8 rotation)
{
int scale_x = out_width != orig_width;
if (!dss_has_feature(FEAT_HANDLE_UV_SEPARATE))
return;
- if (!format_is_yuv(color_mode)) {
+ if (!format_is_yuv(fourcc)) {
/* reset chroma resampling for RGB formats */
if (plane != OMAP_DSS_WB)
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 8, 8);
}
dispc_ovl_set_accu_uv(plane, orig_width, orig_height, out_width,
- out_height, ilace, color_mode, rotation);
+ out_height, ilace, fourcc, rotation);
- switch (color_mode) {
+ switch (fourcc) {
case DRM_FORMAT_NV12:
if (chroma_upscale) {
/* UV is subsampled by 2 horizontally and vertically */
u16 orig_width, u16 orig_height,
u16 out_width, u16 out_height,
bool ilace, bool five_taps,
- bool fieldmode, u32 color_mode,
+ bool fieldmode, u32 fourcc,
u8 rotation)
{
BUG_ON(plane == OMAP_DSS_GFX);
orig_width, orig_height,
out_width, out_height,
ilace, five_taps,
- fieldmode, color_mode,
+ fieldmode, fourcc,
rotation);
dispc_ovl_set_scaling_uv(plane,
orig_width, orig_height,
out_width, out_height,
ilace, five_taps,
- fieldmode, color_mode,
+ fieldmode, fourcc,
rotation);
}
static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation,
enum omap_dss_rotation_type rotation_type,
- bool mirroring, u32 color_mode)
+ bool mirroring, u32 fourcc)
{
bool row_repeat = false;
int vidrot = 0;
- if (color_mode == DRM_FORMAT_YUYV ||
- color_mode == DRM_FORMAT_UYVY) {
+ if (fourcc == DRM_FORMAT_YUYV || fourcc == DRM_FORMAT_UYVY) {
if (mirroring) {
switch (rotation) {
* NV12 in 1D mode must use ROTATION=1. Otherwise DSS will fetch extra
* rows beyond the framebuffer, which may cause OCP error.
*/
- if (color_mode == DRM_FORMAT_NV12 &&
- rotation_type != OMAP_DSS_ROT_TILER)
+ if (fourcc == DRM_FORMAT_NV12 && rotation_type != OMAP_DSS_ROT_TILER)
vidrot = 1;
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), vidrot, 13, 12);
if (dss_feat_color_mode_supported(plane, DRM_FORMAT_NV12)) {
bool doublestride =
- color_mode == DRM_FORMAT_NV12 &&
+ fourcc == DRM_FORMAT_NV12 &&
rotation_type == OMAP_DSS_ROT_TILER &&
(rotation == OMAP_DSS_ROT_0 || rotation == OMAP_DSS_ROT_180);
}
}
-static int color_mode_to_bpp(u32 color_mode)
+static int color_mode_to_bpp(u32 fourcc)
{
- switch (color_mode) {
+ switch (fourcc) {
case DRM_FORMAT_NV12:
return 8;
case DRM_FORMAT_RGBX4444:
}
static void calc_offset(u16 screen_width, u16 width,
- u32 color_mode, bool fieldmode,
+ u32 fourcc, bool fieldmode,
unsigned int field_offset, unsigned *offset0, unsigned *offset1,
s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim)
{
u8 ps;
- ps = color_mode_to_bpp(color_mode) / 8;
+ ps = color_mode_to_bpp(fourcc) / 8;
DSSDBG("scrw %d, width %d\n", screen_width, width);
*row_inc = pixinc(1 + (y_predecim * screen_width - width * x_predecim) +
(fieldmode ? screen_width : 0), ps);
- if (color_mode == DRM_FORMAT_YUYV ||
- color_mode == DRM_FORMAT_UYVY)
+ if (fourcc == DRM_FORMAT_YUYV || fourcc == DRM_FORMAT_UYVY)
*pix_inc = pixinc(x_predecim, 2 * ps);
else
*pix_inc = pixinc(x_predecim, ps);
static unsigned long calc_core_clk_five_taps(unsigned long pclk,
const struct videomode *vm, u16 width,
u16 height, u16 out_width, u16 out_height,
- u32 color_mode)
+ u32 fourcc)
{
u32 core_clk = 0;
u64 tmp;
do_div(tmp, out_width);
core_clk = max_t(u32, core_clk, tmp);
- if (color_mode == DRM_FORMAT_XRGB8888)
+ if (fourcc == DRM_FORMAT_XRGB8888)
core_clk <<= 1;
}
static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk,
const struct videomode *vm,
u16 width, u16 height, u16 out_width, u16 out_height,
- u32 color_mode, bool *five_taps,
+ u32 fourcc, bool *five_taps,
int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
u16 pos_x, unsigned long *core_clk, bool mem_to_mem)
{
static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
const struct videomode *vm,
u16 width, u16 height, u16 out_width, u16 out_height,
- u32 color_mode, bool *five_taps,
+ u32 fourcc, bool *five_taps,
int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
u16 pos_x, unsigned long *core_clk, bool mem_to_mem)
{
if (*five_taps)
*core_clk = calc_core_clk_five_taps(pclk, vm,
in_width, in_height, out_width,
- out_height, color_mode);
+ out_height, fourcc);
else
*core_clk = dispc.feat->calc_core_clk(pclk, in_width,
in_height, out_width, out_height,
static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,
const struct videomode *vm,
u16 width, u16 height, u16 out_width, u16 out_height,
- u32 color_mode, bool *five_taps,
+ u32 fourcc, bool *five_taps,
int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
u16 pos_x, unsigned long *core_clk, bool mem_to_mem)
{
return -EINVAL;
}
- if (*decim_x > 4 && color_mode != DRM_FORMAT_NV12) {
+ if (*decim_x > 4 && fourcc != DRM_FORMAT_NV12) {
/*
* Let's disable all scaling that requires horizontal
* decimation with higher factor than 4, until we have
enum omap_overlay_caps caps,
const struct videomode *vm,
u16 width, u16 height, u16 out_width, u16 out_height,
- u32 color_mode, bool *five_taps,
+ u32 fourcc, bool *five_taps,
int *x_predecim, int *y_predecim, u16 pos_x,
enum omap_dss_rotation_type rotation_type, bool mem_to_mem)
{
return -EINVAL;
ret = dispc.feat->calc_scaling(pclk, lclk, vm, width, height,
- out_width, out_height, color_mode, five_taps,
+ out_width, out_height, fourcc, five_taps,
x_predecim, y_predecim, &decim_x, &decim_y, pos_x, &core_clk,
mem_to_mem);
if (ret)
static int dispc_ovl_setup_common(enum omap_plane_id plane,
enum omap_overlay_caps caps, u32 paddr, u32 p_uv_addr,
u16 screen_width, int pos_x, int pos_y, u16 width, u16 height,
- u16 out_width, u16 out_height, u32 color_mode,
+ u16 out_width, u16 out_height, u32 fourcc,
u8 rotation, bool mirror, u8 zorder, u8 pre_mult_alpha,
u8 global_alpha, enum omap_dss_rotation_type rotation_type,
bool replication, const struct videomode *vm,
if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER)
return -EINVAL;
- if (format_is_yuv(color_mode) && (in_width & 1)) {
+ if (format_is_yuv(fourcc) && (in_width & 1)) {
DSSERR("input width %d is not even for YUV format\n", in_width);
return -EINVAL;
}
out_height);
}
- if (!dss_feat_color_mode_supported(plane, color_mode))
+ if (!dss_feat_color_mode_supported(plane, fourcc))
return -EINVAL;
r = dispc_ovl_calc_scaling(pclk, lclk, caps, vm, in_width,
- in_height, out_width, out_height, color_mode,
+ in_height, out_width, out_height, fourcc,
&five_taps, &x_predecim, &y_predecim, pos_x,
rotation_type, mem_to_mem);
if (r)
DSSDBG("predecimation %d x %x, new input size %d x %d\n",
x_predecim, y_predecim, in_width, in_height);
- if (format_is_yuv(color_mode) && (in_width & 1)) {
+ if (format_is_yuv(fourcc) && (in_width & 1)) {
DSSDBG("predecimated input width is not even for YUV format\n");
DSSDBG("adjusting input width %d -> %d\n",
in_width, in_width & ~1);
in_width &= ~1;
}
- if (format_is_yuv(color_mode))
+ if (format_is_yuv(fourcc))
cconv = 1;
if (ilace && !fieldmode) {
}
calc_offset(screen_width, frame_width,
- color_mode, fieldmode, field_offset,
+ fourcc, fieldmode, field_offset,
&offset0, &offset1, &row_inc, &pix_inc,
x_predecim, y_predecim);
DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n",
offset0, offset1, row_inc, pix_inc);
- dispc_ovl_set_color_mode(plane, color_mode);
+ dispc_ovl_set_color_mode(plane, fourcc);
dispc_ovl_configure_burst_type(plane, rotation_type);
dispc_ovl_set_ba0(plane, paddr + offset0);
dispc_ovl_set_ba1(plane, paddr + offset1);
- if (color_mode == DRM_FORMAT_NV12) {
+ if (fourcc == DRM_FORMAT_NV12) {
dispc_ovl_set_ba0_uv(plane, p_uv_addr + offset0);
dispc_ovl_set_ba1_uv(plane, p_uv_addr + offset1);
}
if (caps & OMAP_DSS_OVL_CAP_SCALE) {
dispc_ovl_set_scaling(plane, in_width, in_height, out_width,
out_height, ilace, five_taps, fieldmode,
- color_mode, rotation);
+ fourcc, rotation);
dispc_ovl_set_output_size(plane, out_width, out_height);
dispc_ovl_set_vid_color_conv(plane, cconv);
}
dispc_ovl_set_rotation_attrs(plane, rotation, rotation_type, mirror,
- color_mode);
+ fourcc);
dispc_ovl_set_zorder(plane, caps, zorder);
dispc_ovl_set_pre_mult_alpha(plane, caps, pre_mult_alpha);
" %dx%d, cmode %x, rot %d, mir %d, chan %d repl %d\n",
plane, &oi->paddr, &oi->p_uv_addr, oi->screen_width, oi->pos_x,
oi->pos_y, oi->width, oi->height, oi->out_width, oi->out_height,
- oi->color_mode, oi->rotation, oi->mirror, channel, replication);
+ oi->fourcc, oi->rotation, oi->mirror, channel, replication);
dispc_ovl_set_channel_out(plane, channel);
r = dispc_ovl_setup_common(plane, caps, oi->paddr, oi->p_uv_addr,
oi->screen_width, oi->pos_x, oi->pos_y, oi->width, oi->height,
- oi->out_width, oi->out_height, oi->color_mode, oi->rotation,
+ oi->out_width, oi->out_height, oi->fourcc, oi->rotation,
oi->mirror, oi->zorder, oi->pre_mult_alpha, oi->global_alpha,
oi->rotation_type, replication, vm, mem_to_mem);
DSSDBG("dispc_wb_setup, pa %x, pa_uv %x, %d,%d -> %dx%d, cmode %x, "
"rot %d, mir %d\n", wi->paddr, wi->p_uv_addr, in_width,
- in_height, wi->width, wi->height, wi->color_mode, wi->rotation,
+ in_height, wi->width, wi->height, wi->fourcc, wi->rotation,
wi->mirror);
r = dispc_ovl_setup_common(plane, caps, wi->paddr, wi->p_uv_addr,
wi->buf_width, pos_x, pos_y, in_width, in_height, wi->width,
- wi->height, wi->color_mode, wi->rotation, wi->mirror, zorder,
+ wi->height, wi->fourcc, wi->rotation, wi->mirror, zorder,
wi->pre_mult_alpha, global_alpha, wi->rotation_type,
replication, vm, mem_to_mem);
- switch (wi->color_mode) {
+ switch (wi->fourcc) {
case DRM_FORMAT_RGB565:
case DRM_FORMAT_RGB888:
case DRM_FORMAT_ARGB4444:
.ovli = {
.screen_width = 1,
.width = 1, .height = 1,
- .color_mode = DRM_FORMAT_XRGB8888,
+ .fourcc = DRM_FORMAT_XRGB8888,
.rotation = OMAP_DSS_ROT_0,
.rotation_type = OMAP_DSS_ROT_NONE,
.mirror = 0,
return 0;
i734_buf.size = i734.ovli.width * i734.ovli.height *
- color_mode_to_bpp(i734.ovli.color_mode) / 8;
+ color_mode_to_bpp(i734.ovli.fourcc) / 8;
i734_buf.vaddr = dma_alloc_writecombine(&dispc.pdev->dev, i734_buf.size,
&i734_buf.paddr, GFP_KERNEL);