diff mbox series

[v1,1/2] drm/komeda: Update HW up-sampling on D71

Message ID 1557987170-24032-2-git-send-email-lowry.li@arm.com (mailing list archive)
State New, archived
Headers show
Series drm/komeda: Enable color-encoding (YUV format) support | expand

Commit Message

Lowry Li (Arm Technology China) May 16, 2019, 6:13 a.m. UTC
Updates HW up-sampling method according to the format type.

Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com>
---
 .../gpu/drm/arm/display/komeda/d71/d71_component.c | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

James Qian Wang May 20, 2019, 5:49 a.m. UTC | #1
On Thu, May 16, 2019 at 02:13:09PM +0800, Lowry Li (Arm Technology China) wrote:
> Updates HW up-sampling method according to the format type.
> 
> Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com>
> ---
>  .../gpu/drm/arm/display/komeda/d71/d71_component.c | 29 ++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
> index f8846c6..dfc70f5 100644
> --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
> +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
> @@ -212,6 +212,35 @@ static void d71_layer_update(struct komeda_component *c,
>  		malidp_write32(reg, BLK_P1_PTR_HIGH, upper_32_bits(addr));
>  	}
>  
> +	if (fb->format->is_yuv) {
> +		u32 upsampling = 0;
> +
> +		switch (kfb->format_caps->fourcc) {
> +		case DRM_FORMAT_YUYV:
> +			upsampling = fb->modifier ? LR_CHI422_BILINEAR :
> +				     LR_CHI422_REPLICATION;
> +			break;
> +		case DRM_FORMAT_UYVY:
> +			upsampling = LR_CHI422_REPLICATION;
> +			break;
> +		case DRM_FORMAT_NV12:
> +		case DRM_FORMAT_YUV420_8BIT:
> +		case DRM_FORMAT_YUV420_10BIT:
> +		case DRM_FORMAT_YUV420:
> +		case DRM_FORMAT_P010:
> +		/* these fmt support MPGE/JPEG both, here perfer JPEG*/
> +			upsampling = LR_CHI420_JPEG;
> +			break;
> +		case DRM_FORMAT_X0L2:
> +			upsampling = LR_CHI420_JPEG;
> +			break;
> +		default:
> +			break;
> +		}
> +
> +		malidp_write32(reg, LAYER_R_CONTROL, upsampling);
> +	}
> +
>  	malidp_write32(reg, LAYER_FMT, kfb->format_caps->hw_id);
>  	malidp_write32(reg, BLK_IN_SIZE, HV_SIZE(st->hsize, st->vsize));
>  
> -- 
> 1.9.1
> 
 
Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>

Looks good to me.

Thank you
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
index f8846c6..dfc70f5 100644
--- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
+++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
@@ -212,6 +212,35 @@  static void d71_layer_update(struct komeda_component *c,
 		malidp_write32(reg, BLK_P1_PTR_HIGH, upper_32_bits(addr));
 	}
 
+	if (fb->format->is_yuv) {
+		u32 upsampling = 0;
+
+		switch (kfb->format_caps->fourcc) {
+		case DRM_FORMAT_YUYV:
+			upsampling = fb->modifier ? LR_CHI422_BILINEAR :
+				     LR_CHI422_REPLICATION;
+			break;
+		case DRM_FORMAT_UYVY:
+			upsampling = LR_CHI422_REPLICATION;
+			break;
+		case DRM_FORMAT_NV12:
+		case DRM_FORMAT_YUV420_8BIT:
+		case DRM_FORMAT_YUV420_10BIT:
+		case DRM_FORMAT_YUV420:
+		case DRM_FORMAT_P010:
+		/* these fmt support MPGE/JPEG both, here perfer JPEG*/
+			upsampling = LR_CHI420_JPEG;
+			break;
+		case DRM_FORMAT_X0L2:
+			upsampling = LR_CHI420_JPEG;
+			break;
+		default:
+			break;
+		}
+
+		malidp_write32(reg, LAYER_R_CONTROL, upsampling);
+	}
+
 	malidp_write32(reg, LAYER_FMT, kfb->format_caps->hw_id);
 	malidp_write32(reg, BLK_IN_SIZE, HV_SIZE(st->hsize, st->vsize));