diff options
Diffstat (limited to 'wiki/2017-09-periperi')
3 files changed, 314 insertions, 0 deletions
diff --git a/wiki/2017-09-periperi/0001-v4l-vsp1-Add-support-for-colorkey-alpha-blending.patch b/wiki/2017-09-periperi/0001-v4l-vsp1-Add-support-for-colorkey-alpha-blending.patch new file mode 100644 index 0000000..d95c662 --- /dev/null +++ b/wiki/2017-09-periperi/0001-v4l-vsp1-Add-support-for-colorkey-alpha-blending.patch @@ -0,0 +1,86 @@ +From 41b782c5d67bfaf7d61e27e7fcb7cedf1f1eea0b Mon Sep 17 00:00:00 2001 +From: Alexandru Gheorghe <Alexandru_Gheorghe@mentor.com> +Date: Wed, 15 Feb 2017 14:27:21 +0200 +Subject: [PATCH 1/2] v4l: vsp1: Add support for colorkey alpha blending + +The vsp2 hw supports changing of the alpha of pixels that match a color +key, this patch adds support for this feature in order to be used by +the rcar-du driver. +The colorkey is interpreted different depending of the pixel format: + * RGB - all color components have to match. + * YCbCr - only the Y component has to match. + +Signed-off-by: Alexandru Gheorghe <Alexandru_Gheorghe@mentor.com> +--- + drivers/media/platform/vsp1/vsp1_drm.c | 3 +++ + drivers/media/platform/vsp1/vsp1_rpf.c | 10 ++++++++-- + drivers/media/platform/vsp1/vsp1_rwpf.h | 3 +++ + include/media/vsp1.h | 3 +++ + 4 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c +index 3627f08..a4d0aee 100644 +--- a/drivers/media/platform/vsp1/vsp1_drm.c ++++ b/drivers/media/platform/vsp1/vsp1_drm.c +@@ -393,6 +393,9 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, + else + rpf->format.plane_fmt[1].bytesperline = cfg->pitch; + rpf->alpha = cfg->alpha; ++ rpf->colorkey = cfg->colorkey; ++ rpf->colorkey_en = cfg->colorkey_en; ++ rpf->colorkey_alpha = cfg->colorkey_alpha; + rpf->interlaced = cfg->interlaced; + + if (soc_device_match(r8a7795es1) && rpf->interlaced) { +diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c +index a12d6f9..91f2a9f 100644 +--- a/drivers/media/platform/vsp1/vsp1_rpf.c ++++ b/drivers/media/platform/vsp1/vsp1_rpf.c +@@ -356,8 +356,14 @@ static void rpf_configure(struct vsp1_entity *entity, + } + + vsp1_rpf_write(rpf, dl, VI6_RPF_MSK_CTRL, 0); +- vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, 0); +- ++ if (rpf->colorkey_en) { ++ vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_SET0, ++ (rpf->colorkey_alpha << 24) | rpf->colorkey); ++ vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, ++ VI6_RPF_CKEY_CTRL_SAPE0); ++ } else { ++ vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, 0); ++ } + } + + static const struct vsp1_entity_operations rpf_entity_ops = { +diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h +index fbe6aa6..2d7f4b9 100644 +--- a/drivers/media/platform/vsp1/vsp1_rwpf.h ++++ b/drivers/media/platform/vsp1/vsp1_rwpf.h +@@ -51,6 +51,9 @@ struct vsp1_rwpf { + unsigned int brs_input; + + unsigned int alpha; ++ u32 colorkey; ++ bool colorkey_en; ++ u32 colorkey_alpha; + + u32 mult_alpha; + u32 outfmt; +diff --git a/include/media/vsp1.h b/include/media/vsp1.h +index 97265f7..65e3934 100644 +--- a/include/media/vsp1.h ++++ b/include/media/vsp1.h +@@ -32,6 +32,9 @@ struct vsp1_du_atomic_config { + struct v4l2_rect dst; + unsigned int alpha; + unsigned int zpos; ++ u32 colorkey; ++ u32 colorkey_alpha; ++ bool colorkey_en; + bool interlaced; + }; + +-- +1.9.1 + diff --git a/wiki/2017-09-periperi/0002-drm-rcar-du-Add-support-for-colorkey-alpha-blending.patch b/wiki/2017-09-periperi/0002-drm-rcar-du-Add-support-for-colorkey-alpha-blending.patch new file mode 100644 index 0000000..bda2fd1 --- /dev/null +++ b/wiki/2017-09-periperi/0002-drm-rcar-du-Add-support-for-colorkey-alpha-blending.patch @@ -0,0 +1,176 @@ +From 9baeb4544b5f03c118c89156555d956b250f6174 Mon Sep 17 00:00:00 2001 +From: Alexandru Gheorghe <Alexandru_Gheorghe@mentor.com> +Date: Wed, 15 Feb 2017 14:50:28 +0200 +Subject: [PATCH 2/2] drm: rcar-du: Add support for colorkey alpha blending + +Add two new plane properties colorkey and colorkey_alpha for rcar gen3. +* colorkey: + - used for specifying the color on which the filtering is done. + - bits 0 to 23 are interpreted as RGB888 format, in case we are + dealing with an YCbCr format, only the Y componenet is + compared and it is represented by the G bits from RGB888 + format. + - bit 24 tells if it is enabled or not. +* colorkey_alpha: + - the alpha to be set for matching pixels, in case it is + missing the pixels will be made transparent + +Signed-off-by: Alexandru Gheorghe <Alexandru_Gheorghe@mentor.com> +--- + drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 + + drivers/gpu/drm/rcar-du/rcar_du_kms.c | 8 ++++++++ + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 3 --- + drivers/gpu/drm/rcar-du/rcar_du_plane.h | 6 ++++++ + drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 22 ++++++++++++++++++++++ + drivers/gpu/drm/rcar-du/rcar_du_vsp.h | 5 +++++ + 6 files changed, 42 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h +index 91e8fc5..1cb92e3 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h ++++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h +@@ -98,6 +98,7 @@ struct rcar_du_device { + struct { + struct drm_property *alpha; + struct drm_property *colorkey; ++ struct drm_property *colorkey_alpha; + } props; + + unsigned int dpad0_source; +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c +index 1cc88ed..a733fa2 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c +@@ -630,6 +630,14 @@ static int rcar_du_properties_init(struct rcar_du_device *rcdu) + if (rcdu->props.colorkey == NULL) + return -ENOMEM; + ++ if (rcdu->info->gen == 3) { ++ rcdu->props.colorkey_alpha = ++ drm_property_create_range(rcdu->ddev, 0, ++ "colorkey_alpha", 0, 255); ++ if (!rcdu->props.colorkey_alpha) ++ return -ENOMEM; ++ } ++ + return 0; + } + +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +index e408aa3..df689c4 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +@@ -307,9 +307,6 @@ int rcar_du_atomic_check_planes(struct drm_device *dev, + * Plane Setup + */ + +-#define RCAR_DU_COLORKEY_NONE (0 << 24) +-#define RCAR_DU_COLORKEY_SOURCE (1 << 24) +-#define RCAR_DU_COLORKEY_MASK (1 << 24) + + static void rcar_du_plane_write(struct rcar_du_group *rgrp, + unsigned int index, u32 reg, u32 data) +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h +index c1de338..9e7c3b6 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h ++++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h +@@ -49,6 +49,12 @@ static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane) + return container_of(plane, struct rcar_du_plane, plane); + } + ++#define RCAR_DU_COLORKEY_NONE (0 << 24) ++#define RCAR_DU_COLORKEY_MASK BIT(24) ++#define RCAR_DU_COLORKEY_EN_MASK RCAR_DU_COLORKEY_MASK ++#define RCAR_DU_COLORKEY_COLOR_MASK 0xFFFFFF ++#define RCAR_DU_COLORKEY_ALPHA_MASK 0xFF ++ + /** + * struct rcar_du_plane_state - Driver-specific plane state + * @state: base DRM plane state +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +index 4b460d4..b223be1 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +@@ -180,6 +180,11 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) + .pitch = fb->pitches[0], + .alpha = state->alpha, + .zpos = state->state.zpos, ++ .colorkey = state->colorkey & RCAR_DU_COLORKEY_COLOR_MASK, ++ .colorkey_en = ++ ((state->colorkey & RCAR_DU_COLORKEY_EN_MASK) != 0), ++ .colorkey_alpha = ++ (state->colorkey_alpha & RCAR_DU_COLORKEY_ALPHA_MASK), + }; + unsigned int i; + +@@ -379,6 +384,8 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane) + return; + + state->alpha = 255; ++ state->colorkey = RCAR_DU_COLORKEY_NONE; ++ state->colorkey_alpha = 0; + state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1; + + plane->state = &state->state; +@@ -394,6 +401,10 @@ static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane, + + if (property == rcdu->props.alpha) + rstate->alpha = val; ++ else if (property == rcdu->props.colorkey) ++ rstate->colorkey = val; ++ else if (property == rcdu->props.colorkey_alpha) ++ rstate->colorkey_alpha = val; + else + return -EINVAL; + +@@ -410,6 +421,10 @@ static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane, + + if (property == rcdu->props.alpha) + *val = rstate->alpha; ++ else if (property == rcdu->props.colorkey) ++ *val = rstate->colorkey; ++ else if (property == rcdu->props.colorkey_alpha) ++ *val = rstate->colorkey_alpha; + else + return -EINVAL; + +@@ -633,6 +648,13 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp) + + drm_object_attach_property(&plane->plane.base, + rcdu->props.alpha, 255); ++ drm_object_attach_property(&plane->plane.base, ++ rcdu->props.colorkey, ++ RCAR_DU_COLORKEY_NONE); ++ if (rcdu->props.colorkey_alpha) ++ drm_object_attach_property(&plane->plane.base, ++ rcdu->props.colorkey_alpha, ++ 0); + drm_plane_create_zpos_property(&plane->plane, 1, 1, + vsp->num_planes - 1); + } +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h +index 3fd9cef..1543503 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h ++++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h +@@ -47,6 +47,9 @@ static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p) + * @sg_tables: scatter-gather tables for the frame buffer memory + * @alpha: value of the plane alpha property + * @zpos: value of the plane zpos property ++ * @colorkey: value of the color for which to apply colorkey_alpha, bit 24 ++ * tells if it is enabled or not ++ * @colorkey_alpha: alpha to be used for pixels with color equal to colorkey + */ + struct rcar_du_vsp_plane_state { + struct drm_plane_state state; +@@ -56,6 +59,8 @@ struct rcar_du_vsp_plane_state { + + unsigned int alpha; + unsigned int zpos; ++ u32 colorkey; ++ u32 colorkey_alpha; + }; + + static inline struct rcar_du_vsp_plane_state * +-- +1.9.1 + diff --git a/wiki/2017-09-periperi/todo-for-R-Car-D3.txt b/wiki/2017-09-periperi/todo-for-R-Car-D3.txt new file mode 100644 index 0000000..6ba4f82 --- /dev/null +++ b/wiki/2017-09-periperi/todo-for-R-Car-D3.txt @@ -0,0 +1,52 @@ +# core +r8a77995,v4.14,merged,geert,add binging SoC/Draak +CLK,v4.14,merged,geert,CLK support +SYSC,v4.14,merged,geert,SYSC support +PFC,v4.14,merged,shimoda, Initial/SCIF/I2C/EthernetAVB/USB2H/MMC/VoltageSwith +GPIO,v4.15,plan,shimoda, add D3 binding +SYS-DMAC,v4.15,plan,?, add D3 binding +IPMMU,v4.16,plan,?, add D3 binding + +# integration +r8a77995,v4.14,merged,geert, Initial integration (CPU/SYSC/CLK/RWDT/SCIF2) +r8a77995,v4.14,merged,shimoda, integration for PFC +r8a77995,v4.15,plan,shimoda, integration for GPIO +r8a77995,v4.15,plan,shimoda, integration for EthernetAVB +r8a77995,v4.15,plan,shimoda, integration for USBPHY/USB2-Host +r8a77995,v4.15,plan,?, integration for eMMC +r8a77995,v4.15,plan,?, integration for I2C/IIC +r8a77995,v4.15,plan,?, integration for {SYS,Audio}-DMAC +r8a77995,v4.16,plan,?, integration for IPMMUs +r8a77995,v4.16,plan,?, integration for RSND +r8a77995,v4.16,plan,?, integration for DU +r8a77995,v4.16,plan,?, integration for VIN + +# Multimedia +DU,v4.15,plan,?, add D3 binding +DU,?,plan,?, add LVDS support for D3 +VIN,?,plan,?, add D3 binding +RSND,?,plan,?, add D3 binding + +# I/O +SCIF,v4.14,merged,geert, add D3 binding +watchdog,v4.14,merged,geert, add D3 binding +EtherAVB,v4.15,plan,shimoda, add D3 binding +I2C,v4.15,plan,?, add D3 binding +IIC,v4.15,plan,?, add D3 binding + +USBPHY,v4.15,plan,shimoda, change spec of irq = otg +USBPHY,v4.15,plan,shimoda, separate spec (D3/E3 don't have some bits/regs on UCOM regs) +USBPHY,v4.15,plan,shimoda, add D3 binding +USBPHY,v4.15,plan,shimoda, add gpio support for D3/E3 +USBPHY,v4.15,plan,shimoda, add debugfs support for forced b-device mode +HSUSB,v4.15,plan,shimoda, add D3 binding + +SDHI,v4.15,plan,?, add D3 binding +SDHI,v4.16,plan,?, improve performance using IPMMU (change max_segs and removes WARN_ON) + +MSIOF,?,plan,?, add D3 binding +Thermal,?,plan,?, add D3 binding? or, need to prepare it before? + +PWM,?,plan,?, add D3 binding +CAN,?,noplan,?, add D3 binding + |