Skip to content

Commit

Permalink
dma: xilinx: Add alpha formats support for Framebuffer Read
Browse files Browse the repository at this point in the history
Add support to translate alpha DRM fourcc formats to corresponding
8bpc alpha color formats supported by the Framebuffer Read IP.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
  • Loading branch information
vishals-xlnx authored and Michal Simek committed Apr 25, 2018
1 parent 91f7522 commit 16c2f51
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions drivers/dma/xilinx/xilinx_frmbuf.c
Expand Up @@ -392,6 +392,36 @@ static const struct xilinx_frmbuf_format_desc xilinx_frmbuf_formats[] = {
.v4l2_fmt = V4L2_PIX_FMT_BGR24,
.fmt_bitmask = BIT(18),
},
{
.dts_name = "abgr8888",
.id = XILINX_FRMBUF_FMT_RGBA8,
.bpw = 32,
.ppw = 1,
.num_planes = 1,
.drm_fmt = DRM_FORMAT_ABGR8888,
.v4l2_fmt = 0,
.fmt_bitmask = BIT(19),
},
{
.dts_name = "argb8888",
.id = XILINX_FRMBUF_FMT_BGRA8,
.bpw = 32,
.ppw = 1,
.num_planes = 1,
.drm_fmt = DRM_FORMAT_ARGB8888,
.v4l2_fmt = 0,
.fmt_bitmask = BIT(20),
},
{
.dts_name = "avuy8888",
.id = XILINX_FRMBUF_FMT_YUVA8,
.bpw = 32,
.ppw = 1,
.num_planes = 1,
.drm_fmt = DRM_FORMAT_AVUY,
.v4l2_fmt = 0,
.fmt_bitmask = BIT(21),
},
};

/**
Expand Down Expand Up @@ -535,6 +565,17 @@ static int frmbuf_verify_format(struct dma_chan *chan, u32 fourcc, u32 type)
xil_chan->xdev->enabled_vid_fmts))
return -EINVAL;

/*
* The Alpha color formats are supported in Framebuffer Read
* IP only as corresponding DRM formats.
*/
if (type == XDMA_DRM &&
(xilinx_frmbuf_formats[i].drm_fmt == DRM_FORMAT_ABGR8888 ||
xilinx_frmbuf_formats[i].drm_fmt == DRM_FORMAT_ARGB8888 ||
xilinx_frmbuf_formats[i].drm_fmt == DRM_FORMAT_AVUY) &&
xil_chan->direction != DMA_MEM_TO_DEV)
return -EINVAL;

xil_chan->vid_fmt = &xilinx_frmbuf_formats[i];
return 0;
}
Expand Down

0 comments on commit 16c2f51

Please sign in to comment.