drm/mali-dp: Add support for memory writeback engine
Subsystems (3)
Liviu Dudau
maintainerv7 cover drm/mali-dp: Add support for memory writeback engine
Hi,
Updating the Mali DP memory writeback engine support series to match the latest generic writeback connector support posted here [1]. As the generic patches look ready to be merged into drm-misc-next, I'm sending the updated Mali DP driver as well.
Changelog:
- v7: Added support for DP500 writeback. It behaves differently from the rest of the IP portfolio, but because customers are asking for it to be supported in mainline, we're adding it here.
- v6: skipped, in order to align with latest generic series numbers.
- v5: https://lists.freedesktop.org/archives/dri-devel/2017-May/141799.html
Best regards,
Liviu
[1] https://lists.freedesktop.org/archives/dri-devel/2018-May/177125.html
Brian Starkey (2):
drm: mali-dp: Add RGB writeback formats for DP550/DP650
drm: mali-dp: Add writeback connector
Liviu Dudau (3):
drm: mali-dp: Add support for writeback on DP550/DP650 drm/mali-dp: Add writeback support for DP500. drm/mali-dp: Add RGB writeback formats for DP500.
drivers/gpu/drm/arm/Makefile | 1 + drivers/gpu/drm/arm/malidp_crtc.c | 9 ++ drivers/gpu/drm/arm/malidp_drv.c | 19 ++- drivers/gpu/drm/arm/malidp_drv.h | 3 + drivers/gpu/drm/arm/malidp_hw.c | 165 ++++++++++++++++--- drivers/gpu/drm/arm/malidp_hw.h | 21 +++ drivers/gpu/drm/arm/malidp_mw.c | 253 ++++++++++++++++++++++++++++++ drivers/gpu/drm/arm/malidp_mw.h | 18 +++ drivers/gpu/drm/arm/malidp_regs.h | 18 ++- drivers/gpu/drm/drm_atomic.c | 4 + 10 files changed, 484 insertions(+), 27 deletions(-) create mode 100644 drivers/gpu/drm/arm/malidp_mw.c create mode 100644 drivers/gpu/drm/arm/malidp_mw.h
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Liviu Dudau
maintainerPATCH v7 1/5 drm: mali-dp: Add support for writeback on DP550/DP650
Mali-DP display processors are able to write the composition result to a memory buffer via the SE.
Add entry points in the HAL for enabling/disabling this feature, and implement support for it on DP650 and DP550. DP500 acts differently and so is omitted from this change.
Changes since v3:
- Fix missing vsync interrupt for DP550
--- drivers/gpu/drm/arm/malidp_hw.c | 54 +++++++++++++++++++++++++++++-- drivers/gpu/drm/arm/malidp_hw.h | 17 ++++++++++ drivers/gpu/drm/arm/malidp_regs.h | 15 +++++++++ 3 files changed, 84 insertions(+), 2 deletions(-)
drivers/gpu/drm/arm/malidp_hw.c +52 -2
@@ -588,6 +588,48 @@ static long malidp550_se_calc_mclk(struct malidp_hw_device *hwdev,return ret; } +static int malidp550_enable_memwrite (struct malidp_hw_device *hwdev, +dma_addr_t *addrs,s32 *pitches, +int num_planes,u16 w,u16 h,u32 fmt_id) +{ +u32 base =MALIDP550_SE_MEMWRITE_BASE ; +u32 de_base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); + +/* enable the scaling engine block */ +malidp_hw_setbits (hwdev,MALIDP_SCALE_ENGINE_EN , de_base +MALIDP_DE_DISPLAY_FUNC ); + +malidp_hw_write (hwdev, fmt_id, base +MALIDP_MW_FORMAT ); +switch (num_planes) { +case 2 : +malidp_hw_write (hwdev,lower_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[1 ], base +MALIDP_MW_P2_STRIDE ); +/* fall through */ +case 1 : +malidp_hw_write (hwdev,lower_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[0 ], base +MALIDP_MW_P1_STRIDE ); +break ; +default : +WARN (1 ,"Invalid number of planes" ); + } + +malidp_hw_write (hwdev,MALIDP_DE_H_ACTIVE (w) |MALIDP_DE_V_ACTIVE (h), +MALIDP550_SE_MEMWRITE_OUT_SIZE ); +malidp_hw_setbits (hwdev,MALIDP550_SE_MEMWRITE_ONESHOT |MALIDP_SE_MEMWRITE_EN , +MALIDP550_SE_CONTROL ); + +return 0 ; +} + +static void malidp550_disable_memwrite (struct malidp_hw_device *hwdev) +{ +u32 base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); +malidp_hw_clearbits (hwdev,MALIDP550_SE_MEMWRITE_ONESHOT |MALIDP_SE_MEMWRITE_EN , +MALIDP550_SE_CONTROL ); +malidp_hw_clearbits (hwdev,MALIDP_SCALE_ENGINE_EN , base +MALIDP_DE_DISPLAY_FUNC ); +} +static int malidp650_query_hw (struct malidp_hw_device *hwdev) {u32 conf =malidp_hw_read (hwdev,MALIDP550_CONFIG_ID );
@@ -673,9 +715,11 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .se_irq_map = { .irq_mask =MALIDP550_SE_IRQ_EOW | MALIDP550_SE_IRQ_AXI_ERR, + .vsync_irq = MALIDP550_SE_IRQ_EOW, }, .dc_irq_map = { - .irq_mask = MALIDP550_DC_IRQ_CONF_VALID, + .irq_mask =MALIDP550_DC_IRQ_CONF_VALID | + MALIDP550_DC_IRQ_SE, .vsync_irq = MALIDP550_DC_IRQ_CONF_VALID, }, .pixel_formats = malidp550_de_formats,
@@ -691,6 +735,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .rotmem_required = malidp550_rotmem_required, .se_set_scaling_coeffs = malidp550_se_set_scaling_coeffs, .se_calc_mclk = malidp550_se_calc_mclk, + .enable_memwrite = malidp550_enable_memwrite, + .disable_memwrite = malidp550_disable_memwrite, .features = 0, }, [MALIDP_650] = {
@@ -711,9 +757,11 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .se_irq_map = { .irq_mask =MALIDP550_SE_IRQ_EOW | MALIDP550_SE_IRQ_AXI_ERR, + .vsync_irq = MALIDP550_SE_IRQ_EOW, }, .dc_irq_map = { - .irq_mask = MALIDP550_DC_IRQ_CONF_VALID, + .irq_mask =MALIDP550_DC_IRQ_CONF_VALID | + MALIDP550_DC_IRQ_SE, .vsync_irq = MALIDP550_DC_IRQ_CONF_VALID, }, .pixel_formats = malidp550_de_formats,
@@ -729,6 +777,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .rotmem_required = malidp550_rotmem_required, .se_set_scaling_coeffs = malidp550_se_set_scaling_coeffs, .se_calc_mclk = malidp550_se_calc_mclk, + .enable_memwrite = malidp550_enable_memwrite, + .disable_memwrite = malidp550_disable_memwrite, .features = 0, }, };
drivers/gpu/drm/arm/malidp_hw.h +17 -0
@@ -177,6 +177,23 @@ struct malidp_hw {long (*se_calc_mclk)(struct malidp_hw_device *hwdev,struct malidp_se_config *se_config,struct videomode *vm); +/** +* Enable writing to memory the content of the next frame +* @param hwdev - malidp_hw_device structure containing the HW description +* @param addrs - array of addresses for each plane +* @param pitches - array of pitches for each plane +* @param num_planes - number of planes to be written +* @param w - width of the output frame +* @param h - height of the output frame +* @param fmt_id - internal format ID of output buffer +*/ +int (*enable_memwrite)(struct malidp_hw_device *hwdev,dma_addr_t *addrs, +s32 *pitches,int num_planes,u16 w,u16 h,u32 fmt_id); + +/* +* Disable the writing to memory of the next frame's content. +*/ +void (*disable_memwrite)(struct malidp_hw_device *hwdev);u8 features; };
drivers/gpu/drm/arm/malidp_regs.h +15 -0
@@ -66,6 +66,8 @@#define MALIDP_DISP_FUNC_GAMMA (1 << 0)#define MALIDP_DISP_FUNC_CADJ (1 << 4)#define MALIDP_DISP_FUNC_ILACED (1 << 8) +#define MALIDP_SCALE_ENGINE_EN (1 << 16) +#define MALIDP_SE_MEMWRITE_EN (2 << 5)/* register offsets for IRQ management */ #define MALIDP_REG_STATUS 0x00000
@@ -153,6 +155,16 @@ (((x) & MALIDP_SE_ENH_LIMIT_MASK) << 16)#define MALIDP_SE_ENH_COEFF0 0x04 + +/* register offsets relative to MALIDP5x0_SE_MEMWRITE_BASE */ +#define MALIDP_MW_FORMAT 0x00000 +#define MALIDP_MW_P1_STRIDE 0x00004 +#define MALIDP_MW_P2_STRIDE 0x00008 +#define MALIDP_MW_P1_PTR_LOW 0x0000c +#define MALIDP_MW_P1_PTR_HIGH 0x00010 +#define MALIDP_MW_P2_PTR_LOW 0x0002c +#define MALIDP_MW_P2_PTR_HIGH 0x00030 +/* register offsets and bits specific to DP500 */ #define MALIDP500_ADDR_SPACE_SIZE 0x01000#define MALIDP500_DC_BASE 0x00000
@@ -217,6 +229,9 @@#define MALIDP550_DE_PERF_BASE 0x00500#define MALIDP550_SE_BASE 0x08000#define MALIDP550_SE_CONTROL 0x08010 +#define MALIDP550_SE_MEMWRITE_ONESHOT (1 << 7) +#define MALIDP550_SE_MEMWRITE_OUT_SIZE 0x08030 +#define MALIDP550_SE_MEMWRITE_BASE 0x08100#define MALIDP550_DC_BASE 0x0c000#define MALIDP550_DC_CONTROL 0x0c010#define MALIDP550_DC_CONFIG_REQ (1 << 16)
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Liviu Dudau
maintainerPATCH v7 2/5 drm: mali-dp: Add RGB writeback formats for DP550/DP650
In reply to Liviu DudauFrom: Brian Starkey <[email protected]>
Add a layer bit for the SE memory-write, and add it to the pixel format matrix for DP550/DP650.
--- drivers/gpu/drm/arm/malidp_hw.c | 22 +++++++++++----------- drivers/gpu/drm/arm/malidp_hw.h | 1 + 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/gpu/drm/arm/malidp_hw.c +11 -11
@@ -47,27 +47,27 @@ static const struct malidp_format_id malidp500_de_formats[] = {#define MALIDP_COMMON_FORMATS \/* fourcc, layers supporting the format, internal id */ \ - { DRM_FORMAT_ARGB2101010, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(0, 0) }, \ - { DRM_FORMAT_ABGR2101010, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(0, 1) }, \ - { DRM_FORMAT_RGBA1010102, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(0, 2) }, \ - { DRM_FORMAT_BGRA1010102, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(0, 3) }, \ + { DRM_FORMAT_ARGB2101010, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(0, 0) }, \ + { DRM_FORMAT_ABGR2101010, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(0, 1) }, \ + { DRM_FORMAT_RGBA1010102, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(0, 2) }, \ + { DRM_FORMAT_BGRA1010102, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(0, 3) }, \ { DRM_FORMAT_ARGB8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(1, 0) }, \ { DRM_FORMAT_ABGR8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(1, 1) }, \ { DRM_FORMAT_RGBA8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(1, 2) }, \ { DRM_FORMAT_BGRA8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(1, 3) }, \ - { DRM_FORMAT_XRGB8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(2, 0) }, \ - { DRM_FORMAT_XBGR8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(2, 1) }, \ - { DRM_FORMAT_RGBX8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(2, 2) }, \ - { DRM_FORMAT_BGRX8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART, MALIDP_ID(2, 3) }, \ - { DRM_FORMAT_RGB888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(3, 0) }, \ - { DRM_FORMAT_BGR888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(3, 1) }, \ + { DRM_FORMAT_XRGB8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART | SE_MEMWRITE, MALIDP_ID(2, 0) }, \ + { DRM_FORMAT_XBGR8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART | SE_MEMWRITE, MALIDP_ID(2, 1) }, \ + { DRM_FORMAT_RGBX8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART | SE_MEMWRITE, MALIDP_ID(2, 2) }, \ + { DRM_FORMAT_BGRX8888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | DE_SMART | SE_MEMWRITE, MALIDP_ID(2, 3) }, \ + { DRM_FORMAT_RGB888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(3, 0) }, \ + { DRM_FORMAT_BGR888, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(3, 1) }, \ { DRM_FORMAT_RGBA5551, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(4, 0) }, \ { DRM_FORMAT_ABGR1555, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(4, 1) }, \ { DRM_FORMAT_RGB565, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(4, 2) }, \ { DRM_FORMAT_BGR565, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(4, 3) }, \ { DRM_FORMAT_YUYV, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 2) }, \ { DRM_FORMAT_UYVY, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 3) }, \ - { DRM_FORMAT_NV12, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 6) }, \ + { DRM_FORMAT_NV12, DE_VIDEO1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(5, 6) }, \ { DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) }static const struct malidp_format_id malidp550_de_formats[] = {
drivers/gpu/drm/arm/malidp_hw.h +1 -0
@@ -33,6 +33,7 @@ enum {DE_GRAPHICS2 =BIT (2 ),/* used only in DP500 */ DE_VIDEO2 =BIT (3 ),DE_SMART =BIT (4 ), + SE_MEMWRITE = BIT(5), }; struct malidp_format_id {
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Liviu Dudau
maintainerPATCH v7 3/5 drm/mali-dp: Add writeback support for DP500.
In reply to Liviu DudauMali DP500 behaves differently from the rest of the Mali DP IP, in that it does not have a one-shot mode and keeps writing the content of the current frame to the provided memory area until stopped. As a way of emulating the one-shot behaviour, we are going to use the CVAL interrupt that is being raised at the start of each frame, during prefetch phase, to act as End-of-Write signal, but with a twist: we are going to disable the memory write engine right after we're notified that it has been enabled, using the knowledge that the bit controlling the enabling will only be acted upon on the next vblank/prefetch.
CVAL interrupt will fire durint the next prefetch phase every time the global CVAL bit gets set, so we need a state byte to track the memory write enabling.
--- drivers/gpu/drm/arm/malidp_hw.c | 77 +++++++++++++++++++++++++++++-- drivers/gpu/drm/arm/malidp_hw.h | 5 +- drivers/gpu/drm/arm/malidp_regs.h | 3 +- 3 files changed, 80 insertions(+), 5 deletions(-)
drivers/gpu/drm/arm/malidp_hw.c +74 -3
@@ -22,6 +22,13 @@#include "malidp_drv.h" #include "malidp_hw.h" +enum { +MW_NOT_ENABLED =0 ,/* SE writeback not enabled */ +MW_ONESHOT ,/* SE in one-shot mode for writeback */ +MW_START ,/* SE started writeback */ +MW_STOP ,/* SE finished writeback */ +}; +static const struct malidp_format_id malidp500_de_formats[] = {/* fourcc, layers supporting the format, internal id */ {DRM_FORMAT_ARGB2101010 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,0 },
@@ -368,6 +375,50 @@ static long malidp500_se_calc_mclk(struct malidp_hw_device *hwdev,return ret; } +static int malidp500_enable_memwrite (struct malidp_hw_device *hwdev, +dma_addr_t *addrs,s32 *pitches, +int num_planes,u16 w,u16 h,u32 fmt_id) +{ +u32 base =MALIDP500_SE_MEMWRITE_BASE ; +u32 de_base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); + +/* enable the scaling engine block */ +malidp_hw_setbits (hwdev,MALIDP_SCALE_ENGINE_EN , de_base +MALIDP_DE_DISPLAY_FUNC ); + + hwdev->mw_state =MW_START ; + +malidp_hw_write (hwdev, fmt_id, base +MALIDP_MW_FORMAT ); +switch (num_planes) { +case 2 : +malidp_hw_write (hwdev,lower_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[1 ], base +MALIDP_MW_P2_STRIDE ); +/* fall through */ +case 1 : +malidp_hw_write (hwdev,lower_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[0 ], base +MALIDP_MW_P1_STRIDE ); +break ; +default : +WARN (1 ,"Invalid number of planes" ); + } + +malidp_hw_write (hwdev,MALIDP_DE_H_ACTIVE (w) |MALIDP_DE_V_ACTIVE (h), +MALIDP500_SE_MEMWRITE_OUT_SIZE ); +malidp_hw_setbits (hwdev,MALIDP_SE_MEMWRITE_EN ,MALIDP500_SE_CONTROL ); + +return 0 ; +} + +static void malidp500_disable_memwrite (struct malidp_hw_device *hwdev) +{ +u32 base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); +if (hwdev->mw_state ==MW_START ) + hwdev->mw_state =MW_STOP ; +malidp_hw_clearbits (hwdev,MALIDP_SE_MEMWRITE_EN ,MALIDP500_SE_CONTROL ); +malidp_hw_clearbits (hwdev,MALIDP_SCALE_ENGINE_EN , base +MALIDP_DE_DISPLAY_FUNC ); +} +static int malidp550_query_hw (struct malidp_hw_device *hwdev) {u32 conf =malidp_hw_read (hwdev,MALIDP550_CONFIG_ID );
@@ -598,6 +649,8 @@ static int malidp550_enable_memwrite(struct malidp_hw_device *hwdev,/* enable the scaling engine block */ malidp_hw_setbits (hwdev,MALIDP_SCALE_ENGINE_EN , de_base +MALIDP_DE_DISPLAY_FUNC ); + hwdev->mw_state =MW_ONESHOT ; +malidp_hw_write (hwdev, fmt_id, base +MALIDP_MW_FORMAT );switch (num_planes) {case 2 :
@@ -676,8 +729,9 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .vsync_irq = MALIDP500_DE_IRQ_VSYNC, }, .se_irq_map = { - .irq_mask = MALIDP500_SE_IRQ_CONF_MODE, - .vsync_irq = 0, + .irq_mask =MALIDP500_SE_IRQ_CONF_MODE | + MALIDP500_SE_IRQ_CONF_VALID, + .vsync_irq = MALIDP500_SE_IRQ_CONF_VALID, }, .dc_irq_map = { .irq_mask = MALIDP500_DE_IRQ_CONF_VALID,
@@ -696,6 +750,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .rotmem_required = malidp500_rotmem_required, .se_set_scaling_coeffs = malidp500_se_set_scaling_coeffs, .se_calc_mclk = malidp500_se_calc_mclk, + .enable_memwrite = malidp500_enable_memwrite, + .disable_memwrite = malidp500_disable_memwrite, .features = MALIDP_DEVICE_LV_HAS_3_STRIDES, }, [MALIDP_550] = {
@@ -934,7 +990,21 @@ static irqreturn_t malidp_se_irq(int irq, void *arg) mask =malidp_hw_read (hwdev, hw->map.se_base +MALIDP_REG_MASKIRQ ); status =malidp_hw_read (hwdev, hw->map.se_base +MALIDP_REG_STATUS ); status &= mask; -/* ToDo: status decoding and firing up of VSYNC and page flip events */ + +if (status & se->vsync_irq) { +switch (hwdev->mw_state) { +case MW_STOP : +case MW_ONESHOT : +/* disable writeback after stop or oneshot */ + hwdev->mw_state =MW_NOT_ENABLED ; +break ; +case MW_START : +/* writeback started, need to emulate one-shot mode */ + hw->disable_memwrite (hwdev); + hw->set_config_valid (hwdev); +break ; + } + }malidp_hw_clear_irq (hwdev,MALIDP_SE_BLOCK , status);
@@ -964,6 +1034,7 @@ int malidp_se_irq_init(struct drm_device *drm, int irq)return ret; } + hwdev->mw_state =MW_NOT_ENABLED ;malidp_hw_enable_irq (hwdev,MALIDP_SE_BLOCK , hwdev->hw->map.se_irq_map.irq_mask);
drivers/gpu/drm/arm/malidp_hw.h +4 -1
@@ -178,7 +178,7 @@ struct malidp_hw {long (*se_calc_mclk)(struct malidp_hw_device *hwdev,struct malidp_se_config *se_config,struct videomode *vm); -/** +/* * Enable writing to memory the content of the next frame * @param hwdev - malidp_hw_device structure containing the HW description * @param addrs - array of addresses for each plane
@@ -232,6 +232,9 @@ struct malidp_hw_device {/* track the device PM state */ bool pm_suspended; +/* track the SE memory writeback state */ +u8 mw_state; +/* size of memory used for rotating layers, up to two banks available */ u32 rotation_memory[2 ]; };
drivers/gpu/drm/arm/malidp_regs.h +2 -1
@@ -198,7 +198,8 @@#define MALIDP500_DE_LG2_PTR_BASE 0x0031c#define MALIDP500_SE_BASE 0x00c00#define MALIDP500_SE_CONTROL 0x00c0c -#define MALIDP500_SE_PTR_BASE 0x00e0c +#define MALIDP500_SE_MEMWRITE_OUT_SIZE 0x00c2c +#define MALIDP500_SE_MEMWRITE_BASE 0x00e00#define MALIDP500_DC_IRQ_BASE 0x00f00#define MALIDP500_CONFIG_VALID 0x00f00#define MALIDP500_CONFIG_ID 0x00fd4
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v7 3/5] drm/mali-dp: Add writeback support for DP500.
Hi Liviu,
Quoted 128 lines · Liviu Dudau
Mali DP500 behaves differently from the rest of the Mali DP IP, in that it does not have a one-shot mode and keeps writing the content of the current frame to the provided memory area until stopped. As a way of emulating the one-shot behaviour, we are going to use the CVAL interrupt that is being raised at the start of each frame, during prefetch phase, to act as End-of-Write signal, but with a twist: we are going to disable the memory write engine right after we're notified that it has been enabled, using the knowledge that the bit controlling the enabling will only be acted upon on the next vblank/prefetch.
CVAL interrupt will fire durint the next prefetch phase every time the global CVAL bit gets set, so we need a state byte to track the memory write enabling.
Signed-off-by Liviu Dudau <[email protected]>---
drivers/gpu/drm/arm/malidp_hw.c | 77 +++++++++++++++++++++++++++++-- drivers/gpu/drm/arm/malidp_hw.h | 5 +- drivers/gpu/drm/arm/malidp_regs.h | 3 +- 3 files changed, 80 insertions(+), 5 deletions(-)drivers/gpu/drm/arm/malidp_hw.c +60
-3@@ -22,6 +22,13 @@#include "malidp_drv.h" #include "malidp_hw.h" +enum { +MW_NOT_ENABLED =0 ,/* SE writeback not enabled */ +MW_ONESHOT ,/* SE in one-shot mode for writeback */ +MW_START ,/* SE started writeback */ +MW_STOP ,/* SE finished writeback */ +}; +static const struct malidp_format_id malidp500_de_formats[] = {/* fourcc, layers supporting the format, internal id */ {DRM_FORMAT_ARGB2101010 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,0 },@@ -368,6 +375,50 @@ static long malidp500_se_calc_mclk(struct malidp_hw_device *hwdev,return ret; } +static int malidp500_enable_memwrite (struct malidp_hw_device *hwdev, +dma_addr_t *addrs,s32 *pitches, +int num_planes,u16 w,u16 h,u32 fmt_id) +{ +u32 base =MALIDP500_SE_MEMWRITE_BASE ; +u32 de_base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); + +/* enable the scaling engine block */ +malidp_hw_setbits (hwdev,MALIDP_SCALE_ENGINE_EN , de_base +MALIDP_DE_DISPLAY_FUNC ); + + hwdev->mw_state =MW_START ; + +malidp_hw_write (hwdev, fmt_id, base +MALIDP_MW_FORMAT ); +switch (num_planes) { +case 2 : +malidp_hw_write (hwdev,lower_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[1 ], base +MALIDP_MW_P2_STRIDE ); +/* fall through */ +case 1 : +malidp_hw_write (hwdev,lower_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[0 ], base +MALIDP_MW_P1_STRIDE ); +break ; +default : +WARN (1 ,"Invalid number of planes" ); + } + +malidp_hw_write (hwdev,MALIDP_DE_H_ACTIVE (w) |MALIDP_DE_V_ACTIVE (h), +MALIDP500_SE_MEMWRITE_OUT_SIZE ); +malidp_hw_setbits (hwdev,MALIDP_SE_MEMWRITE_EN ,MALIDP500_SE_CONTROL ); + +return 0 ; +} + +static void malidp500_disable_memwrite (struct malidp_hw_device *hwdev) +{ +u32 base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); +if (hwdev->mw_state ==MW_START ) + hwdev->mw_state =MW_STOP ; +malidp_hw_clearbits (hwdev,MALIDP_SE_MEMWRITE_EN ,MALIDP500_SE_CONTROL ); +malidp_hw_clearbits (hwdev,MALIDP_SCALE_ENGINE_EN , base +MALIDP_DE_DISPLAY_FUNC ); +} +static int malidp550_query_hw (struct malidp_hw_device *hwdev) {u32 conf =malidp_hw_read (hwdev,MALIDP550_CONFIG_ID );@@ -598,6 +649,8 @@ static int malidp550_enable_memwrite(struct malidp_hw_device *hwdev,/* enable the scaling engine block */ malidp_hw_setbits (hwdev,MALIDP_SCALE_ENGINE_EN , de_base +MALIDP_DE_DISPLAY_FUNC ); + hwdev->mw_state =MW_ONESHOT ; +malidp_hw_write (hwdev, fmt_id, base +MALIDP_MW_FORMAT );switch (num_planes) {case 2 :@@ -676,8 +729,9 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .vsync_irq = MALIDP500_DE_IRQ_VSYNC, }, .se_irq_map = { - .irq_mask = MALIDP500_SE_IRQ_CONF_MODE, - .vsync_irq = 0, + .irq_mask =MALIDP500_SE_IRQ_CONF_MODE | + MALIDP500_SE_IRQ_CONF_VALID, + .vsync_irq = MALIDP500_SE_IRQ_CONF_VALID, }, .dc_irq_map = { .irq_mask = MALIDP500_DE_IRQ_CONF_VALID,@@ -696,6 +750,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .rotmem_required = malidp500_rotmem_required, .se_set_scaling_coeffs = malidp500_se_set_scaling_coeffs, .se_calc_mclk = malidp500_se_calc_mclk, + .enable_memwrite = malidp500_enable_memwrite, + .disable_memwrite = malidp500_disable_memwrite, .features = MALIDP_DEVICE_LV_HAS_3_STRIDES, }, [MALIDP_550] = {@@ -934,7 +990,21 @@ static irqreturn_t malidp_se_irq(int irq, void *arg) mask =malidp_hw_read (hwdev, hw->map.se_base +MALIDP_REG_MASKIRQ ); status =malidp_hw_read (hwdev, hw->map.se_base +MALIDP_REG_STATUS ); status &= mask; -/* ToDo: status decoding and firing up of VSYNC and page flip events */ + +if (status & se->vsync_irq) {
drivers/gpu/drm/arm/malidp_hw.c static irqreturn_t malidp_se_irq(int irq, void *arg) · line 1004
Quoted 10 lines
drivers/gpu/drm/arm/malidp_hw.c +10
-0+switch (hwdev->mw_state) { +case MW_STOP : +case MW_ONESHOT : +/* disable writeback after stop or oneshot */ + hwdev->mw_state =MW_NOT_ENABLED ; +break ; +case MW_START : +/* writeback started, need to emulate one-shot mode */ + hw->disable_memwrite (hwdev); + hw->set_config_valid (hwdev);
Is this serialised with incoming atomic commits? We have to make sure we don't set CVAL while a new scene configuration is in-progress.
I also think the current state tracking won't work properly for two subsequent frames using writeback. In enable_memwrite() you change the mw_state, but the currently ongoing job is relying on it to correctly signal. We probably need to either block incoming commits until the writeback is finished, or we need to enhance the state tracking to manage multiple commits.
Thanks,
-Brian
Quoted 54 lines
drivers/gpu/drm/arm/malidp_hw.c +4
-0+break ; + } + }malidp_hw_clear_irq (hwdev,MALIDP_SE_BLOCK , status);@@ -964,6 +1034,7 @@ int malidp_se_irq_init(struct drm_device *drm, int irq)return ret; } + hwdev->mw_state =MW_NOT_ENABLED ;malidp_hw_enable_irq (hwdev,MALIDP_SE_BLOCK , hwdev->hw->map.se_irq_map.irq_mask);drivers/gpu/drm/arm/malidp_hw.h +4
-1@@ -178,7 +178,7 @@ struct malidp_hw {long (*se_calc_mclk)(struct malidp_hw_device *hwdev,struct malidp_se_config *se_config,struct videomode *vm); -/** +/* * Enable writing to memory the content of the next frame * @param hwdev - malidp_hw_device structure containing the HW description * @param addrs - array of addresses for each plane @@ -232,6 +232,9 @@ struct malidp_hw_device {/* track the device PM state */ bool pm_suspended; +/* track the SE memory writeback state */ +u8 mw_state; +/* size of memory used for rotating layers, up to two banks available */ u32 rotation_memory[2 ]; };drivers/gpu/drm/arm/malidp_regs.h +2
-1@@ -198,7 +198,8 @@#define MALIDP500_DE_LG2_PTR_BASE 0x0031c#define MALIDP500_SE_BASE 0x00c00#define MALIDP500_SE_CONTROL 0x00c0c -#define MALIDP500_SE_PTR_BASE 0x00e0c +#define MALIDP500_SE_MEMWRITE_OUT_SIZE 0x00c2c +#define MALIDP500_SE_MEMWRITE_BASE 0x00e00#define MALIDP500_DC_IRQ_BASE 0x00f00#define MALIDP500_CONFIG_VALID 0x00f00#define MALIDP500_CONFIG_ID 0x00fd4Signature · 1 line
2.17.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Liviu Dudau
maintainerRe: [PATCH v7 3/5] drm/mali-dp: Add writeback support for DP500.
Quoted 136 lines · Brian Starkey
Hi Liviu,
Quoted 133 lines · Liviu Dudau
Mali DP500 behaves differently from the rest of the Mali DP IP, in that it does not have a one-shot mode and keeps writing the content of the current frame to the provided memory area until stopped. As a way of emulating the one-shot behaviour, we are going to use the CVAL interrupt that is being raised at the start of each frame, during prefetch phase, to act as End-of-Write signal, but with a twist: we are going to disable the memory write engine right after we're notified that it has been enabled, using the knowledge that the bit controlling the enabling will only be acted upon on the next vblank/prefetch.
CVAL interrupt will fire durint the next prefetch phase every time the global CVAL bit gets set, so we need a state byte to track the memory write enabling.
Signed-off-by Liviu Dudau <[email protected]>---
drivers/gpu/drm/arm/malidp_hw.c | 77 +++++++++++++++++++++++++++++-- drivers/gpu/drm/arm/malidp_hw.h | 5 +- drivers/gpu/drm/arm/malidp_regs.h | 3 +- 3 files changed, 80 insertions(+), 5 deletions(-)drivers/gpu/drm/arm/malidp_hw.c +65
-3@@ -22,6 +22,13 @@#include "malidp_drv.h" #include "malidp_hw.h" +enum { +MW_NOT_ENABLED =0 ,/* SE writeback not enabled */ +MW_ONESHOT ,/* SE in one-shot mode for writeback */ +MW_START ,/* SE started writeback */ +MW_STOP ,/* SE finished writeback */ +}; +static const struct malidp_format_id malidp500_de_formats[] = {/* fourcc, layers supporting the format, internal id */ {DRM_FORMAT_ARGB2101010 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,0 },@@ -368,6 +375,50 @@ static long malidp500_se_calc_mclk(struct malidp_hw_device *hwdev,return ret; } +static int malidp500_enable_memwrite (struct malidp_hw_device *hwdev, +dma_addr_t *addrs,s32 *pitches, +int num_planes,u16 w,u16 h,u32 fmt_id) +{ +u32 base =MALIDP500_SE_MEMWRITE_BASE ; +u32 de_base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); + +/* enable the scaling engine block */ +malidp_hw_setbits (hwdev,MALIDP_SCALE_ENGINE_EN , de_base +MALIDP_DE_DISPLAY_FUNC ); + + hwdev->mw_state =MW_START ; + +malidp_hw_write (hwdev, fmt_id, base +MALIDP_MW_FORMAT ); +switch (num_planes) { +case 2 : +malidp_hw_write (hwdev,lower_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[1 ]), base +MALIDP_MW_P2_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[1 ], base +MALIDP_MW_P2_STRIDE ); +/* fall through */ +case 1 : +malidp_hw_write (hwdev,lower_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_LOW ); +malidp_hw_write (hwdev,upper_32_bits (addrs[0 ]), base +MALIDP_MW_P1_PTR_HIGH ); +malidp_hw_write (hwdev, pitches[0 ], base +MALIDP_MW_P1_STRIDE ); +break ; +default : +WARN (1 ,"Invalid number of planes" ); + } + +malidp_hw_write (hwdev,MALIDP_DE_H_ACTIVE (w) |MALIDP_DE_V_ACTIVE (h), +MALIDP500_SE_MEMWRITE_OUT_SIZE ); +malidp_hw_setbits (hwdev,MALIDP_SE_MEMWRITE_EN ,MALIDP500_SE_CONTROL ); + +return 0 ; +} + +static void malidp500_disable_memwrite (struct malidp_hw_device *hwdev) +{ +u32 base =malidp_get_block_base (hwdev,MALIDP_DE_BLOCK ); +if (hwdev->mw_state ==MW_START ) + hwdev->mw_state =MW_STOP ; +malidp_hw_clearbits (hwdev,MALIDP_SE_MEMWRITE_EN ,MALIDP500_SE_CONTROL ); +malidp_hw_clearbits (hwdev,MALIDP_SCALE_ENGINE_EN , base +MALIDP_DE_DISPLAY_FUNC ); +} +static int malidp550_query_hw (struct malidp_hw_device *hwdev) {u32 conf =malidp_hw_read (hwdev,MALIDP550_CONFIG_ID );@@ -598,6 +649,8 @@ static int malidp550_enable_memwrite(struct malidp_hw_device *hwdev,/* enable the scaling engine block */ malidp_hw_setbits (hwdev,MALIDP_SCALE_ENGINE_EN , de_base +MALIDP_DE_DISPLAY_FUNC ); + hwdev->mw_state =MW_ONESHOT ; +malidp_hw_write (hwdev, fmt_id, base +MALIDP_MW_FORMAT );switch (num_planes) {case 2 :@@ -676,8 +729,9 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .vsync_irq = MALIDP500_DE_IRQ_VSYNC, }, .se_irq_map = { - .irq_mask = MALIDP500_SE_IRQ_CONF_MODE, - .vsync_irq = 0, + .irq_mask =MALIDP500_SE_IRQ_CONF_MODE | + MALIDP500_SE_IRQ_CONF_VALID, + .vsync_irq = MALIDP500_SE_IRQ_CONF_VALID, }, .dc_irq_map = { .irq_mask = MALIDP500_DE_IRQ_CONF_VALID,@@ -696,6 +750,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .rotmem_required = malidp500_rotmem_required, .se_set_scaling_coeffs = malidp500_se_set_scaling_coeffs, .se_calc_mclk = malidp500_se_calc_mclk, + .enable_memwrite = malidp500_enable_memwrite, + .disable_memwrite = malidp500_disable_memwrite, .features = MALIDP_DEVICE_LV_HAS_3_STRIDES, }, [MALIDP_550] = {@@ -934,7 +990,21 @@ static irqreturn_t malidp_se_irq(int irq, void *arg) mask =malidp_hw_read (hwdev, hw->map.se_base +MALIDP_REG_MASKIRQ ); status =malidp_hw_read (hwdev, hw->map.se_base +MALIDP_REG_STATUS ); status &= mask; -/* ToDo: status decoding and firing up of VSYNC and page flip events */ + +if (status & se->vsync_irq) { +switch (hwdev->mw_state) { +case MW_STOP : +case MW_ONESHOT : +/* disable writeback after stop or oneshot */ + hwdev->mw_state =MW_NOT_ENABLED ;
Quoted 8 lines
drivers/gpu/drm/arm/malidp_hw.c static irqreturn_t malidp_se_irq(int irq, void *arg) · line 1004
Quoted 5 lines
drivers/gpu/drm/arm/malidp_hw.c +5
-0+break ; +case MW_START : +/* writeback started, need to emulate one-shot mode */ + hw->disable_memwrite (hwdev); + hw->set_config_valid (hwdev);Is this serialised with incoming atomic commits? We have to make sure we don't set CVAL while a new scene configuration is in-progress.
We are not serialised with the incoming atomic commit, and we probably should. I'll have a think on how to sort this one out.
Quoted 7 lines
I also think the current state tracking won't work properly for two subsequent frames using writeback. In
enable_memwrite()you change themw_state, but the currently ongoing job is relying on it to correctly signal. We probably need to either block incoming commits until the writeback is finished, or we need to enhance the state tracking to manage multiple commits.
I will go back to the drawing boards and come up with something more solid.
Best regards,
Liviu
Quoted 58 lines
Thanks,
-BrianQuoted 54 lines
drivers/gpu/drm/arm/malidp_hw.c +4
-0+break ; + } + }malidp_hw_clear_irq (hwdev,MALIDP_SE_BLOCK , status);@@ -964,6 +1034,7 @@ int malidp_se_irq_init(struct drm_device *drm, int irq)return ret; } + hwdev->mw_state =MW_NOT_ENABLED ;malidp_hw_enable_irq (hwdev,MALIDP_SE_BLOCK , hwdev->hw->map.se_irq_map.irq_mask);drivers/gpu/drm/arm/malidp_hw.h +4
-1@@ -178,7 +178,7 @@ struct malidp_hw {long (*se_calc_mclk)(struct malidp_hw_device *hwdev,struct malidp_se_config *se_config,struct videomode *vm); -/** +/* * Enable writing to memory the content of the next frame * @param hwdev - malidp_hw_device structure containing the HW description * @param addrs - array of addresses for each plane @@ -232,6 +232,9 @@ struct malidp_hw_device {/* track the device PM state */ bool pm_suspended; +/* track the SE memory writeback state */ +u8 mw_state; +/* size of memory used for rotating layers, up to two banks available */ u32 rotation_memory[2 ]; };drivers/gpu/drm/arm/malidp_regs.h +2
-1@@ -198,7 +198,8 @@#define MALIDP500_DE_LG2_PTR_BASE 0x0031c#define MALIDP500_SE_BASE 0x00c00#define MALIDP500_SE_CONTROL 0x00c0c -#define MALIDP500_SE_PTR_BASE 0x00e0c +#define MALIDP500_SE_MEMWRITE_OUT_SIZE 0x00c2c +#define MALIDP500_SE_MEMWRITE_BASE 0x00e00#define MALIDP500_DC_IRQ_BASE 0x00f00#define MALIDP500_CONFIG_VALID 0x00f00#define MALIDP500_CONFIG_ID 0x00fd4Signature · 1 line
2.17.0
Signature · 12 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develLiviu Dudau
maintainerPATCH v7 4/5 drm/mali-dp: Add RGB writeback formats for DP500.
In reply to Liviu DudauAnnotate the pixel format matrix for DP500 with the memory-write flag for formats that are supported by the SE memwrite engine.
--- drivers/gpu/drm/arm/malidp_hw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/arm/malidp_hw.c +5 -5
@@ -31,12 +31,12 @@ enum {static const struct malidp_format_id malidp500_de_formats[] = {/* fourcc, layers supporting the format, internal id */ - {DRM_FORMAT_ARGB2101010 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,0 }, - {DRM_FORMAT_ABGR2101010 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,1 }, + {DRM_FORMAT_ARGB2101010 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 |SE_MEMWRITE ,0 }, + {DRM_FORMAT_ABGR2101010 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 |SE_MEMWRITE ,1 }, {DRM_FORMAT_ARGB8888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,2 }, {DRM_FORMAT_ABGR8888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,3 }, - {DRM_FORMAT_XRGB8888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,4 }, - {DRM_FORMAT_XBGR8888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,5 }, + {DRM_FORMAT_XRGB8888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 |SE_MEMWRITE ,4 }, + {DRM_FORMAT_XBGR8888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 |SE_MEMWRITE ,5 }, {DRM_FORMAT_RGB888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,6 }, {DRM_FORMAT_BGR888 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,7 }, {DRM_FORMAT_RGBA5551 ,DE_VIDEO1 |DE_GRAPHICS1 |DE_GRAPHICS2 ,8 },
@@ -45,7 +45,7 @@ static const struct malidp_format_id malidp500_de_formats[] = { { DRM_FORMAT_BGR565, DE_VIDEO1 | DE_GRAPHICS1 | DE_GRAPHICS2, 11 }, { DRM_FORMAT_UYVY, DE_VIDEO1, 12 }, { DRM_FORMAT_YUYV, DE_VIDEO1, 13 }, - { DRM_FORMAT_NV12, DE_VIDEO1, 14 }, + { DRM_FORMAT_NV12, DE_VIDEO1 | SE_MEMWRITE, 14 }, { DRM_FORMAT_YUV420, DE_VIDEO1, 15 }, };
Signature · 1 line
2.17.0
Liviu Dudau
maintainerPATCH v7 5/5 drm: mali-dp: Add writeback connector
In reply to Liviu DudauFrom: Brian Starkey <[email protected]>
Mali-DP has a memory writeback engine which can be used to write the composition result to a memory buffer. Expose this functionality as a DRM writeback connector on supported hardware.
Changes since v1:
Daniel Vetter:
- Don't require a modeset when writeback routing changes
- Make writeback connector always disconnected
Changes since v2:
- Rebase onto new drm_writeback_connector
- Add reset callback, allocating subclassed state Daniel Vetter:
- Squash out-fence support into this commit
Gustavo Padovan:
- Don't signal fence directly from driver (and drop malidp_mw_job)
Changes since v3:
- Modifications to fit with Mali-DP commit tail changes
--- drivers/gpu/drm/arm/Makefile | 1 + drivers/gpu/drm/arm/malidp_crtc.c | 9 ++ drivers/gpu/drm/arm/malidp_drv.c | 19 ++- drivers/gpu/drm/arm/malidp_drv.h | 3 + drivers/gpu/drm/arm/malidp_hw.c | 2 + drivers/gpu/drm/arm/malidp_mw.c | 253 ++++++++++++++++++++++++++++++ drivers/gpu/drm/arm/malidp_mw.h | 18 +++ drivers/gpu/drm/drm_atomic.c | 4 + 8 files changed, 304 insertions(+), 5 deletions(-) create mode 100644 drivers/gpu/drm/arm/malidp_mw.c create mode 100644 drivers/gpu/drm/arm/malidp_mw.h
drivers/gpu/drm/arm/Makefile +1 -0
@@ -1,4 +1,5 @@ hdlcd-y := hdlcd_drv.o hdlcd_crtc.o obj-$(CONFIG_DRM_HDLCD) += hdlcd.o mali-dp-y := malidp_drv.o malidp_hw.o malidp_planes.o malidp_crtc.o +mali-dp-y += malidp_mw.o obj-$(CONFIG_DRM_MALI_DISPLAY) += mali-dp.o
drivers/gpu/drm/arm/malidp_crtc.c +9 -0
@@ -411,6 +411,15 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc, } } +/* If only the writeback routing has changed, we don't need a modeset */ +if (state->connectors_changed) { +u32 old_mask = crtc->state->connector_mask; +u32 new_mask = state->connector_mask; +if ((old_mask ^ new_mask) == + (1 <<drm_connector_index (&malidp->mw_connector.base))) + state->connectors_changed = false; + } + ret =malidp_crtc_atomic_check_gamma (crtc, state); ret = ret ? ret :malidp_crtc_atomic_check_ctm (crtc, state); ret = ret ? ret :malidp_crtc_atomic_check_scaling (crtc, state);
drivers/gpu/drm/arm/malidp_drv.c +14 -5
@@ -31,6 +31,7 @@#include <drm/drm_of.h> #include "malidp_drv.h" +#include "malidp_mw.h" #include "malidp_regs.h" #include "malidp_hw.h"
@@ -230,7 +231,9 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)malidp_atomic_commit_se_config (crtc, old_crtc_state); } -drm_atomic_helper_commit_planes (drm, state,0 ); +drm_atomic_helper_commit_planes (drm, state,DRM_PLANE_COMMIT_ACTIVE_ONLY ); + +malidp_mw_atomic_commit (drm, state);drm_atomic_helper_commit_modeset_enables (drm, state);
@@ -268,12 +271,18 @@ static int malidp_init(struct drm_device *drm) drm->mode_config.helper_private = &malidp_mode_config_helpers; ret =malidp_crtc_init (drm); -if (ret) { -drm_mode_config_cleanup (drm); -return ret; - } +if (ret) + goto crtc_fail; + + ret =malidp_mw_connector_init (drm); +if (ret) + goto crtc_fail;return 0 ; + +crtc_fail: +drm_mode_config_cleanup (drm); +return ret; }static void malidp_fini (struct drm_device *drm)
drivers/gpu/drm/arm/malidp_drv.h +3 -0
@@ -13,6 +13,8 @@#ifndef __MALIDP_DRV_H__#define __MALIDP_DRV_H__ +#include <drm/drm_writeback.h> +#include <drm/drm_encoder.h> #include <linux/mutex.h> #include <linux/wait.h> #include <drm/drmP.h>
@@ -21,6 +23,7 @@struct malidp_drm {struct malidp_hw_device *dev;struct drm_crtc crtc; +struct drm_writeback_connector mw_connector;wait_queue_head_t wq;struct drm_pending_vblank_event *event;atomic_t config_valid;
drivers/gpu/drm/arm/malidp_hw.c +2 -0
@@ -21,6 +21,7 @@#include "malidp_drv.h" #include "malidp_hw.h" +#include "malidp_mw.h" enum {MW_NOT_ENABLED =0 ,/* SE writeback not enabled */
@@ -995,6 +996,7 @@ static irqreturn_t malidp_se_irq(int irq, void *arg)switch (hwdev->mw_state) {case MW_STOP :case MW_ONESHOT : +drm_writeback_signal_completion (&malidp->mw_connector,0 );/* disable writeback after stop or oneshot */ hwdev->mw_state =MW_NOT_ENABLED ;break ;
drivers/gpu/drm/arm/malidp_mw.c new file +253 -0
253 lines not on this page · raw message
drivers/gpu/drm/arm/malidp_mw.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* (C) COPYRIGHT 2016 ARM Limited. All rights reserved. +* Author: Brian Starkey <[email protected]> +* +* This program is free software and is provided to you under the terms of the +* GNU General Public License version 2 as published by the Free Software +* Foundation, and any use by you of this program is subject to the terms +* of such GNU licence. +* +*/ + +#ifndef __MALIDP_MW_H__ +#define __MALIDP_MW_H__ + +int malidp_mw_connector_init (struct drm_device *drm); +void malidp_mw_atomic_commit (struct drm_device *drm, +struct drm_atomic_state *old_state); +#endif
drivers/gpu/drm/drm_atomic.c +4 -0
@@ -1378,6 +1378,10 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,drm_printf (p,"connector[%u]: %s\n" , connector->base.id, connector->name);drm_printf (p,"\tcrtc=%s\n" , state->crtc ? state->crtc->name :"(null)" ); +if (connector->connector_type ==DRM_MODE_CONNECTOR_WRITEBACK ) +if (state->writeback_job && state->writeback_job->fb) +drm_printf (p,"\tfb=%d\n" , state->writeback_job->fb->base.id); +if (connector->funcs->atomic_print_state) connector->funcs->atomic_print_state (p, state); }
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel