update exynos drm driver.
Subsystems (3)
Inki Dae
maintainercover update exynos drm driver.
this patch sets are as the following:
- consolidate dpms framework.
- add runtime pm feature for fimd driver.
this patch is based on git repository below:git://people.freedesktop.org/~airlied/linux.git
branch name: drm-fixes
commit-id: 24bb5a0ce39c51a2e2602c947f218a19e4b26d7d
and you can pull git repository below:git://git.infradead.org/users/kmpark/linux-samsung exynos-drm-fixes
Inki Dae (1):
drm/exynos: updated crtc and encoder dpms framework.
Joonyoung Shim (1):
drm/exynos: add runtime pm feature for fimd
drivers/gpu/drm/exynos/exynos_drm_crtc.c | 58 ++++++++- drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 +- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 109 ++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 3 + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 189 ++++++++++++++++++++------- 5 files changed, 282 insertions(+), 83 deletions(-)
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 1/2 drm/exynos: updated crtc and encoder dpms framework.
With DPMS ON and OFF requests, crtc dpms would be in charge of just only device power such as fimd or hdmi and encoder dpms in charge of device setting(mode setting and register updating) and also lcd panel and digital TV power.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 58 ++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 +- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 109 ++++++++++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_encoder.h | 3 + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 113 +++++++++++++++------------ 5 files changed, 206 insertions(+), 83 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +52 -6
@@ -52,11 +52,13 @@* drm framework doesn't support multiple irq yet. * we can refer to the crtc to current hardware interrupt occured through * this pipe value. +* @dpms: store the crtc dpms value */ struct exynos_drm_crtc {struct drm_crtc drm_crtc;struct exynos_drm_overlay overlay;unsigned int pipe; +unsigned int dpms; };static void exynos_drm_crtc_apply (struct drm_crtc *crtc)
@@ -153,26 +155,37 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc)static void exynos_drm_crtc_dpms (struct drm_crtc *crtc,int mode) { +struct drm_device *dev = crtc->dev;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);DRM_DEBUG_KMS ("crtc[%d] mode[%d]\n" , crtc->base.id, mode); +if (exynos_crtc->dpms == mode) { +DRM_DEBUG_KMS ("desired dpms mode is same as previous one.\n" ); +return ; + } + +mutex_lock (&dev->struct_mutex); +switch (mode) {case DRM_MODE_DPMS_ON : -exynos_drm_fn_encoder (crtc, &exynos_crtc->pipe, - exynos_drm_encoder_crtc_commit); +exynos_drm_fn_encoder (crtc, &mode, + exynos_drm_encoder_crtc_dpms); + exynos_crtc->dpms = mode;break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF : -/* TODO */ -exynos_drm_fn_encoder (crtc,NULL , - exynos_drm_encoder_crtc_disable); +exynos_drm_fn_encoder (crtc, &mode, + exynos_drm_encoder_crtc_dpms); + exynos_crtc->dpms = mode;break ;default : -DRM_DEBUG_KMS ("unspecified mode %d\n" , mode); +DRM_ERROR ("unspecified mode %d\n" , mode);break ; } + +mutex_unlock (&dev->struct_mutex); }static void exynos_drm_crtc_prepare (struct drm_crtc *crtc)
@@ -188,6 +201,28 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)DRM_DEBUG_KMS ("%s\n" , __FILE__); +/* +* when set_crtc is requested from user or at booting time, +* crtc->commit would be called without dpms call so if dpms is +* no power on then crtc->dpms should be called +* with DRM_MODE_DPMS_ON for the hardware power to be on. +*/ +if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON ) { +int mode =DRM_MODE_DPMS_ON ; + +/* +* enable hardware(power on) to all encoders hdmi connected +* to current crtc. +*/ +exynos_drm_crtc_dpms (crtc, mode); +/* +* enable dma to all encoders connected to current crtc and +* lcd panel. +*/ +exynos_drm_fn_encoder (crtc, &mode, + exynos_drm_encoder_dpms_from_crtc); + } +exynos_drm_fn_encoder (crtc, &exynos_crtc->pipe, exynos_drm_encoder_crtc_commit); }
@@ -344,6 +379,7 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) } exynos_crtc->pipe = nr; + exynos_crtc->dpms =DRM_MODE_DPMS_OFF ; crtc = &exynos_crtc->drm_crtc; private->crtc[nr] = crtc;
@@ -357,9 +393,14 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int crtc) {struct exynos_drm_private *private = dev->dev_private; +struct exynos_drm_crtc *exynos_crtc = +to_exynos_crtc (private->crtc[crtc]);DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON ) +return -EPERM ; +exynos_drm_fn_encoder (private->crtc[crtc], &crtc, exynos_drm_enable_vblank);
@@ -369,9 +410,14 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc)void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int crtc) {struct exynos_drm_private *private = dev->dev_private; +struct exynos_drm_crtc *exynos_crtc = +to_exynos_crtc (private->crtc[crtc]);DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON ) +return ; +exynos_drm_fn_encoder (private->crtc[crtc], &crtc, exynos_drm_disable_vblank); }
drivers/gpu/drm/exynos/exynos_drm_drv.h +4 -2
@@ -144,17 +144,19 @@ struct exynos_drm_display_ops {/* * Exynos drm manager ops * +* @dpms: control device power. +* @apply: set timing, vblank and overlay data to registers. * @mode_set: convert drm_display_mode to hw specific display mode and * would be called by encoder->mode_set(). * @commit: set current hw specific display mode to hw. -* @disable: disable hardware specific display mode. * @enable_vblank: specific driver callback for enabling vblank interrupt. * @disable_vblank: specific driver callback for disabling vblank interrupt. */ struct exynos_drm_manager_ops { +void (*dpms)(struct device *subdrv_dev,int mode); +void (*apply)(struct device *subdrv_dev);void (*mode_set)(struct device *subdrv_dev,void *mode);void (*commit)(struct device *subdrv_dev); -void (*disable)(struct device *subdrv_dev);int (*enable_vblank)(struct device *subdrv_dev);void (*disable_vblank)(struct device *subdrv_dev); };
drivers/gpu/drm/exynos/exynos_drm_encoder.c +83 -26
165 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_encoder.h +3 -0
@@ -40,6 +40,9 @@ void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data,void exynos_drm_enable_vblank (struct drm_encoder *encoder,void *data);void exynos_drm_disable_vblank (struct drm_encoder *encoder,void *data);void exynos_drm_encoder_crtc_commit (struct drm_encoder *encoder,void *data); +void exynos_drm_encoder_dpms_from_crtc (struct drm_encoder *encoder, +void *data); +void exynos_drm_encoder_crtc_dpms (struct drm_encoder *encoder,void *data);void exynos_drm_encoder_crtc_mode_set (struct drm_encoder *encoder,void *data);void exynos_drm_encoder_crtc_disable (struct drm_encoder *encoder,void *data);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +64 -49
208 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 2/2 drm/exynos: add runtime pm feature for fimd
In reply to Inki DaeFrom: Joonyoung Shim <[email protected]>
This adds runtime PM feature for fimd. The runtime PM functions control clocks for fimd and prevent to access the register of fimd for vblank when clock is turned off by suspend of runtime PM.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 78 +++++++++++++++++++++++++++++- 1 files changed, 77 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +77 -1
@@ -17,6 +17,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/clk.h> +#include <linux/pm_runtime.h> #include <drm/exynos_drm.h> #include <plat/regs-fb-v4.h>
@@ -85,6 +86,7 @@ struct fimd_context {unsigned long irq_flags;u32 vidcon0;u32 vidcon1; +bool suspended;struct fb_videomode *timing; };
@@ -137,7 +139,19 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) {DRM_DEBUG_KMS ("%s, %d\n" , __FILE__, mode); -/* TODO */ +switch (mode) { +case DRM_MODE_DPMS_ON : +pm_runtime_get_sync (subdrv_dev); +break ; +case DRM_MODE_DPMS_STANDBY : +case DRM_MODE_DPMS_SUSPEND : +case DRM_MODE_DPMS_OFF : +pm_runtime_put_sync (subdrv_dev); +break ; +default : +DRM_DEBUG_KMS ("unspecified mode %d\n" , mode); +break ; + } }static void fimd_apply (struct device *subdrv_dev)
@@ -210,6 +224,9 @@ static int fimd_enable_vblank(struct device *dev)DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (ctx->suspended) +return -EPERM ; +if (!test_and_set_bit (0 , &ctx->irq_flags)) { val =readl (ctx->regs +VIDINTCON0 );
@@ -234,6 +251,9 @@ static void fimd_disable_vblank(struct device *dev)DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (ctx->suspended) +return ; +if (test_and_clear_bit (0 , &ctx->irq_flags)) { val =readl (ctx->regs +VIDINTCON0 );
@@ -760,6 +780,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) goto err_req_irq; } +pm_runtime_set_active (dev); +pm_runtime_enable (dev); +pm_runtime_get_sync (dev); +for (win =0 ; win <WINDOWS_NR ; win++)fimd_clear_win (ctx, win);
@@ -812,14 +836,25 @@ err_clk_get: static int __devexit fimd_remove(struct platform_device *pdev) { +struct device *dev = &pdev->dev;struct fimd_context *ctx =platform_get_drvdata (pdev);DRM_DEBUG_KMS ("%s\n" , __FILE__);exynos_drm_subdrv_unregister (&ctx->subdrv); +if (ctx->suspended) + goto out; +clk_disable (ctx->lcd_clk);clk_disable (ctx->bus_clk); + +pm_runtime_set_suspended (dev); +pm_runtime_put_sync (dev); + +out: +pm_runtime_disable (dev); +clk_put (ctx->lcd_clk);clk_put (ctx->bus_clk);
@@ -833,12 +868,53 @@ static int __devexit fimd_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_RUNTIME +static int fimd_runtime_suspend (struct device *dev) +{ +struct fimd_context *ctx =get_fimd_context (dev); + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +clk_disable (ctx->lcd_clk); +clk_disable (ctx->bus_clk); + + ctx->suspended = true; +return 0 ; +} + +static int fimd_runtime_resume (struct device *dev) +{ +struct fimd_context *ctx =get_fimd_context (dev); +int ret; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + + ret =clk_enable (ctx->bus_clk); +if (ret <0 ) +return ret; + + ret =clk_enable (ctx->lcd_clk); +if (ret <0 ) { +clk_disable (ctx->bus_clk); +return ret; + } + + ctx->suspended = false; +return 0 ; +} +#endif + +static const struct dev_pm_ops fimd_pm_ops = { +SET_RUNTIME_PM_OPS (fimd_runtime_suspend, fimd_runtime_resume,NULL ) +}; +static struct platform_driver fimd_driver = { .probe = fimd_probe, .remove =__devexit_p (fimd_remove), .driver = { .name ="exynos4-fb" , .owner =THIS_MODULE , + .pm = &fimd_pm_ops, }, };
Signature · 1 line
1.7.4.1
Inki Dae
maintainercover update new features.
In reply to Inki DaeHello, Dave.
I'm so sorry but ignor previous patch sets I just sent please. they include new feature so I made patch sets based on drm-next again. with this patch, exynos also would support multi planer feature. this feature has been tested and worked fine.
these patch sets are as the followings:
- consolidate crtc and encoder dpms framework.
- add runtime pm feature for fimd driver.
- add plane feature.
and they are based on git repository below:git://people.freedesktop.org/~airlied/linux.git
branch name: drm-next
commit-id: 4b35130208c55f0a1f24b5273cf2e8eeaba3ab06
and also you can pull git repository below:git://git.infradead.org/users/kmpark/linux-samsung exynos-drm-next
Inki Dae (1):
drm/exynos: updated crtc and encoder dpms framework.
Joonyoung Shim (4):
drm/exynos: Fix compile errors
drm/exynos: Use struct drm_mode_fb_cmd2
drm/exynos: add runtime pm feature for fimd
drm/exynos: Add plane support with fimd
drivers/gpu/drm/exynos/Makefile | 3 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 59 +++++++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 29 +++- drivers/gpu/drm/exynos/exynos_drm_drv.h | 14 ++- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 135 +++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 5 + drivers/gpu/drm/exynos/exynos_drm_fb.c | 20 +-- drivers/gpu/drm/exynos/exynos_drm_fb.h | 4 +- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 14 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 216 ++++++++++++++++++++------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 154 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_plane.h | 14 ++ include/drm/exynos_drm.h | 9 + 13 files changed, 553 insertions(+), 123 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_plane.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_plane.h
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 1/5 drm/exynos: Fix compile errors
From: Joonyoung Shim <[email protected]>
This compile errors occur by changes of e08e96de986ceb2c6b683df0bd0c4ddd4f91dcfd commit, so exynos drm should apply this changes.
CC drivers/gpu/drm/exynos/exynos_drm_drv.odrivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: braces around scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: warning: initialization from incompatible pointer type drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: (near initialization for 'exynos_drm_driver.fops') make[4]: *** [drivers/gpu/drm/exynos/exynos_drm_drv.o] Error 1
make[3]: *** [drivers/gpu/drm/exynos] Error 2
make[2]: *** [drivers/gpu/drm] Error 2
make[1]: *** [drivers/gpu] Error 2
make: *** [drivers] Error 2
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +11 -9
@@ -165,6 +165,16 @@ static struct drm_ioctl_desc exynos_ioctls[] = { exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH), }; +static const struct file_operations exynos_drm_driver_fops = { + .owner =THIS_MODULE , + .open = drm_open, + .mmap = exynos_drm_gem_mmap, + .poll = drm_poll, + .read = drm_read, + .unlocked_ioctl = drm_ioctl, + .release = drm_release, +}; +static struct drm_driver exynos_drm_driver = { .driver_features =DRIVER_HAVE_IRQ |DRIVER_BUS_PLATFORM |DRIVER_MODESET |DRIVER_GEM ,
@@ -182,15 +192,7 @@ static struct drm_driver exynos_drm_driver = { .dumb_map_offset = exynos_drm_gem_dumb_map_offset, .dumb_destroy = exynos_drm_gem_dumb_destroy, .ioctls = exynos_ioctls, - .fops = { - .owner = THIS_MODULE, - .open = drm_open, - .mmap = exynos_drm_gem_mmap, - .poll = drm_poll, - .read = drm_read, - .unlocked_ioctl = drm_ioctl, - .release = drm_release, - }, + .fops = &exynos_drm_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE,
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 2/5 drm/exynos: Use struct drm_mode_fb_cmd2
In reply to Inki DaeFrom: Joonyoung Shim <[email protected]>
The exynos drm also should use struct drm_mode_fb_cmd2 by changes of 308e5bcbdb10452e8aba31aa21432fb67ee46d72 commit(drm: add an fb creation ioctl that takes a pixel format v5).
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 20 +++++++++----------- drivers/gpu/drm/exynos/exynos_drm_fb.h | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 14 ++++++++------ 3 files changed, 19 insertions(+), 19 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fb.c +9 -11
@@ -104,7 +104,7 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = {static struct drm_framebuffer *exynos_drm_fb_init (struct drm_file *file_priv,struct drm_device *dev, -struct drm_mode_fb_cmd *mode_cmd) +struct drm_mode_fb_cmd2 *mode_cmd) {struct exynos_drm_fb *exynos_fb;struct drm_framebuffer *fb;
@@ -115,9 +115,6 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev,DRM_DEBUG_KMS ("%s\n" , __FILE__); - mode_cmd->pitch =max (mode_cmd->pitch, - mode_cmd->width * (mode_cmd->bpp >>3 )); -DRM_LOG_KMS ("drm fb create(%dx%d)\n" , mode_cmd->width, mode_cmd->height);
@@ -136,14 +133,14 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev,DRM_LOG_KMS ("create: fb id: %d\n" , fb->base.id); - size = mode_cmd->pitch * mode_cmd->height; + size = mode_cmd->pitches[0 ] * mode_cmd->height;/* -* mode_cmd->handle could be NULL at booting time or +* mode_cmd->handles[0] could be NULL at booting time or * with user request. if NULL, a new buffer or a gem object * would be allocated. */ -if (!mode_cmd->handle) { +if (!mode_cmd->handles[0 ]) {if (!file_priv) {struct exynos_drm_gem_buf *buffer;
@@ -166,7 +163,7 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, goto out; }else { exynos_gem_obj =exynos_drm_gem_create (dev, file_priv, - &mode_cmd->handle, + &mode_cmd->handles[0 ], size);if (IS_ERR (exynos_gem_obj)) { ret =PTR_ERR (exynos_gem_obj);
@@ -174,7 +171,8 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, } } }else { - obj =drm_gem_object_lookup (dev, file_priv, mode_cmd->handle); + obj =drm_gem_object_lookup (dev, file_priv, + mode_cmd->handles[0 ]);if (!obj) {DRM_ERROR ("failed to lookup gem object.\n" ); goto err_buffer;
@@ -214,8 +212,8 @@ err_init: }struct drm_framebuffer *exynos_drm_fb_create (struct drm_device *dev, -struct drm_file *file_priv, -struct drm_mode_fb_cmd *mode_cmd) +struct drm_file *file_priv, +struct drm_mode_fb_cmd2 *mode_cmd) {DRM_DEBUG_KMS ("%s\n" , __FILE__);
drivers/gpu/drm/exynos/exynos_drm_fb.h +2 -2
@@ -29,8 +29,8 @@#define _EXYNOS_DRM_FB_Hstruct drm_framebuffer *exynos_drm_fb_create (struct drm_device *dev, -struct drm_file *filp, -struct drm_mode_fb_cmd *mode_cmd); +struct drm_file *filp, +struct drm_mode_fb_cmd2 *mode_cmd);void exynos_drm_mode_config_init (struct drm_device *dev);
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +8 -6
@@ -126,7 +126,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,struct exynos_drm_fbdev *exynos_fbdev =to_exynos_fbdev (helper);struct drm_device *dev = helper->dev;struct fb_info *fbi; -struct drm_mode_fb_cmd mode_cmd = {0 }; +struct drm_mode_fb_cmd2 mode_cmd = {0 };struct platform_device *pdev = dev->platformdev;int ret;
@@ -138,8 +138,9 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, mode_cmd.width = sizes->surface_width; mode_cmd.height = sizes->surface_height; - mode_cmd.bpp = sizes->surface_bpp; - mode_cmd.depth = sizes->surface_depth; + mode_cmd.pitches[0 ] = sizes->surface_width * (sizes->surface_bpp >>3 ); + mode_cmd.pixel_format =drm_mode_legacy_fb_format (sizes->surface_bpp, + sizes->surface_depth);mutex_lock (&dev->struct_mutex);
@@ -206,7 +207,7 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper,struct drm_device *dev = helper->dev;struct exynos_drm_fbdev *exynos_fbdev =to_exynos_fbdev (helper);struct drm_framebuffer *fb = exynos_fbdev->fb; -struct drm_mode_fb_cmd mode_cmd = {0 }; +struct drm_mode_fb_cmd2 mode_cmd = {0 };DRM_DEBUG_KMS ("%s\n" , __FILE__);
@@ -220,8 +221,9 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper, mode_cmd.width = sizes->surface_width; mode_cmd.height = sizes->surface_height; - mode_cmd.bpp = sizes->surface_bpp; - mode_cmd.depth = sizes->surface_depth; + mode_cmd.pitches[0 ] = sizes->surface_width * (sizes->surface_bpp >>3 ); + mode_cmd.pixel_format =drm_mode_legacy_fb_format (sizes->surface_bpp, + sizes->surface_depth);if (fb->funcs->destroy) fb->funcs->destroy (fb);
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 3/5 drm/exynos: updated crtc and encoder dpms framework.
In reply to Inki DaeWith DPMS ON and OFF requests, crtc dpms would be in charge of just only device power such as fimd or hdmi and encoder dpms in charge of device setting(mode setting and register updating) and also lcd panel and digital TV power.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 58 ++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 +- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 109 ++++++++++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_encoder.h | 3 + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 113 +++++++++++++++------------ 5 files changed, 206 insertions(+), 83 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +52 -6
@@ -52,11 +52,13 @@* drm framework doesn't support multiple irq yet. * we can refer to the crtc to current hardware interrupt occured through * this pipe value. +* @dpms: store the crtc dpms value */ struct exynos_drm_crtc {struct drm_crtc drm_crtc;struct exynos_drm_overlay overlay;unsigned int pipe; +unsigned int dpms; };static void exynos_drm_crtc_apply (struct drm_crtc *crtc)
@@ -153,26 +155,37 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc)static void exynos_drm_crtc_dpms (struct drm_crtc *crtc,int mode) { +struct drm_device *dev = crtc->dev;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);DRM_DEBUG_KMS ("crtc[%d] mode[%d]\n" , crtc->base.id, mode); +if (exynos_crtc->dpms == mode) { +DRM_DEBUG_KMS ("desired dpms mode is same as previous one.\n" ); +return ; + } + +mutex_lock (&dev->struct_mutex); +switch (mode) {case DRM_MODE_DPMS_ON : -exynos_drm_fn_encoder (crtc, &exynos_crtc->pipe, - exynos_drm_encoder_crtc_commit); +exynos_drm_fn_encoder (crtc, &mode, + exynos_drm_encoder_crtc_dpms); + exynos_crtc->dpms = mode;break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF : -/* TODO */ -exynos_drm_fn_encoder (crtc,NULL , - exynos_drm_encoder_crtc_disable); +exynos_drm_fn_encoder (crtc, &mode, + exynos_drm_encoder_crtc_dpms); + exynos_crtc->dpms = mode;break ;default : -DRM_DEBUG_KMS ("unspecified mode %d\n" , mode); +DRM_ERROR ("unspecified mode %d\n" , mode);break ; } + +mutex_unlock (&dev->struct_mutex); }static void exynos_drm_crtc_prepare (struct drm_crtc *crtc)
@@ -188,6 +201,28 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)DRM_DEBUG_KMS ("%s\n" , __FILE__); +/* +* when set_crtc is requested from user or at booting time, +* crtc->commit would be called without dpms call so if dpms is +* no power on then crtc->dpms should be called +* with DRM_MODE_DPMS_ON for the hardware power to be on. +*/ +if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON ) { +int mode =DRM_MODE_DPMS_ON ; + +/* +* enable hardware(power on) to all encoders hdmi connected +* to current crtc. +*/ +exynos_drm_crtc_dpms (crtc, mode); +/* +* enable dma to all encoders connected to current crtc and +* lcd panel. +*/ +exynos_drm_fn_encoder (crtc, &mode, + exynos_drm_encoder_dpms_from_crtc); + } +exynos_drm_fn_encoder (crtc, &exynos_crtc->pipe, exynos_drm_encoder_crtc_commit); }
@@ -344,6 +379,7 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) } exynos_crtc->pipe = nr; + exynos_crtc->dpms =DRM_MODE_DPMS_OFF ; crtc = &exynos_crtc->drm_crtc; private->crtc[nr] = crtc;
@@ -357,9 +393,14 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int crtc) {struct exynos_drm_private *private = dev->dev_private; +struct exynos_drm_crtc *exynos_crtc = +to_exynos_crtc (private->crtc[crtc]);DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON ) +return -EPERM ; +exynos_drm_fn_encoder (private->crtc[crtc], &crtc, exynos_drm_enable_vblank);
@@ -369,9 +410,14 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc)void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int crtc) {struct exynos_drm_private *private = dev->dev_private; +struct exynos_drm_crtc *exynos_crtc = +to_exynos_crtc (private->crtc[crtc]);DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON ) +return ; +exynos_drm_fn_encoder (private->crtc[crtc], &crtc, exynos_drm_disable_vblank); }
drivers/gpu/drm/exynos/exynos_drm_drv.h +4 -2
@@ -144,17 +144,19 @@ struct exynos_drm_display_ops {/* * Exynos drm manager ops * +* @dpms: control device power. +* @apply: set timing, vblank and overlay data to registers. * @mode_set: convert drm_display_mode to hw specific display mode and * would be called by encoder->mode_set(). * @commit: set current hw specific display mode to hw. -* @disable: disable hardware specific display mode. * @enable_vblank: specific driver callback for enabling vblank interrupt. * @disable_vblank: specific driver callback for disabling vblank interrupt. */ struct exynos_drm_manager_ops { +void (*dpms)(struct device *subdrv_dev,int mode); +void (*apply)(struct device *subdrv_dev);void (*mode_set)(struct device *subdrv_dev,void *mode);void (*commit)(struct device *subdrv_dev); -void (*disable)(struct device *subdrv_dev);int (*enable_vblank)(struct device *subdrv_dev);void (*disable_vblank)(struct device *subdrv_dev); };
drivers/gpu/drm/exynos/exynos_drm_encoder.c +83 -26
165 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_encoder.h +3 -0
@@ -40,6 +40,9 @@ void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data,void exynos_drm_enable_vblank (struct drm_encoder *encoder,void *data);void exynos_drm_disable_vblank (struct drm_encoder *encoder,void *data);void exynos_drm_encoder_crtc_commit (struct drm_encoder *encoder,void *data); +void exynos_drm_encoder_dpms_from_crtc (struct drm_encoder *encoder, +void *data); +void exynos_drm_encoder_crtc_dpms (struct drm_encoder *encoder,void *data);void exynos_drm_encoder_crtc_mode_set (struct drm_encoder *encoder,void *data);void exynos_drm_encoder_crtc_disable (struct drm_encoder *encoder,void *data);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +64 -49
208 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 4/5 drm/exynos: add runtime pm feature for fimd
In reply to Inki DaeFrom: Joonyoung Shim <[email protected]>
This adds runtime PM feature for fimd. The runtime PM functions control clocks for fimd and prevent to access the register of fimd for vblank when clock is turned off by suspend of runtime PM.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 78 +++++++++++++++++++++++++++++- 1 files changed, 77 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +77 -1
@@ -17,6 +17,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/clk.h> +#include <linux/pm_runtime.h> #include <drm/exynos_drm.h> #include <plat/regs-fb-v4.h>
@@ -85,6 +86,7 @@ struct fimd_context {unsigned long irq_flags;u32 vidcon0;u32 vidcon1; +bool suspended;struct fb_videomode *timing; };
@@ -137,7 +139,19 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) {DRM_DEBUG_KMS ("%s, %d\n" , __FILE__, mode); -/* TODO */ +switch (mode) { +case DRM_MODE_DPMS_ON : +pm_runtime_get_sync (subdrv_dev); +break ; +case DRM_MODE_DPMS_STANDBY : +case DRM_MODE_DPMS_SUSPEND : +case DRM_MODE_DPMS_OFF : +pm_runtime_put_sync (subdrv_dev); +break ; +default : +DRM_DEBUG_KMS ("unspecified mode %d\n" , mode); +break ; + } }static void fimd_apply (struct device *subdrv_dev)
@@ -210,6 +224,9 @@ static int fimd_enable_vblank(struct device *dev)DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (ctx->suspended) +return -EPERM ; +if (!test_and_set_bit (0 , &ctx->irq_flags)) { val =readl (ctx->regs +VIDINTCON0 );
@@ -234,6 +251,9 @@ static void fimd_disable_vblank(struct device *dev)DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (ctx->suspended) +return ; +if (test_and_clear_bit (0 , &ctx->irq_flags)) { val =readl (ctx->regs +VIDINTCON0 );
@@ -760,6 +780,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) goto err_req_irq; } +pm_runtime_set_active (dev); +pm_runtime_enable (dev); +pm_runtime_get_sync (dev); +for (win =0 ; win <WINDOWS_NR ; win++)fimd_clear_win (ctx, win);
@@ -812,14 +836,25 @@ err_clk_get: static int __devexit fimd_remove(struct platform_device *pdev) { +struct device *dev = &pdev->dev;struct fimd_context *ctx =platform_get_drvdata (pdev);DRM_DEBUG_KMS ("%s\n" , __FILE__);exynos_drm_subdrv_unregister (&ctx->subdrv); +if (ctx->suspended) + goto out; +clk_disable (ctx->lcd_clk);clk_disable (ctx->bus_clk); + +pm_runtime_set_suspended (dev); +pm_runtime_put_sync (dev); + +out: +pm_runtime_disable (dev); +clk_put (ctx->lcd_clk);clk_put (ctx->bus_clk);
@@ -833,12 +868,53 @@ static int __devexit fimd_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_RUNTIME +static int fimd_runtime_suspend (struct device *dev) +{ +struct fimd_context *ctx =get_fimd_context (dev); + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +clk_disable (ctx->lcd_clk); +clk_disable (ctx->bus_clk); + + ctx->suspended = true; +return 0 ; +} + +static int fimd_runtime_resume (struct device *dev) +{ +struct fimd_context *ctx =get_fimd_context (dev); +int ret; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + + ret =clk_enable (ctx->bus_clk); +if (ret <0 ) +return ret; + + ret =clk_enable (ctx->lcd_clk); +if (ret <0 ) { +clk_disable (ctx->bus_clk); +return ret; + } + + ctx->suspended = false; +return 0 ; +} +#endif + +static const struct dev_pm_ops fimd_pm_ops = { +SET_RUNTIME_PM_OPS (fimd_runtime_suspend, fimd_runtime_resume,NULL ) +}; +static struct platform_driver fimd_driver = { .probe = fimd_probe, .remove =__devexit_p (fimd_remove), .driver = { .name ="exynos4-fb" , .owner =THIS_MODULE , + .pm = &fimd_pm_ops, }, };
Signature · 1 line
1.7.4.1
Inki Dae
maintainerPATCH 5/5 drm/exynos: Add plane support with fimd
In reply to Inki DaeFrom: Joonyoung Shim <[email protected]>
The exynos fimd supports 5 window overlays. Only one window overlay of fimd is used by the crtc, so we need plane feature to use the rest window overlays.
This creates one ioctl exynos specific - DRM_EXYNOS_PLANE_SET_ZPOS, it is the ioctl to decide for user to assign which window overlay.
--- drivers/gpu/drm/exynos/Makefile | 3 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 ++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 8 +- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 26 ++++- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 2 + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 33 +++++-- drivers/gpu/drm/exynos/exynos_drm_plane.c | 154 +++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_plane.h | 14 +++ include/drm/exynos_drm.h | 9 ++ 10 files changed, 244 insertions(+), 15 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_plane.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_plane.h
drivers/gpu/drm/exynos/Makefile +2 -1
@@ -5,7 +5,8 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o exynos_drm_connector.o \ exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \ - exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o + exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \ + exynos_drm_plane.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o obj-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o
drivers/gpu/drm/exynos/exynos_drm_crtc.c +1 -0
@@ -380,6 +380,7 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) exynos_crtc->pipe = nr; exynos_crtc->dpms =DRM_MODE_DPMS_OFF ; + exynos_crtc->overlay.zpos =DEFAULT_ZPOS ; crtc = &exynos_crtc->drm_crtc; private->crtc[nr] = crtc;
drivers/gpu/drm/exynos/exynos_drm_drv.c +9 -0
@@ -36,6 +36,7 @@#include "exynos_drm_fbdev.h" #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" +#include "exynos_drm_plane.h" #define DRIVER_NAME "exynos-drm"#define DRIVER_DESC "Samsung SoC DRM"
@@ -77,6 +78,12 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) goto err_crtc; } +for (nr =0 ; nr <MAX_PLANE ; nr++) { + ret =exynos_plane_init (dev, nr); +if (ret) + goto err_crtc; + } + ret =drm_vblank_init (dev,MAX_CRTC );if (ret) goto err_crtc;
@@ -163,6 +170,8 @@ static struct drm_ioctl_desc exynos_ioctls[] = { DRM_AUTH),DRM_IOCTL_DEF_DRV (EXYNOS_GEM_MMAP , exynos_drm_gem_mmap_ioctl,DRM_UNLOCKED |DRM_AUTH ), +DRM_IOCTL_DEF_DRV (EXYNOS_PLANE_SET_ZPOS , exynos_plane_set_zpos_ioctl, + DRM_UNLOCKED | DRM_AUTH), }; static const struct file_operations exynos_drm_driver_fops = {
drivers/gpu/drm/exynos/exynos_drm_drv.h +6 -2
@@ -33,6 +33,8 @@#include "drm.h" #define MAX_CRTC 2 +#define MAX_PLANE 5 +#define DEFAULT_ZPOS -1struct drm_device ;struct exynos_drm_overlay ;
@@ -57,8 +59,8 @@ enum exynos_drm_output_type {struct exynos_drm_overlay_ops {void (*mode_set)(struct device *subdrv_dev,struct exynos_drm_overlay *overlay); -void (*commit)(struct device *subdrv_dev); -void (*disable)(struct device *subdrv_dev); +void (*commit)(struct device *subdrv_dev,int zpos); +void (*disable)(struct device *subdrv_dev,int zpos); };/*
@@ -83,6 +85,7 @@ struct exynos_drm_overlay_ops {* @dma_addr: bus(accessed by dma) address to the memory region allocated * for a overlay. * @vaddr: virtual memory addresss to this overlay. +* @zpos: order of overlay layer(z position). * @default_win: a window to be enabled. * @color_key: color key on or off. * @index_color: if using color key feature then this value would be used
@@ -111,6 +114,7 @@ struct exynos_drm_overlay {unsigned int pitch;dma_addr_t dma_addr;void __iomem *vaddr; +int zpos;bool default_win;bool color_key;
drivers/gpu/drm/exynos/exynos_drm_encoder.c +22 -4
@@ -294,12 +294,27 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data) manager_ops->disable_vblank (manager->dev); } -void exynos_drm_encoder_crtc_commit (struct drm_encoder *encoder,void *data) +void exynos_drm_encoder_crtc_plane_commit (struct drm_encoder *encoder, +void *data) {struct exynos_drm_manager *manager =to_exynos_encoder (encoder)->manager;struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; +int zpos =DEFAULT_ZPOS ; + +if (data) + zpos = *(int *)data; + +if (overlay_ops && overlay_ops->commit) + overlay_ops->commit (manager->dev, zpos); +} + +void exynos_drm_encoder_crtc_commit (struct drm_encoder *encoder,void *data) +{ +struct exynos_drm_manager *manager = +to_exynos_encoder (encoder)->manager;int crtc = *(int *)data; +int zpos =DEFAULT_ZPOS ;DRM_DEBUG_KMS ("%s\n" , __FILE__);
@@ -309,8 +324,7 @@ void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data)*/ manager->pipe = crtc; -if (overlay_ops && overlay_ops->commit) - overlay_ops->commit (manager->dev); +exynos_drm_encoder_crtc_plane_commit (encoder, &zpos); }void exynos_drm_encoder_dpms_from_crtc (struct drm_encoder *encoder,void *data)
@@ -375,11 +389,15 @@ void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data)struct exynos_drm_manager *manager =to_exynos_encoder (encoder)->manager;struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; +int zpos =DEFAULT_ZPOS ;DRM_DEBUG_KMS ("\n" ); +if (data) + zpos = *(int *)data; +if (overlay_ops && overlay_ops->disable) - overlay_ops->disable (manager->dev); + overlay_ops->disable (manager->dev, zpos); }MODULE_AUTHOR ("Inki Dae <[email protected]>" );
drivers/gpu/drm/exynos/exynos_drm_encoder.h +2 -0
@@ -39,6 +39,8 @@ void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data, void (*fn)(struct drm_encoder *, void *));void exynos_drm_enable_vblank (struct drm_encoder *encoder,void *data);void exynos_drm_disable_vblank (struct drm_encoder *encoder,void *data); +void exynos_drm_encoder_crtc_plane_commit (struct drm_encoder *encoder, +void *data);void exynos_drm_encoder_crtc_commit (struct drm_encoder *encoder,void *data);void exynos_drm_encoder_dpms_from_crtc (struct drm_encoder *encoder,void *data);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +25 -8
@@ -161,12 +161,15 @@ static void fimd_apply(struct device *subdrv_dev)struct exynos_drm_manager_ops *mgr_ops = mgr->ops;struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;struct fimd_win_data *win_data; +int i;DRM_DEBUG_KMS ("%s\n" , __FILE__); - win_data = &ctx->win_data[ctx->default_win]; -if (win_data->enabled && (ovl_ops && ovl_ops->commit)) - ovl_ops->commit (subdrv_dev); +for (i =0 ; i <WINDOWS_NR ; i++) { + win_data = &ctx->win_data[i]; +if (win_data->enabled && (ovl_ops && ovl_ops->commit)) + ovl_ops->commit (subdrv_dev, i); + }if (mgr_ops && mgr_ops->commit) mgr_ops->commit (subdrv_dev);
@@ -277,6 +280,7 @@ static void fimd_win_mode_set(struct device *dev, {struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data; +int win;unsigned long offset;DRM_DEBUG_KMS ("%s\n" , __FILE__);
@@ -286,12 +290,19 @@ static void fimd_win_mode_set(struct device *dev,return ; } + win = overlay->zpos; +if (win ==DEFAULT_ZPOS ) + win = ctx->default_win; + +if (win <0 || win >WINDOWS_NR ) +return ; + offset = overlay->fb_x * (overlay->bpp >>3 ); offset += overlay->fb_y * overlay->pitch;DRM_DEBUG_KMS ("offset = 0x%lx, pitch = %x\n" , offset, overlay->pitch); - win_data = &ctx->win_data[ctx->default_win]; + win_data = &ctx->win_data[win]; win_data->offset_x = overlay->crtc_x; win_data->offset_y = overlay->crtc_y;
@@ -394,15 +405,18 @@ static void fimd_win_set_colkey(struct device *dev, unsigned int win)writel (keycon1, ctx->regs +WKEYCON1_BASE (win)); } -static void fimd_win_commit (struct device *dev) +static void fimd_win_commit (struct device *dev,int zpos) {struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data; -int win = ctx->default_win; +int win = zpos;unsigned long val, alpha, size;DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (win ==DEFAULT_ZPOS ) + win = ctx->default_win; +if (win <0 || win >WINDOWS_NR )return ;
@@ -499,15 +513,18 @@ static void fimd_win_commit(struct device *dev) win_data->enabled = true; } -static void fimd_win_disable (struct device *dev) +static void fimd_win_disable (struct device *dev,int zpos) {struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data; -int win = ctx->default_win; +int win = zpos;u32 val;DRM_DEBUG_KMS ("%s\n" , __FILE__); +if (win ==DEFAULT_ZPOS ) + win = ctx->default_win; +if (win <0 || win >WINDOWS_NR )return ;
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +154 -0
154 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_plane.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* Copyright (C) 2011 Samsung Electronics Co.Ltd +* Authors: Joonyoung Shim <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ + +int exynos_plane_init (struct drm_device *dev,unsigned int nr); +int exynos_plane_set_zpos_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv);
include/drm/exynos_drm.h +9 -0
@@ -74,9 +74,16 @@ struct drm_exynos_gem_mmap {uint64_t mapped; }; +struct drm_exynos_plane_set_zpos { +__u32 plane_id; +__s32 zpos; +}; +#define DRM_EXYNOS_GEM_CREATE 0x00#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01#define DRM_EXYNOS_GEM_MMAP 0x02 +/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ +#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
@@ -87,6 +94,8 @@ struct drm_exynos_gem_mmap {#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) +#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ + DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)/** * Platform Specific Structure for DRM based FIMD. *
Signature · 1 line
1.7.4.1
Re: [PATCH 5/5] drm/exynos: Add plane support with fimd
Quoted 9 lines · Inki Dae
From: Joonyoung Shim <[email protected]>
The exynos fimd supports 5 window overlays. Only one window overlay of fimd is used by the crtc, so we need plane feature to use the rest window overlays.
This creates one ioctl exynos specific -
DRM_EXYNOS_PLANE_SET_ZPOS, it is the ioctl to decide for user to assign which window overlay.
btw, I think I will end up with a similar ioctl.. so thought I'd double check for consistency, is zorder interpreted from back to front or front to back? Ie. higher numeric value in front or behind of lower numeric value? Are negative values permitted?
BR,
-R
Re: [PATCH 5/5] drm/exynos: Add plane support with fimd
Quoted 7 lines · Rob Clark
Quoted 6 lines · Inki Dae
From: Joonyoung Shim<[email protected]>
The exynos fimd supports 5 window overlays. Only one window overlay of fimd is used by the crtc, so we need plane feature to use the rest window overlays.
Quoted 7 lines
Quoted 3 lines
This creates one ioctl exynos specific -
DRM_EXYNOS_PLANE_SET_ZPOS, it is the ioctl to decide for user to assign which window overlay.btw, I think I will end up with a similar ioctl.. so thought I'd double check for consistency, is zorder interpreted from back to front or front to back? Ie. higher numeric value in front or behind of lower numeric value? Are negative values permitted?
The zpos of exynos plane is just the index of overlay of exynos fimd or exynos hdmi. 0 zpos means first overlay and 1 zpos means second overlay. It isn't the priority value but higher zpos will have higher priority generally.
A negative value -1 is defined to special value. A exynos crtc should use one overlay and -1 zpos means the overlay that crtc uses.
Thanks.
Quoted 7 lines
BR,
-R
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/exynos: Add plane support with fimd
Quoted 19 lines · Joonyoung Shim
Quoted 9 lines · Rob Clark
Quoted 7 lines · Inki Dae
From: Joonyoung Shim<[email protected]>
The exynos fimd supports 5 window overlays. Only one window overlay of fimd is used by the crtc, so we need plane feature to use the rest window overlays.
Quoted 7 lines
Quoted 3 lines
This creates one ioctl exynos specific -
DRM_EXYNOS_PLANE_SET_ZPOS, it is the ioctl to decide for user to assign which window overlay.btw, I think I will end up with a similar ioctl.. so thought I'd double check for consistency, is zorder interpreted from back to front or front to back? Ie. higher numeric value in front or behind of lower numeric value? Are negative values permitted?
Quoted 4 lines
The zpos of exynos plane is just the index of overlay of exynos fimd or exynos hdmi. 0 zpos means first overlay and 1 zpos means second overlay. It isn't the priority value but higher zpos will have higher priority generally.
I'm not sure that I quite understand that.. does that mean zpos=1 will be in front of zpos=0 (which would be in front of crtc, aka zpos=-1). Do you have a way to put overlays *behind* crtc layer (which presumably would be in some mode with an alpha channel?)
(IIRC, samsung has some public TRM type document.. if this is covered there, feel free to answer by just pointing me at the section I should read)
BR,
-R
Quoted 14 lines
A negative value -1 is defined to special value. A exynos crtc should use one overlay and -1 zpos means the overlay that crtc uses.
Thanks.
Quoted 8 lines
BR,
-R_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerRE: [PATCH 5/5] drm/exynos: Add plane support with fimd
Hi, Rob.
below is my answer.
Quoted 34 lines
-----Original Message-----
From: Rob Clark [mailto:[email protected]]
Sent: Tuesday, December 13, 2011 9:48 AM
To: Joonyoung Shim
Cc: Inki Dae; [email protected]; [email protected]; dri- [email protected]
Subject: Re: [PATCH 5/5] drm/exynos: Add plane support with fimdQuoted 19 lines · Joonyoung Shim
Quoted 9 lines · Rob Clark
Quoted 7 lines · Inki Dae
From: Joonyoung Shim<[email protected]>
The exynos fimd supports 5 window overlays. Only one window overlay of fimd is used by the crtc, so we need plane feature to use the rest window overlays.
Quoted 7 lines
Quoted 3 lines
This creates one ioctl exynos specific -
DRM_EXYNOS_PLANE_SET_ZPOS, it is the ioctl to decide for user to assign which window overlay.btw, I think I will end up with a similar ioctl.. so thought I'd double check for consistency, is zorder interpreted from back to front or front to back? Ie. higher numeric value in front or behind of lower numeric value? Are negative values permitted?
Quoted 4 lines
The zpos of exynos plane is just the index of overlay of exynos fimd or exynos hdmi. 0 zpos means first overlay and 1 zpos means second overlay. It isn't the priority value but higher zpos will have higher priority generally.
Quoted 9 lines
I'm not sure that I quite understand that.. does that mean zpos=1 will be in front of zpos=0 (which would be in front of crtc, aka zpos=-1). Do you have a way to put overlays *behind* crtc layer (which presumably would be in some mode with an alpha channel?)
(IIRC, samsung has some public TRM type document.. if this is covered there, feel free to answer by just pointing me at the section I should read)
I know that omap, at least omap3(Display Controller of the Display Subsystem), has two modes. one is normal mode and another is alpha mode. and they also have different overlay priority but Samsung exynos has fixed priority to hardware overlays. so higher overlay always is in front of lower overlay. in case of plane module for Samsung SoC, if zpos is -1 then crtc has default overlay designated by machine code. so whether some overlay is in front of crtc or not would be decided by default overlay.
Thank you,
Inki Dae.
Quoted 17 lines
BR,
-RQuoted 14 lines
A negative value -1 is defined to special value. A exynos crtc should use one overlay and -1 zpos means the overlay that crtc uses.
Thanks.
Quoted 8 lines
BR,
-R_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/exynos: Add plane support with fimd
Quoted 47 lines · Inki Dae
Hi, Rob.
below is my answer.Quoted 34 lines
-----Original Message-----
From: Rob Clark [mailto:[email protected]]
Sent: Tuesday, December 13, 2011 9:48 AM
To: Joonyoung Shim
Cc: Inki Dae; [email protected]; [email protected]; dri- [email protected]
Subject: Re: [PATCH 5/5] drm/exynos: Add plane support with fimdQuoted 19 lines · Joonyoung Shim
Quoted 9 lines · Rob Clark
Quoted 7 lines · Inki Dae
From: Joonyoung Shim<[email protected]>
The exynos fimd supports 5 window overlays. Only one window overlay of fimd is used by the crtc, so we need plane feature to use the rest window overlays.
Quoted 7 lines
Quoted 3 lines
This creates one ioctl exynos specific -
DRM_EXYNOS_PLANE_SET_ZPOS, it is the ioctl to decide for user to assign which window overlay.btw, I think I will end up with a similar ioctl.. so thought I'd double check for consistency, is zorder interpreted from back to front or front to back? Ie. higher numeric value in front or behind of lower numeric value? Are negative values permitted?
Quoted 4 lines
The zpos of exynos plane is just the index of overlay of exynos fimd or exynos hdmi. 0 zpos means first overlay and 1 zpos means second overlay. It isn't the priority value but higher zpos will have higher priority generally.
Quoted 9 lines
I'm not sure that I quite understand that.. does that mean zpos=1 will be in front of zpos=0 (which would be in front of crtc, aka zpos=-1). Do you have a way to put overlays *behind* crtc layer (which presumably would be in some mode with an alpha channel?)
(IIRC, samsung has some public TRM type document.. if this is covered there, feel free to answer by just pointing me at the section I should read)
Quoted 7 lines
I know that omap, at least omap3(Display Controller of the Display Subsystem), has two modes. one is normal mode and another is alpha mode. and they also have different overlay priority but Samsung exynos has fixed priority to hardware overlays. so higher overlay always is in front of lower overlay. in case of plane module for Samsung SoC, if zpos is -1 then crtc has default overlay designated by machine code. so whether some overlay is in front of crtc or not would be decided by default overlay.
ahh, ok.. I was hoping it was as easy as omap4 where we can just set arbitrary z-order (0-4) for any of the layers (crtc or overlay). So maybe not a way to completely abstract this in the same way for userspace (but the case is the same in omap3 where it is either normal or alpha mode.. and I hadn't really decided yet how to handle the difference between omap generations for this sort of API yet).
I guess userspace ddx driver (or wayland compositor, etc) would still need to know a bit about what is under the hood.. sigh..
BR,
-R
Quoted 22 lines
Thank you,
Inki Dae.Quoted 17 lines
BR,
-RQuoted 14 lines
A negative value -1 is defined to special value. A exynos crtc should use one overlay and -1 zpos means the overlay that crtc uses.
Thanks.
Quoted 8 lines
BR,
-R_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/exynos: Add plane support with fimd
In reply to Inki DaeQuoted 13 lines · Inki Dae
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +13
-0+static int +exynos_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, + struct drm_framebuffer *fb, int crtc_x, int crtc_y, + unsigned int crtc_w, unsigned int crtc_h, + uint32_t src_x, uint32_t src_y, + uint32_t src_w, uint32_t src_h) +{ + struct exynos_plane *exynos_plane = + container_of(plane, struct exynos_plane, base); + struct exynos_drm_overlay *overlay = &exynos_plane->overlay; + struct exynos_drm_crtc_pos pos; + int ret; +
drivers/gpu/drm/exynos/exynos_drm_plane.c line 47
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +10
-0+ DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); + + memset(&pos, 0, sizeof(struct exynos_drm_crtc_pos)); + pos.crtc_x = crtc_x; + pos.crtc_y = crtc_y; + pos.crtc_w = crtc_w; + pos.crtc_h = crtc_h; + + pos.fb_x = src_x; + pos.fb_y = src_y;
also, I think src_x/src_y should be interpreted at 16.16/Q16 fixed point. But elsewhere were I see fb_x/y used it, it doesn't appear to be interpreted this way.
Also, I *think* that comment was meant to apply to src_h/src_w (Jesse?), but you seem to ignore these parameters..
BR,
-R
Quoted 16 lines
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +16
-0+ + /* TODO: scale feature */ + ret = exynos_drm_overlay_update(overlay, fb, &crtc->mode, &pos); + if (ret < 0) + return ret; + + exynos_drm_fn_encoder(crtc, overlay, + exynos_drm_encoder_crtc_mode_set); + exynos_drm_fn_encoder(crtc, &overlay->zpos, + exynos_drm_encoder_crtc_plane_commit); + + exynos_plane->enabled = true; + + return 0; +} +
Re: [PATCH 5/5] drm/exynos: Add plane support with fimd
Quoted 19 lines · Rob Clark
Quoted 18 lines · Inki Dae
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +18
-0+static int +exynos_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) +{ +struct exynos_plane *exynos_plane = + container_of(plane, struct exynos_plane, base); +struct exynos_drm_overlay *overlay =&exynos_plane->overlay; +struct exynos_drm_crtc_pos pos; +int ret; + +DRM_DEBUG_KMS ("[%d] %s\n" , __LINE__, __func__); + +memset (&pos,0 ,sizeof (struct exynos_drm_crtc_pos )); + pos.crtc_x = crtc_x; + pos.crtc_y = crtc_y;
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_plane.c line 47
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +5
-0+ pos.crtc_w = crtc_w; + pos.crtc_h = crtc_h; + + pos.fb_x = src_x; + pos.fb_y = src_y;also, I think src_x/src_y should be interpreted at 16.16/Q16 fixed point. But elsewhere were I see fb_x/y used it, it doesn't appear to be interpreted this way.
Right, this will be fixed.
Thanks.
Quoted 28 lines
Also, I *think* that comment was meant to apply to src_h/src_w (Jesse?), but you seem to ignore these parameters..
BR,
-RQuoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +6
-0+ +/* TODO: scale feature */ + ret =exynos_drm_overlay_update (overlay, fb,&crtc->mode,&pos); +if (ret<0 ) +return ret; +drivers/gpu/drm/exynos/exynos_drm_plane.c line 63
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_plane.c new file +10
-0+exynos_drm_fn_encoder (crtc, overlay, + exynos_drm_encoder_crtc_mode_set); +exynos_drm_fn_encoder (crtc,&overlay->zpos, + exynos_drm_encoder_crtc_plane_commit); + + exynos_plane->enabled = true; + +return 0 ; +} +_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel