From 91da74e81cfdd2774b39a7574edf93de3f2a3f25 Mon Sep 17 00:00:00 2001 From: "Guoniu.Zhou" Date: Wed, 6 Sep 2017 14:23:13 +0800 Subject: MLK-16374-3: PxP: improve stride parameter setting compatible In pxp lib, the unit of stride parameter is pixel and stride is not equal with width parameter of out buffer in some cases. In order to use latest pxp lib in old version rootfs, PXP_DEVICE_LEGACY macro is used to distinguish pxp drvier version. Because the new pxp driver define a new variable and pxp lib can know this through PXP_DEVICE_LEGACY, and determine if use it. Signed-off-by: Guoniu.Zhou Reviewed-by: Fancy Fang --- drivers/dma/pxp/pxp_dma_v3.c | 16 ++++++++++++---- include/uapi/linux/pxp_dma.h | 3 +++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/dma/pxp/pxp_dma_v3.c b/drivers/dma/pxp/pxp_dma_v3.c index b4886d0c2ace..4787071bab6b 100644 --- a/drivers/dma/pxp/pxp_dma_v3.c +++ b/drivers/dma/pxp/pxp_dma_v3.c @@ -198,6 +198,7 @@ static struct pxp_collision_info col_info; static dma_addr_t paddr; static bool v3p_flag; static int alpha_blending_version; +static bool pxp_legacy; struct pxp_dma { struct dma_device dma; @@ -3618,10 +3619,15 @@ static int convert_param_to_pixmap(struct pxp_pixmap *pixmap, pixmap->paddr = param->paddr; pixmap->bpp = get_bpp_from_fmt(pixmap->format); - if (!param->stride || (param->stride == param->width)) - pixmap->pitch = param->width * pixmap->bpp >> 3; - else - pixmap->pitch = param->stride; + if (pxp_legacy) { + pixmap->pitch = (param->stride) ? (param->stride * pixmap->bpp >> 3) : + (param->width * pixmap->bpp >> 3); + } else { + if (!param->stride || (param->stride == param->width)) + pixmap->pitch = param->width * pixmap->bpp >> 3; + else + pixmap->pitch = param->stride; + } pixmap->crop.x = param->crop.left; pixmap->crop.y = param->crop.top; @@ -3675,6 +3681,8 @@ static void __pxpdma_dostart(struct pxp_channel *pxp_chan) else alpha_blending_version = PXP_ALPHA_BLENDING_NONE; + pxp_legacy = (proc_data->pxp_legacy) ? true : false; + /* Save PxP configuration */ list_for_each_entry(child, &desc->tx_list, list) { if (i == 0) { /* Output */ diff --git a/include/uapi/linux/pxp_dma.h b/include/uapi/linux/pxp_dma.h index 4b0b4f041719..76983abb4344 100644 --- a/include/uapi/linux/pxp_dma.h +++ b/include/uapi/linux/pxp_dma.h @@ -127,6 +127,8 @@ typedef unsigned char bool; #define ALPHA_MODE_LEGACY 0x2 #define ALPHA_MODE_PORTER_DUFF 0x3 +#define PXP_DEVICE_LEGACY + /* Order significant! */ enum pxp_channel_status { PXP_CHANNEL_FREE, @@ -313,6 +315,7 @@ struct pxp_proc_data { bool reagl_en; /* enable reagl/-d */ bool reagl_d_en; /* enable reagl or reagl-d */ bool detection_only; + bool pxp_legacy; int lut; bool lut_cleanup; unsigned int lut_status_1; -- cgit v1.2.3