Commit 91da74e81cfdd2774b39a7574edf93de3f2a3f25

Authored by Guoniu.Zhou
1 parent 4eeefd54cd

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 <guoniu.zhou@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>

Showing 2 changed files with 15 additions and 4 deletions Side-by-side Diff

drivers/dma/pxp/pxp_dma_v3.c
... ... @@ -198,6 +198,7 @@
198 198 static dma_addr_t paddr;
199 199 static bool v3p_flag;
200 200 static int alpha_blending_version;
  201 +static bool pxp_legacy;
201 202  
202 203 struct pxp_dma {
203 204 struct dma_device dma;
... ... @@ -3618,10 +3619,15 @@
3618 3619 pixmap->paddr = param->paddr;
3619 3620 pixmap->bpp = get_bpp_from_fmt(pixmap->format);
3620 3621  
3621   - if (!param->stride || (param->stride == param->width))
3622   - pixmap->pitch = param->width * pixmap->bpp >> 3;
3623   - else
3624   - pixmap->pitch = param->stride;
  3622 + if (pxp_legacy) {
  3623 + pixmap->pitch = (param->stride) ? (param->stride * pixmap->bpp >> 3) :
  3624 + (param->width * pixmap->bpp >> 3);
  3625 + } else {
  3626 + if (!param->stride || (param->stride == param->width))
  3627 + pixmap->pitch = param->width * pixmap->bpp >> 3;
  3628 + else
  3629 + pixmap->pitch = param->stride;
  3630 + }
3625 3631  
3626 3632 pixmap->crop.x = param->crop.left;
3627 3633 pixmap->crop.y = param->crop.top;
... ... @@ -3674,6 +3680,8 @@
3674 3680 alpha_blending_version = PXP_ALPHA_BLENDING_V2;
3675 3681 else
3676 3682 alpha_blending_version = PXP_ALPHA_BLENDING_NONE;
  3683 +
  3684 + pxp_legacy = (proc_data->pxp_legacy) ? true : false;
3677 3685  
3678 3686 /* Save PxP configuration */
3679 3687 list_for_each_entry(child, &desc->tx_list, list) {
include/uapi/linux/pxp_dma.h
... ... @@ -127,6 +127,8 @@
127 127 #define ALPHA_MODE_LEGACY 0x2
128 128 #define ALPHA_MODE_PORTER_DUFF 0x3
129 129  
  130 +#define PXP_DEVICE_LEGACY
  131 +
130 132 /* Order significant! */
131 133 enum pxp_channel_status {
132 134 PXP_CHANNEL_FREE,
... ... @@ -313,6 +315,7 @@
313 315 bool reagl_en; /* enable reagl/-d */
314 316 bool reagl_d_en; /* enable reagl or reagl-d */
315 317 bool detection_only;
  318 + bool pxp_legacy;
316 319 int lut;
317 320 bool lut_cleanup;
318 321 unsigned int lut_status_1;