Hello all,
This patch set fixes the following: . fixed page align - page align is done by exynos_drm_gem_create() so do not align in page unit at exynos_drm_gem_dumb_create(). . removed unnecessary dpms call - encoder's mode_set callback isn't specific to hardware so it doesn't need to call exynos_drm_encoder_dpms() . control display power at connector module - it doesn't need that display power is controlled by encoder's dpms so moves it into connector module so that the display power can be controlled by connector's dpms properly. . make sure that hardware overlay for fimd and hdmi is disabled - the values set to registers will be updated into real registers at vsync so dma operation could be malfunctioned when accessed to memory after gem buffer was released. this patch makes sure that hw overlay is disabled before the gem buffer is released. . check NV12M format specific to Exynos properly - this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format. . updated crtc to plane safely - if old_crtc isn't same as encoder->crtc then it means that user changed crtc id to another one so a plane to old_crtc should be disabled so that current plane can be updated safely and plane->crtc should be set to new crtc(encoder->crtc)
And code clean like below: . separated fimd_power_on into some parts - separated fimd_power_on into fimd_activate and fimd_clock functions and fimd_activate function will call fimd_clock to control fimd power and vsync interrupt. . separated subdrv->probe call and encoder/connector creation - with this patch, exynos drm core module can take exception when some operation was failed properly. . changed context name of hdmi and mixer - changed ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable name makes it confused. . fixed build warning
Thanks.
Inki Dae (13): drm/exynos: added device object to subdrv's remove callback as argument drm/exynos: separated subdrv->probe call and encoder/connector creation. drm/exynos: fixed page align bug. drm/exynos: use empty function instead of drm_helper_connector_dpms drm/exynos: removed exynos_drm_encoder_dpms call drm/exynos: separeated fimd_power_on into some parts. drm/exynos: control display power at connector module. drm/exynos: make sure that hardware overlay for fimd is disabled drm/exynos: check NV12M format specific to Exynos properly drm/exynos: update crtc to plane safely drm/exynos: changed context name of hdmi and mixer drm/exynos: fixed build warning drm/exynos: make sure that hardware overlay for hdmi is disabled
drivers/gpu/drm/exynos/exynos_drm_connector.c | 18 +++++- drivers/gpu/drm/exynos/exynos_drm_core.c | 93 +++++++++++++++++-------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 19 +++++- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 92 +++++++++++++++++------- drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 ++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 ++---- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 74 ++++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_gem.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 47 ++++++++----- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 5 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++-- drivers/gpu/drm/exynos/exynos_mixer.c | 21 +++++- 15 files changed, 349 insertions(+), 126 deletions(-)
when remove callback of exynos_drm_subdrv is called, it could need device object for sub driver to control things specific to hw such as runtime pm.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index e22704b..24c45d8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -266,7 +266,7 @@ struct exynos_drm_subdrv { struct exynos_drm_manager *manager;
int (*probe)(struct drm_device *drm_dev, struct device *dev); - void (*remove)(struct drm_device *dev); + void (*remove)(struct drm_device *drm_dev, struct device *dev); int (*open)(struct drm_device *drm_dev, struct device *dev, struct drm_file *file); void (*close)(struct drm_device *drm_dev, struct device *dev, diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index b19cd93..47396e1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -678,7 +678,7 @@ static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev) return 0; }
-static void fimd_subdrv_remove(struct drm_device *drm_dev) +static void fimd_subdrv_remove(struct drm_device *drm_dev, struct device *dev) { DRM_DEBUG_KMS("%s\n", __FILE__);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 537027a..f900da0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -466,7 +466,7 @@ static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev) return 0; }
-static void vidi_subdrv_remove(struct drm_device *drm_dev) +static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev) { DRM_DEBUG_KMS("%s\n", __FILE__);
this patch separates sub driver's probe call and encoder/connector creation so that exynos drm core module can take exception when some operation was failed properly.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_core.c | 93 +++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 84dd099..1c8d5fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -34,30 +34,15 @@
static LIST_HEAD(exynos_drm_subdrv_list);
-static int exynos_drm_subdrv_probe(struct drm_device *dev, +static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_subdrv *subdrv) { struct drm_encoder *encoder; struct drm_connector *connector; + int ret;
DRM_DEBUG_DRIVER("%s\n", __FILE__);
- if (subdrv->probe) { - int ret; - - /* - * this probe callback would be called by sub driver - * after setting of all resources to this sub driver, - * such as clock, irq and register map are done or by load() - * of exynos drm driver. - * - * P.S. note that this driver is considered for modularization. - */ - ret = subdrv->probe(dev, subdrv->dev); - if (ret) - return ret; - } - if (!subdrv->manager) return 0;
@@ -78,24 +63,22 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, connector = exynos_drm_connector_create(dev, encoder); if (!connector) { DRM_ERROR("failed to create connector\n"); - encoder->funcs->destroy(encoder); - return -EFAULT; + ret = -EFAULT; + goto err_destroy_encoder; }
subdrv->encoder = encoder; subdrv->connector = connector;
return 0; + +err_destroy_encoder: + encoder->funcs->destroy(encoder); + return ret; }
-static void exynos_drm_subdrv_remove(struct drm_device *dev, - struct exynos_drm_subdrv *subdrv) +static void exynos_drm_destroy_enc_conn(struct exynos_drm_subdrv *subdrv) { - DRM_DEBUG_DRIVER("%s\n", __FILE__); - - if (subdrv->remove) - subdrv->remove(dev); - if (subdrv->encoder) { struct drm_encoder *encoder = subdrv->encoder; encoder->funcs->destroy(encoder); @@ -109,9 +92,48 @@ static void exynos_drm_subdrv_remove(struct drm_device *dev, } }
+static int exynos_drm_subdrv_probe(struct drm_device *dev, + struct exynos_drm_subdrv *subdrv) +{ + if (subdrv->probe) { + int ret; + + subdrv->drm_dev = dev; + + /* + * this probe callback would be called by sub driver + * after setting of all resources to this sub driver, + * such as clock, irq and register map are done or by load() + * of exynos drm driver. + * + * P.S. note that this driver is considered for modularization. + */ + ret = subdrv->probe(dev, subdrv->dev); + if (ret) + return ret; + } + + if (!subdrv->manager) + return -EINVAL; + + subdrv->manager->dev = subdrv->dev; + + return 0; +} + +static void exynos_drm_subdrv_remove(struct drm_device *dev, + struct exynos_drm_subdrv *subdrv) +{ + DRM_DEBUG_DRIVER("%s\n", __FILE__); + + if (subdrv->remove) + subdrv->remove(dev, subdrv->dev); +} + int exynos_drm_device_register(struct drm_device *dev) { struct exynos_drm_subdrv *subdrv, *n; + unsigned int fine_cnt = 0; int err;
DRM_DEBUG_DRIVER("%s\n", __FILE__); @@ -120,14 +142,27 @@ int exynos_drm_device_register(struct drm_device *dev) return -EINVAL;
list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) { - subdrv->drm_dev = dev; err = exynos_drm_subdrv_probe(dev, subdrv); if (err) { DRM_DEBUG("exynos drm subdrv probe failed.\n"); list_del(&subdrv->list); + continue; } + + err = exynos_drm_create_enc_conn(dev, subdrv); + if (err) { + DRM_DEBUG("failed to create encoder and connector.\n"); + exynos_drm_subdrv_remove(dev, subdrv); + list_del(&subdrv->list); + continue; + } + + fine_cnt++; }
+ if (!fine_cnt) + return -EINVAL; + return 0; } EXPORT_SYMBOL_GPL(exynos_drm_device_register); @@ -143,8 +178,10 @@ int exynos_drm_device_unregister(struct drm_device *dev) return -EINVAL; }
- list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) + list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { exynos_drm_subdrv_remove(dev, subdrv); + exynos_drm_destroy_enc_conn(subdrv); + }
return 0; }
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch separates sub driver's probe call and encoder/connector creation so that exynos drm core module can take exception when some operation was failed properly.
Which exceptions? I don't know this patch gives any benefit to us.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_core.c | 93 +++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 84dd099..1c8d5fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -34,30 +34,15 @@
static LIST_HEAD(exynos_drm_subdrv_list);
-static int exynos_drm_subdrv_probe(struct drm_device *dev, +static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_subdrv *subdrv) { struct drm_encoder *encoder; struct drm_connector *connector;
int ret;
DRM_DEBUG_DRIVER("%s\n", __FILE__);
- if (subdrv->probe) {
int ret;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
- }
- if (!subdrv->manager) return 0;
@@ -78,24 +63,22 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, connector = exynos_drm_connector_create(dev, encoder); if (!connector) { DRM_ERROR("failed to create connector\n");
encoder->funcs->destroy(encoder);
return -EFAULT;
ret = -EFAULT;
goto err_destroy_encoder;
}
subdrv->encoder = encoder; subdrv->connector = connector;
return 0;
+err_destroy_encoder:
- encoder->funcs->destroy(encoder);
- return ret; }
-static void exynos_drm_subdrv_remove(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+static void exynos_drm_destroy_enc_conn(struct exynos_drm_subdrv *subdrv) {
- DRM_DEBUG_DRIVER("%s\n", __FILE__);
- if (subdrv->remove)
subdrv->remove(dev);
- if (subdrv->encoder) { struct drm_encoder *encoder = subdrv->encoder; encoder->funcs->destroy(encoder);
@@ -109,9 +92,48 @@ static void exynos_drm_subdrv_remove(struct drm_device *dev, } }
+static int exynos_drm_subdrv_probe(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
- if (subdrv->probe) {
int ret;
subdrv->drm_dev = dev;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
- }
- if (!subdrv->manager)
return -EINVAL;
- subdrv->manager->dev = subdrv->dev;
- return 0;
+}
+static void exynos_drm_subdrv_remove(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
- DRM_DEBUG_DRIVER("%s\n", __FILE__);
- if (subdrv->remove)
subdrv->remove(dev, subdrv->dev);
+}
int exynos_drm_device_register(struct drm_device *dev) { struct exynos_drm_subdrv *subdrv, *n;
unsigned int fine_cnt = 0; int err;
DRM_DEBUG_DRIVER("%s\n", __FILE__);
@@ -120,14 +142,27 @@ int exynos_drm_device_register(struct drm_device *dev) return -EINVAL;
list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) {
err = exynos_drm_subdrv_probe(dev, subdrv); if (err) { DRM_DEBUG("exynos drm subdrv probe failed.\n"); list_del(&subdrv->list);subdrv->drm_dev = dev;
continue;
}
err = exynos_drm_create_enc_conn(dev, subdrv);
if (err) {
DRM_DEBUG("failed to create encoder and connector.\n");
exynos_drm_subdrv_remove(dev, subdrv);
list_del(&subdrv->list);
continue;
}
fine_cnt++;
}
if (!fine_cnt)
return -EINVAL;
return 0; } EXPORT_SYMBOL_GPL(exynos_drm_device_register);
@@ -143,8 +178,10 @@ int exynos_drm_device_unregister(struct drm_device *dev) return -EINVAL; }
- list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { exynos_drm_subdrv_remove(dev, subdrv);
exynos_drm_destroy_enc_conn(subdrv);
}
return 0; }
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch separates sub driver's probe call and encoder/connector creation so that exynos drm core module can take exception when some operation was failed properly.
Which exceptions? I don't know this patch gives any benefit to us.
previous code didn't take exception when exynos_drm_encoder_create() is falied. and for now, exynos_drm_encoder/connector_create functions was called at exynos_drm_subdrv_probe() so know that this patch is for code clean by separating them into two parts also.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_core.c | 93 +++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 84dd099..1c8d5fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -34,30 +34,15 @@ static LIST_HEAD(exynos_drm_subdrv_list); -static int exynos_drm_subdrv_probe(struct drm_device *dev, +static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_subdrv *subdrv) { struct drm_encoder *encoder; struct drm_connector *connector;
int ret; DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->probe) {
int ret;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
@@ -78,24 +63,22 @@ static int exynos_drm_subdrv_probe(struct drm_deviceif (!subdrv->manager) return 0;
*dev, connector = exynos_drm_connector_create(dev, encoder); if (!connector) { DRM_ERROR("failed to create connector\n");
encoder->funcs->destroy(encoder);
return -EFAULT;
ret = -EFAULT;
goto err_destroy_encoder; } subdrv->encoder = encoder; subdrv->connector = connector; return 0;
+err_destroy_encoder:
encoder->funcs->destroy(encoder);
} -static void exynos_drm_subdrv_remove(struct drm_device *dev,return ret;
struct exynos_drm_subdrv *subdrv)
+static void exynos_drm_destroy_enc_conn(struct exynos_drm_subdrv *subdrv) {
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev);
if (subdrv->encoder) { struct drm_encoder *encoder = subdrv->encoder; encoder->funcs->destroy(encoder);
@@ -109,9 +92,48 @@ static void exynos_drm_subdrv_remove(struct drm_device *dev, } } +static int exynos_drm_subdrv_probe(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
if (subdrv->probe) {
int ret;
subdrv->drm_dev = dev;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
if (!subdrv->manager)
return -EINVAL;
subdrv->manager->dev = subdrv->dev;
return 0;
+}
+static void exynos_drm_subdrv_remove(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev, subdrv->dev);
+}
- int exynos_drm_device_register(struct drm_device *dev) { struct exynos_drm_subdrv *subdrv, *n;
unsigned int fine_cnt = 0; int err; DRM_DEBUG_DRIVER("%s\n", __FILE__);
@@ -120,14 +142,27 @@ int exynos_drm_device_register(struct drm_device *dev) return -EINVAL; list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) {
subdrv->drm_dev = dev; err = exynos_drm_subdrv_probe(dev, subdrv); if (err) { DRM_DEBUG("exynos drm subdrv probe failed.\n"); list_del(&subdrv->list);
continue; }
err = exynos_drm_create_enc_conn(dev, subdrv);
if (err) {
DRM_DEBUG("failed to create encoder and
connector.\n");
exynos_drm_subdrv_remove(dev, subdrv);
list_del(&subdrv->list);
continue;
}
fine_cnt++; }
if (!fine_cnt)
return -EINVAL;
} EXPORT_SYMBOL_GPL(exynos_drm_device_register);return 0;
@@ -143,8 +178,10 @@ int exynos_drm_device_unregister(struct drm_device *dev) return -EINVAL; }
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { exynos_drm_subdrv_remove(dev, subdrv);
exynos_drm_destroy_enc_conn(subdrv);
}} return 0;
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On 08/20/2012 10:52 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch separates sub driver's probe call and encoder/connector creation so that exynos drm core module can take exception when some operation was failed properly.
Which exceptions? I don't know this patch gives any benefit to us.
previous code didn't take exception when exynos_drm_encoder_create() is falied.
No, it is considered.
and for now, exynos_drm_encoder/connector_create functions was called at exynos_drm_subdrv_probe() so know that this patch is for code clean by separating them into two parts also.
It's ok, but it just splitting.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_core.c | 93 +++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 84dd099..1c8d5fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -34,30 +34,15 @@ static LIST_HEAD(exynos_drm_subdrv_list); -static int exynos_drm_subdrv_probe(struct drm_device *dev, +static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_subdrv *subdrv) { struct drm_encoder *encoder; struct drm_connector *connector;
int ret; DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->probe) {
int ret;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
@@ -78,24 +63,22 @@ static int exynos_drm_subdrv_probe(struct drm_deviceif (!subdrv->manager) return 0;
*dev, connector = exynos_drm_connector_create(dev, encoder); if (!connector) { DRM_ERROR("failed to create connector\n");
encoder->funcs->destroy(encoder);
return -EFAULT;
ret = -EFAULT;
goto err_destroy_encoder; } subdrv->encoder = encoder; subdrv->connector = connector; return 0;
+err_destroy_encoder:
encoder->funcs->destroy(encoder);
} -static void exynos_drm_subdrv_remove(struct drm_device *dev,return ret;
struct exynos_drm_subdrv *subdrv)
+static void exynos_drm_destroy_enc_conn(struct exynos_drm_subdrv *subdrv) {
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev);
if (subdrv->encoder) { struct drm_encoder *encoder = subdrv->encoder; encoder->funcs->destroy(encoder);
@@ -109,9 +92,48 @@ static void exynos_drm_subdrv_remove(struct drm_device *dev, } } +static int exynos_drm_subdrv_probe(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
if (subdrv->probe) {
int ret;
subdrv->drm_dev = dev;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
if (!subdrv->manager)
return -EINVAL;
subdrv->manager->dev = subdrv->dev;
return 0;
+}
+static void exynos_drm_subdrv_remove(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev, subdrv->dev);
+}
- int exynos_drm_device_register(struct drm_device *dev) { struct exynos_drm_subdrv *subdrv, *n;
unsigned int fine_cnt = 0; int err; DRM_DEBUG_DRIVER("%s\n", __FILE__);
@@ -120,14 +142,27 @@ int exynos_drm_device_register(struct drm_device *dev) return -EINVAL; list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) {
subdrv->drm_dev = dev; err = exynos_drm_subdrv_probe(dev, subdrv); if (err) { DRM_DEBUG("exynos drm subdrv probe failed.\n"); list_del(&subdrv->list);
continue; }
err = exynos_drm_create_enc_conn(dev, subdrv);
if (err) {
DRM_DEBUG("failed to create encoder and
connector.\n");
exynos_drm_subdrv_remove(dev, subdrv);
list_del(&subdrv->list);
continue;
}
fine_cnt++; }
if (!fine_cnt)
return -EINVAL;
} EXPORT_SYMBOL_GPL(exynos_drm_device_register);return 0;
@@ -143,8 +178,10 @@ int exynos_drm_device_unregister(struct drm_device *dev) return -EINVAL; }
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { exynos_drm_subdrv_remove(dev, subdrv);
exynos_drm_destroy_enc_conn(subdrv);
}} return 0;
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 10:52 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch separates sub driver's probe call and encoder/connector creation so that exynos drm core module can take exception when some operation was failed properly.
Which exceptions? I don't know this patch gives any benefit to us.
previous code didn't take exception when exynos_drm_encoder_create() is falied.
No, it is considered.
where is subdrv->remove() called when exynos_drm_encoder_create() is failed? I think if failed then subdrv->remove() should be called and if exynos_drm_connector_create() is failed then not only encoder->funcs->destory() but also subdrv->remove()
and for now, exynos_drm_encoder/connector_create functions was called at exynos_drm_subdrv_probe() so know that this patch is for code clean by separating them into two parts also.
It's ok, but it just splitting.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_core.c | 93 +++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 84dd099..1c8d5fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -34,30 +34,15 @@ static LIST_HEAD(exynos_drm_subdrv_list); -static int exynos_drm_subdrv_probe(struct drm_device *dev, +static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_subdrv *subdrv) { struct drm_encoder *encoder; struct drm_connector *connector;
int ret; DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->probe) {
int ret;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
@@ -78,24 +63,22 @@ static int exynos_drm_subdrv_probe(structif (!subdrv->manager) return 0;
drm_device *dev, connector = exynos_drm_connector_create(dev, encoder); if (!connector) { DRM_ERROR("failed to create connector\n");
encoder->funcs->destroy(encoder);
return -EFAULT;
ret = -EFAULT;
goto err_destroy_encoder; } subdrv->encoder = encoder; subdrv->connector = connector; return 0;
+err_destroy_encoder:
encoder->funcs->destroy(encoder);
} -static void exynos_drm_subdrv_remove(struct drm_device *dev,return ret;
struct exynos_drm_subdrv *subdrv)
+static void exynos_drm_destroy_enc_conn(struct exynos_drm_subdrv *subdrv) {
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev);
if (subdrv->encoder) { struct drm_encoder *encoder = subdrv->encoder; encoder->funcs->destroy(encoder);
@@ -109,9 +92,48 @@ static void exynos_drm_subdrv_remove(struct drm_device *dev, } } +static int exynos_drm_subdrv_probe(struct drm_device *dev,
struct exynos_drm_subdrv
*subdrv) +{
if (subdrv->probe) {
int ret;
subdrv->drm_dev = dev;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
if (!subdrv->manager)
return -EINVAL;
subdrv->manager->dev = subdrv->dev;
return 0;
+}
+static void exynos_drm_subdrv_remove(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev, subdrv->dev);
+}
- int exynos_drm_device_register(struct drm_device *dev) { struct exynos_drm_subdrv *subdrv, *n;
unsigned int fine_cnt = 0; int err; DRM_DEBUG_DRIVER("%s\n", __FILE__);
@@ -120,14 +142,27 @@ int exynos_drm_device_register(struct drm_device *dev) return -EINVAL; list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) {
subdrv->drm_dev = dev; err = exynos_drm_subdrv_probe(dev, subdrv); if (err) { DRM_DEBUG("exynos drm subdrv probe failed.\n"); list_del(&subdrv->list);
continue; }
err = exynos_drm_create_enc_conn(dev, subdrv);
if (err) {
DRM_DEBUG("failed to create encoder and
connector.\n");
exynos_drm_subdrv_remove(dev, subdrv);
list_del(&subdrv->list);
continue;
}
fine_cnt++; }
if (!fine_cnt)
return -EINVAL;
} EXPORT_SYMBOL_GPL(exynos_drm_device_register);return 0;
@@ -143,8 +178,10 @@ int exynos_drm_device_unregister(struct drm_device *dev) return -EINVAL; }
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { exynos_drm_subdrv_remove(dev, subdrv);
exynos_drm_destroy_enc_conn(subdrv);
}} return 0;
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On 08/20/2012 01:31 PM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 10:52 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch separates sub driver's probe call and encoder/connector creation so that exynos drm core module can take exception when some operation was failed properly.
Which exceptions? I don't know this patch gives any benefit to us.
previous code didn't take exception when exynos_drm_encoder_create() is falied.
No, it is considered.
where is subdrv->remove() called when exynos_drm_encoder_create() is failed? I think if failed then subdrv->remove() should be called and if exynos_drm_connector_create() is failed then not only encoder->funcs->destory() but also subdrv->remove()
OK, but just add subdrv->remove(). Then if it needs, please split function.
and for now, exynos_drm_encoder/connector_create functions was called at exynos_drm_subdrv_probe() so know that this patch is for code clean by separating them into two parts also.
It's ok, but it just splitting.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_core.c | 93
+++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 84dd099..1c8d5fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -34,30 +34,15 @@ static LIST_HEAD(exynos_drm_subdrv_list); -static int exynos_drm_subdrv_probe(struct drm_device *dev, +static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_subdrv *subdrv) { struct drm_encoder *encoder; struct drm_connector *connector;
int ret; DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->probe) {
int ret;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
@@ -78,24 +63,22 @@ static int exynos_drm_subdrv_probe(structif (!subdrv->manager) return 0;
drm_device *dev, connector = exynos_drm_connector_create(dev, encoder); if (!connector) { DRM_ERROR("failed to create connector\n");
encoder->funcs->destroy(encoder);
return -EFAULT;
ret = -EFAULT;
goto err_destroy_encoder; } subdrv->encoder = encoder; subdrv->connector = connector; return 0;
+err_destroy_encoder:
encoder->funcs->destroy(encoder);
} -static void exynos_drm_subdrv_remove(struct drm_device *dev,return ret;
struct exynos_drm_subdrv *subdrv)
+static void exynos_drm_destroy_enc_conn(struct exynos_drm_subdrv *subdrv) {
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev);
if (subdrv->encoder) { struct drm_encoder *encoder = subdrv->encoder; encoder->funcs->destroy(encoder);
@@ -109,9 +92,48 @@ static void exynos_drm_subdrv_remove(struct drm_device *dev, } } +static int exynos_drm_subdrv_probe(struct drm_device *dev,
struct exynos_drm_subdrv
*subdrv) +{
if (subdrv->probe) {
int ret;
subdrv->drm_dev = dev;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
if (!subdrv->manager)
return -EINVAL;
subdrv->manager->dev = subdrv->dev;
return 0;
+}
+static void exynos_drm_subdrv_remove(struct drm_device *dev,
struct exynos_drm_subdrv *subdrv)
+{
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev, subdrv->dev);
+}
- int exynos_drm_device_register(struct drm_device *dev) { struct exynos_drm_subdrv *subdrv, *n;
unsigned int fine_cnt = 0; int err; DRM_DEBUG_DRIVER("%s\n", __FILE__);
@@ -120,14 +142,27 @@ int exynos_drm_device_register(struct drm_device *dev) return -EINVAL; list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) {
subdrv->drm_dev = dev; err = exynos_drm_subdrv_probe(dev, subdrv); if (err) { DRM_DEBUG("exynos drm subdrv probe failed.\n"); list_del(&subdrv->list);
continue; }
err = exynos_drm_create_enc_conn(dev, subdrv);
if (err) {
DRM_DEBUG("failed to create encoder and
connector.\n");
exynos_drm_subdrv_remove(dev, subdrv);
list_del(&subdrv->list);
continue;
}
fine_cnt++; }
if (!fine_cnt)
return -EINVAL;
} EXPORT_SYMBOL_GPL(exynos_drm_device_register);return 0;
@@ -143,8 +178,10 @@ int exynos_drm_device_unregister(struct drm_device *dev) return -EINVAL; } - list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { exynos_drm_subdrv_remove(dev, subdrv);
exynos_drm_destroy_enc_conn(subdrv);
}} return 0;
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 01:31 PM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 10:52 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch separates sub driver's probe call and encoder/connector creation so that exynos drm core module can take exception when some operation was failed properly.
Which exceptions? I don't know this patch gives any benefit to us.
previous code didn't take exception when exynos_drm_encoder_create() is falied.
No, it is considered.
where is subdrv->remove() called when exynos_drm_encoder_create() is failed? I think if failed then subdrv->remove() should be called and if exynos_drm_connector_create() is failed then not only encoder->funcs->destory() but also subdrv->remove()
OK, but just add subdrv->remove(). Then if it needs, please split function.
now exynos_drm_subdrv_probe() creates encoder and connector so it should be separated into meaningful parts.
and for now, exynos_drm_encoder/connector_create functions was called at exynos_drm_subdrv_probe() so know that this patch is for code clean by separating them into two parts also.
It's ok, but it just splitting.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_core.c | 93
+++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 84dd099..1c8d5fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -34,30 +34,15 @@ static LIST_HEAD(exynos_drm_subdrv_list); -static int exynos_drm_subdrv_probe(struct drm_device *dev, +static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_subdrv *subdrv) { struct drm_encoder *encoder; struct drm_connector *connector;
int ret; DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->probe) {
int ret;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
@@ -78,24 +63,22 @@ static int exynos_drm_subdrv_probe(structif (!subdrv->manager) return 0;
drm_device *dev, connector = exynos_drm_connector_create(dev, encoder); if (!connector) { DRM_ERROR("failed to create connector\n");
encoder->funcs->destroy(encoder);
return -EFAULT;
ret = -EFAULT;
goto err_destroy_encoder; } subdrv->encoder = encoder; subdrv->connector = connector; return 0;
+err_destroy_encoder:
encoder->funcs->destroy(encoder);
} -static void exynos_drm_subdrv_remove(struct drm_device *dev,return ret;
struct exynos_drm_subdrv
*subdrv) +static void exynos_drm_destroy_enc_conn(struct exynos_drm_subdrv *subdrv) {
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev);
if (subdrv->encoder) { struct drm_encoder *encoder = subdrv->encoder; encoder->funcs->destroy(encoder);
@@ -109,9 +92,48 @@ static void exynos_drm_subdrv_remove(struct drm_device *dev, } } +static int exynos_drm_subdrv_probe(struct drm_device *dev,
struct exynos_drm_subdrv
*subdrv) +{
if (subdrv->probe) {
int ret;
subdrv->drm_dev = dev;
/*
* this probe callback would be called by sub driver
* after setting of all resources to this sub driver,
* such as clock, irq and register map are done or by
load()
* of exynos drm driver.
*
* P.S. note that this driver is considered for
modularization.
*/
ret = subdrv->probe(dev, subdrv->dev);
if (ret)
return ret;
}
if (!subdrv->manager)
return -EINVAL;
subdrv->manager->dev = subdrv->dev;
return 0;
+}
+static void exynos_drm_subdrv_remove(struct drm_device *dev,
struct exynos_drm_subdrv
*subdrv) +{
DRM_DEBUG_DRIVER("%s\n", __FILE__);
if (subdrv->remove)
subdrv->remove(dev, subdrv->dev);
+}
- int exynos_drm_device_register(struct drm_device *dev) { struct exynos_drm_subdrv *subdrv, *n;
unsigned int fine_cnt = 0; int err; DRM_DEBUG_DRIVER("%s\n", __FILE__);
@@ -120,14 +142,27 @@ int exynos_drm_device_register(struct drm_device *dev) return -EINVAL; list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) {
subdrv->drm_dev = dev; err = exynos_drm_subdrv_probe(dev, subdrv); if (err) { DRM_DEBUG("exynos drm subdrv probe
failed.\n"); list_del(&subdrv->list);
continue; }
err = exynos_drm_create_enc_conn(dev, subdrv);
if (err) {
DRM_DEBUG("failed to create encoder and
connector.\n");
exynos_drm_subdrv_remove(dev, subdrv);
list_del(&subdrv->list);
continue;
}
fine_cnt++; }
if (!fine_cnt)
return -EINVAL;
} EXPORT_SYMBOL_GPL(exynos_drm_device_register);return 0;
@@ -143,8 +178,10 @@ int exynos_drm_device_unregister(struct drm_device *dev) return -EINVAL; } - list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { exynos_drm_subdrv_remove(dev, subdrv);
exynos_drm_destroy_enc_conn(subdrv);
}} return 0;
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
do not align in page unit at dumb creation. the align is done by exynos_drm_gem_create() to be called commonly.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index da4e3ca..a38051c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -662,7 +662,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, */
args->pitch = args->width * ((args->bpp + 7) / 8); - args->size = PAGE_ALIGN(args->pitch * args->height); + args->size = args->pitch * args->height;
exynos_gem_obj = exynos_drm_gem_create(dev, args->flags, args->size); if (IS_ERR(exynos_gem_obj))
crtc and encoder's dpms callback will be called before connector's dpms is called so drm_helper_connector_dpms doesn't need to be called.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_connector.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index d956819..65acf0d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -226,6 +226,13 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { .best_encoder = exynos_drm_best_encoder, };
+static void exynos_drm_connector_dpms(struct drm_connector *connector, int mode) +{ + DRM_DEBUG_KMS("%s\n", __FILE__); + + /* drm framework doesn't check NULL. */ +} + static int exynos_drm_connector_fill_modes(struct drm_connector *connector, unsigned int max_width, unsigned int max_height) { @@ -285,7 +292,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector) }
static struct drm_connector_funcs exynos_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = exynos_drm_connector_dpms, .fill_modes = exynos_drm_connector_fill_modes, .detect = exynos_drm_connector_detect, .destroy = exynos_drm_connector_destroy,
On 08/17/2012 06:50 PM, Inki Dae wrote:
crtc and encoder's dpms callback will be called before connector's dpms is called so drm_helper_connector_dpms doesn't need to be called.
I can't understand this description. I know crtc and encoder dpms are called by drm_helper_connector_dpms.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_connector.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index d956819..65acf0d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -226,6 +226,13 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { .best_encoder = exynos_drm_best_encoder, };
+static void exynos_drm_connector_dpms(struct drm_connector *connector, int mode) +{
- DRM_DEBUG_KMS("%s\n", __FILE__);
- /* drm framework doesn't check NULL. */
+}
- static int exynos_drm_connector_fill_modes(struct drm_connector *connector, unsigned int max_width, unsigned int max_height) {
@@ -285,7 +292,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector) }
static struct drm_connector_funcs exynos_connector_funcs = {
- .dpms = drm_helper_connector_dpms,
- .dpms = exynos_drm_connector_dpms, .fill_modes = exynos_drm_connector_fill_modes, .detect = exynos_drm_connector_detect, .destroy = exynos_drm_connector_destroy,
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
crtc and encoder's dpms callback will be called before connector's dpms is called so drm_helper_connector_dpms doesn't need to be called.
I can't understand this description. I know crtc and encoder dpms are called by drm_helper_connector_dpms.
Ah, right. there is my missing point. for pm, we need drm_helper_connector_dpms call. actually, this patch is for avoiding duplicated call of mode_set but I didn't consider pm.
Thanks.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_connector.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index d956819..65acf0d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -226,6 +226,13 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { .best_encoder = exynos_drm_best_encoder, }; +static void exynos_drm_connector_dpms(struct drm_connector *connector, int mode) +{
DRM_DEBUG_KMS("%s\n", __FILE__);
/* drm framework doesn't check NULL. */
+}
- static int exynos_drm_connector_fill_modes(struct drm_connector
*connector, unsigned int max_width, unsigned int max_height) { @@ -285,7 +292,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector) } static struct drm_connector_funcs exynos_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.dpms = exynos_drm_connector_dpms, .fill_modes = exynos_drm_connector_fill_modes, .detect = exynos_drm_connector_detect, .destroy = exynos_drm_connector_destroy,
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
encoder's mode_set callback isn't specific to hardware so it doesn't need to call exynos_drm_encoder_dpms().
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 2c037cd..3dae250 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -138,8 +138,6 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
DRM_DEBUG_KMS("%s\n", __FILE__);
- exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_ON); - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { if (connector->encoder == encoder) if (manager_ops && manager_ops->mode_set)
On 08/17/2012 06:50 PM, Inki Dae wrote:
encoder's mode_set callback isn't specific to hardware so it doesn't need to call exynos_drm_encoder_dpms().
Then, where is exynos_drm_encoder_dpms() called?
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_encoder.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 2c037cd..3dae250 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -138,8 +138,6 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
DRM_DEBUG_KMS("%s\n", __FILE__);
- exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
- list_for_each_entry(connector, &dev->mode_config.connector_list, head) { if (connector->encoder == encoder) if (manager_ops && manager_ops->mode_set)
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
encoder's mode_set callback isn't specific to hardware so it doesn't need to call exynos_drm_encoder_dpms().
Then, where is exynos_drm_encoder_dpms() called?
with this patch series, exynos_drm_encoder_dpms() will call apply callback to set local overlay data to real hardware registers and exynos_drm_crtc_dpms() will be used to enable/disable fimd or hdmi power(clock and regulator). actually, previous codes called mode_set two times so this could make it messed up other display sub devices such as mDNIe.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_encoder.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 2c037cd..3dae250 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -138,8 +138,6 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, DRM_DEBUG_KMS("%s\n", __FILE__);
exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
list_for_each_entry(connector, &dev->mode_config.connector_list,
head) { if (connector->encoder == encoder) if (manager_ops && manager_ops->mode_set)
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
this patch separetes fimd_power_on into fimd_activate and fimd_clock and fimd_activate function will call fimd_clock to control fimd power and vsync interrupt.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 60 ++++++++++++++++++++---------- 1 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 47396e1..0ec9d86 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -747,16 +747,10 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) writel(val, ctx->regs + SHADOWCON); }
-static int fimd_power_on(struct fimd_context *ctx, bool enable) +static int fimd_clock(struct fimd_context *ctx, bool enable) { - struct exynos_drm_subdrv *subdrv = &ctx->subdrv; - struct device *dev = subdrv->dev; - DRM_DEBUG_KMS("%s\n", __FILE__);
- if (enable != false && enable != true) - return -EINVAL; - if (enable) { int ret;
@@ -769,18 +763,31 @@ static int fimd_power_on(struct fimd_context *ctx, bool enable) clk_disable(ctx->bus_clk); return ret; } + } else { + clk_disable(ctx->lcd_clk); + clk_disable(ctx->bus_clk); + }
- ctx->suspended = false; + return 0; +} + +static int fimd_activate(struct fimd_context *ctx, bool enable) +{ + if (enable) { + int ret; + struct device *dev = ctx->subdrv.dev; + + ret = fimd_clock(ctx, true); + if (ret < 0) + return ret;
/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags)) fimd_enable_vblank(dev);
- fimd_apply(dev); + ctx->suspended = false; } else { - clk_disable(ctx->lcd_clk); - clk_disable(ctx->bus_clk); - + fimd_clock(ctx, false); ctx->suspended = true; }
@@ -930,15 +937,15 @@ static int fimd_suspend(struct device *dev) { struct fimd_context *ctx = get_fimd_context(dev);
- if (pm_runtime_suspended(dev)) - return 0; - /* * do not use pm_runtime_suspend(). if pm_runtime_suspend() is * called here, an error would be returned by that interface * because the usage_count of pm runtime is more than 1. */ - return fimd_power_on(ctx, false); + if (!pm_runtime_suspended(dev)) + return fimd_activate(ctx, false); + + return 0; }
static int fimd_resume(struct device *dev) @@ -950,8 +957,21 @@ static int fimd_resume(struct device *dev) * of pm runtime would still be 1 so in this case, fimd driver * should be on directly not drawing on pm runtime interface. */ - if (!pm_runtime_suspended(dev)) - return fimd_power_on(ctx, true); + if (pm_runtime_suspended(dev)) { + int ret; + + ret = fimd_activate(ctx, false); + if (ret < 0) + return ret; + + /* + * in case of dpms on(standby), fimd_apply function will + * be called by encoder's dpms callback to update fimd's + * registers but in case of sleep wakeup, it's not. + * so fimd_apply function should be called at here. + */ + fimd_apply(dev); + }
return 0; } @@ -964,7 +984,7 @@ static int fimd_runtime_suspend(struct device *dev)
DRM_DEBUG_KMS("%s\n", __FILE__);
- return fimd_power_on(ctx, false); + return fimd_activate(ctx, false); }
static int fimd_runtime_resume(struct device *dev) @@ -973,7 +993,7 @@ static int fimd_runtime_resume(struct device *dev)
DRM_DEBUG_KMS("%s\n", __FILE__);
- return fimd_power_on(ctx, true); + return fimd_activate(ctx, true); } #endif
it doesn't need that display power is controlled by encoder's dpms so moves it into connector module so that the display power can be controlled by connector's dpms propely.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_connector.c | 11 ++++++++++- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 21 --------------------- 2 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 65acf0d..d2ac6ed 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -226,11 +226,20 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { .best_encoder = exynos_drm_best_encoder, };
+static void exynos_drm_display_power(struct drm_encoder *encoder, int mode) +{ + struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); + struct exynos_drm_display_ops *display_ops = manager->display_ops; + + if (display_ops && display_ops->power_on) + display_ops->power_on(manager->dev, mode); +} + static void exynos_drm_connector_dpms(struct drm_connector *connector, int mode) { DRM_DEBUG_KMS("%s\n", __FILE__);
- /* drm framework doesn't check NULL. */ + exynos_drm_display_power(connector->encoder, mode); }
static int exynos_drm_connector_fill_modes(struct drm_connector *connector, diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 3dae250..7da5714 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -49,25 +49,6 @@ struct exynos_drm_encoder { int dpms; };
-static void exynos_drm_display_power(struct drm_encoder *encoder, int mode) -{ - struct drm_device *dev = encoder->dev; - struct drm_connector *connector; - struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); - - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - if (connector->encoder == encoder) { - struct exynos_drm_display_ops *display_ops = - manager->display_ops; - - DRM_DEBUG_KMS("connector[%d] dpms[%d]\n", - connector->base.id, mode); - if (display_ops && display_ops->power_on) - display_ops->power_on(manager->dev, mode); - } - } -} - static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) { struct drm_device *dev = encoder->dev; @@ -88,13 +69,11 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) case DRM_MODE_DPMS_ON: if (manager_ops && manager_ops->apply) manager_ops->apply(manager->dev); - exynos_drm_display_power(encoder, mode); exynos_encoder->dpms = mode; break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - exynos_drm_display_power(encoder, mode); exynos_encoder->dpms = mode; break; default:
the values set to registers will be updated into real registers at vsync so dma operation could be malfunctioned when accessed to memory after gem buffer was released. this patch makes sure that hw overlay is disabled before the gem buffer is released.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 17 +++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 10 ++++++++++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 ++++++++++++ 3 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 24c45d8..00e4bdc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -37,6 +37,20 @@ #define MAX_FB_BUFFER 4 #define DEFAULT_ZPOS -1
+#define _wait_for(COND, MS) ({ \ + unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \ + int ret__ = 0; \ + while (!(COND)) { \ + if (time_after(jiffies, timeout__)) { \ + ret__ = -ETIMEDOUT; \ + break; \ + } \ + } \ + ret__; \ +}) + +#define wait_for(COND, MS) _wait_for(COND, MS) + struct drm_device; struct exynos_drm_overlay; struct drm_connector; @@ -61,6 +75,8 @@ enum exynos_drm_output_type { * @commit: apply hardware specific overlay data to registers. * @enable: enable hardware specific overlay. * @disable: disable hardware specific overlay. + * @wait_for_vblank: wait for vblank interrupt to make sure that + * dma transfer is completed. */ struct exynos_drm_overlay_ops { void (*mode_set)(struct device *subdrv_dev, @@ -68,6 +84,7 @@ struct exynos_drm_overlay_ops { void (*commit)(struct device *subdrv_dev, int zpos); void (*enable)(struct device *subdrv_dev, int zpos); void (*disable)(struct device *subdrv_dev, int zpos); + void (*wait_for_vblank)(struct device *subdrv_dev); };
/* diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 7da5714..a562a94 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -399,4 +399,14 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
if (overlay_ops && overlay_ops->disable) overlay_ops->disable(manager->dev, zpos); + + /* + * wait for vblank interrupt + * - with iommu, the dma operation could induce page fault + * when accessed to memory after gem buffer was released so + * make sure that the dma operation is completed before releasing + * the gem bufer. + */ + if (overlay_ops->wait_for_vblank) + overlay_ops->wait_for_vblank(manager->dev); } diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 0ec9d86..2378d80 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -570,10 +570,22 @@ static void fimd_win_disable(struct device *dev, int zpos) win_data->enabled = false; }
+static void fimd_wait_for_vblank(struct device *dev) +{ + struct fimd_context *ctx = get_fimd_context(dev); + int ret; + + ret = wait_for((__raw_readl(ctx->regs + VIDCON1) & + VIDCON1_VSTATUS_BACKPORCH), 50); + if (ret < 0) + DRM_DEBUG_KMS("vblank wait timed out.\n"); +} + static struct exynos_drm_overlay_ops fimd_overlay_ops = { .mode_set = fimd_win_mode_set, .commit = fimd_win_commit, .disable = fimd_win_disable, + .wait_for_vblank = fimd_wait_for_vblank, };
static struct exynos_drm_manager fimd_manager = {
On 08/17/2012 06:50 PM, Inki Dae wrote:
the values set to registers will be updated into real registers at vsync so dma operation could be malfunctioned when accessed to memory after gem buffer was released. this patch makes sure that hw overlay is disabled before the gem buffer is released.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_drv.h | 17 +++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 10 ++++++++++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 ++++++++++++
Please split patch to exynos_drm part and fimd part.
3 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 24c45d8..00e4bdc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -37,6 +37,20 @@ #define MAX_FB_BUFFER 4 #define DEFAULT_ZPOS -1
+#define _wait_for(COND, MS) ({ \
- unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \
- int ret__ = 0; \
- while (!(COND)) { \
if (time_after(jiffies, timeout__)) { \
ret__ = -ETIMEDOUT; \
break; \
} \
- } \
- ret__; \
+})
+#define wait_for(COND, MS) _wait_for(COND, MS)
- struct drm_device; struct exynos_drm_overlay; struct drm_connector;
@@ -61,6 +75,8 @@ enum exynos_drm_output_type {
- @commit: apply hardware specific overlay data to registers.
- @enable: enable hardware specific overlay.
- @disable: disable hardware specific overlay.
- @wait_for_vblank: wait for vblank interrupt to make sure that
*/ struct exynos_drm_overlay_ops { void (*mode_set)(struct device *subdrv_dev,
- dma transfer is completed.
@@ -68,6 +84,7 @@ struct exynos_drm_overlay_ops { void (*commit)(struct device *subdrv_dev, int zpos); void (*enable)(struct device *subdrv_dev, int zpos); void (*disable)(struct device *subdrv_dev, int zpos);
void (*wait_for_vblank)(struct device *subdrv_dev); };
/*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 7da5714..a562a94 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -399,4 +399,14 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
if (overlay_ops && overlay_ops->disable) overlay_ops->disable(manager->dev, zpos);
- /*
* wait for vblank interrupt
* - with iommu, the dma operation could induce page fault
* when accessed to memory after gem buffer was released so
* make sure that the dma operation is completed before releasing
* the gem bufer.
*/
- if (overlay_ops->wait_for_vblank)
}overlay_ops->wait_for_vblank(manager->dev);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 0ec9d86..2378d80 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -570,10 +570,22 @@ static void fimd_win_disable(struct device *dev, int zpos) win_data->enabled = false; }
+static void fimd_wait_for_vblank(struct device *dev) +{
- struct fimd_context *ctx = get_fimd_context(dev);
- int ret;
- ret = wait_for((__raw_readl(ctx->regs + VIDCON1) &
VIDCON1_VSTATUS_BACKPORCH), 50);
- if (ret < 0)
DRM_DEBUG_KMS("vblank wait timed out.\n");
+}
static struct exynos_drm_overlay_ops fimd_overlay_ops = { .mode_set = fimd_win_mode_set, .commit = fimd_win_commit, .disable = fimd_win_disable,
.wait_for_vblank = fimd_wait_for_vblank, };
static struct exynos_drm_manager fimd_manager = {
this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 +++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- 4 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ccfe43..2d1bc3a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -41,10 +41,12 @@ * exynos specific framebuffer structure. * * @fb: drm framebuffer obejct. + * @buf_cnt: a buffer count to drm framebuffer. * @exynos_gem_obj: array of exynos specific gem object containing a gem object. */ struct exynos_drm_fb { struct drm_framebuffer fb; + unsigned int buf_cnt; struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER]; };
@@ -101,6 +103,25 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = { .dirty = exynos_drm_fb_dirty, };
+void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb, + unsigned int cnt) +{ + struct exynos_drm_fb *exynos_fb; + + exynos_fb = to_exynos_fb(fb); + + exynos_fb->buf_cnt = cnt; +} + +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) +{ + struct exynos_drm_fb *exynos_fb; + + exynos_fb = to_exynos_fb(fb); + + return exynos_fb->buf_cnt; +} + struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd, @@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return &exynos_fb->fb; }
+static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) +{ + unsigned int cnt = 0; + + if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT) + return 2; + + while (cnt != MAX_FB_BUFFER) { + if (!mode_cmd->handles[cnt]) + break; + cnt++; + } + + /* + * check if NV12 or NV12M. + * + * NV12 + * handles[0] = base1, offsets[0] = 0 + * handles[1] = base1, offsets[1] = Y_size + * + * NV12M + * handles[0] = base1, offsets[0] = 0 + * handles[1] = base2, offsets[1] = 0 + */ + if (cnt == 2) { + /* + * in case of NV12 format, offsets[1] is not 0 and + * handles[0] is same as handles[1]. + */ + if (mode_cmd->offsets[1] && + mode_cmd->handles[0] == mode_cmd->handles[1]) + cnt = 1; + } + + return cnt; +} + static struct drm_framebuffer * exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd) @@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_gem_object *obj; struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb; - int nr; int i;
DRM_DEBUG_KMS("%s\n", __FILE__); @@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, }
exynos_fb = to_exynos_fb(fb); - nr = exynos_drm_format_num_buffers(fb->pixel_format); + exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd); + + DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
- for (i = 1; i < nr; i++) { + for (i = 1; i < exynos_fb->buf_cnt; i++) { obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); if (!obj) { diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 5082375..96262e5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -28,19 +28,6 @@ #ifndef _EXYNOS_DRM_FB_H_ #define _EXYNOS_DRM_FB_H
-static inline int exynos_drm_format_num_buffers(uint32_t format) -{ - switch (format) { - case DRM_FORMAT_NV12: - case DRM_FORMAT_NV12MT: - return 2; - case DRM_FORMAT_YUV420: - return 3; - default: - return 1; - } -} - struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd, @@ -52,4 +39,11 @@ struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb,
void exynos_drm_mode_config_init(struct drm_device *dev);
+/* set a buffer count to drm framebuffer. */ +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb, + unsigned int cnt); + +/* get a buffer count to drm framebuffer. */ +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb); + #endif diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..5b125fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; }
+ /* buffer count to framebuffer always is 1 at booting time. */ + exynos_drm_fb_set_buf_cnt(fb, 1); + offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset += fbi->var.yoffset * fb->pitches[0];
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b89829e..777e142 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
- nr = exynos_drm_format_num_buffers(fb->pixel_format); + nr = exynos_drm_fb_get_buf_cnt(fb); for (i = 0; i < nr; i++) { struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 +++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- 4 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ccfe43..2d1bc3a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -41,10 +41,12 @@
- exynos specific framebuffer structure.
- @fb: drm framebuffer obejct.
*/ struct exynos_drm_fb { struct drm_framebuffer fb;
- @buf_cnt: a buffer count to drm framebuffer.
- @exynos_gem_obj: array of exynos specific gem object containing a gem object.
- unsigned int buf_cnt; struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER]; };
@@ -101,6 +103,25 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = { .dirty = exynos_drm_fb_dirty, };
+void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt)
+{
- struct exynos_drm_fb *exynos_fb;
- exynos_fb = to_exynos_fb(fb);
- exynos_fb->buf_cnt = cnt;
+}
+unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) +{
- struct exynos_drm_fb *exynos_fb;
- exynos_fb = to_exynos_fb(fb);
- return exynos_fb->buf_cnt;
+}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return &exynos_fb->fb; }
+static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) +{
- unsigned int cnt = 0;
- if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT)
return 2;
- while (cnt != MAX_FB_BUFFER) {
if (!mode_cmd->handles[cnt])
break;
cnt++;
- }
- /*
* check if NV12 or NV12M.
*
* NV12
* handles[0] = base1, offsets[0] = 0
* handles[1] = base1, offsets[1] = Y_size
*
* NV12M
* handles[0] = base1, offsets[0] = 0
* handles[1] = base2, offsets[1] = 0
*/
- if (cnt == 2) {
/*
* in case of NV12 format, offsets[1] is not 0 and
* handles[0] is same as handles[1].
*/
if (mode_cmd->offsets[1] &&
mode_cmd->handles[0] == mode_cmd->handles[1])
cnt = 1;
- }
- return cnt;
+}
No, please don't add specific function. There is already drm_format_num_planes() function
- static struct drm_framebuffer * exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd)
@@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_gem_object *obj; struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb;
int nr; int i;
DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, }
exynos_fb = to_exynos_fb(fb);
- nr = exynos_drm_format_num_buffers(fb->pixel_format);
- exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
- DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
- for (i = 1; i < nr; i++) {
- for (i = 1; i < exynos_fb->buf_cnt; i++) { obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); if (!obj) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 5082375..96262e5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -28,19 +28,6 @@ #ifndef _EXYNOS_DRM_FB_H_ #define _EXYNOS_DRM_FB_H
-static inline int exynos_drm_format_num_buffers(uint32_t format) -{
- switch (format) {
- case DRM_FORMAT_NV12:
- case DRM_FORMAT_NV12MT:
return 2;
- case DRM_FORMAT_YUV420:
return 3;
- default:
return 1;
- }
-}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -52,4 +39,11 @@ struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb,
void exynos_drm_mode_config_init(struct drm_device *dev);
+/* set a buffer count to drm framebuffer. */ +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt);
+/* get a buffer count to drm framebuffer. */ +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb);
- #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..5b125fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; }
- /* buffer count to framebuffer always is 1 at booting time. */
- exynos_drm_fb_set_buf_cnt(fb, 1);
- offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset += fbi->var.yoffset * fb->pitches[0];
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b89829e..777e142 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
- nr = exynos_drm_format_num_buffers(fb->pixel_format);
- nr = exynos_drm_fb_get_buf_cnt(fb); for (i = 0; i < nr; i++) { struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 +++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- 4 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ccfe43..2d1bc3a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -41,10 +41,12 @@
- exynos specific framebuffer structure.
- @fb: drm framebuffer obejct.
- @buf_cnt: a buffer count to drm framebuffer.
- @exynos_gem_obj: array of exynos specific gem object containing a gem
object. */ struct exynos_drm_fb { struct drm_framebuffer fb;
}; @@ -101,6 +103,25 @@ static struct drm_framebuffer_funcsunsigned int buf_cnt; struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER];
exynos_drm_fb_funcs = { .dirty = exynos_drm_fb_dirty, }; +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt)
+{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
exynos_fb->buf_cnt = cnt;
+}
+unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) +{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
return exynos_fb->buf_cnt;
+}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return &exynos_fb->fb; } +static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) +{
unsigned int cnt = 0;
if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT)
return 2;
while (cnt != MAX_FB_BUFFER) {
if (!mode_cmd->handles[cnt])
break;
cnt++;
}
/*
* check if NV12 or NV12M.
*
* NV12
* handles[0] = base1, offsets[0] = 0
* handles[1] = base1, offsets[1] = Y_size
*
* NV12M
* handles[0] = base1, offsets[0] = 0
* handles[1] = base2, offsets[1] = 0
*/
if (cnt == 2) {
/*
* in case of NV12 format, offsets[1] is not 0 and
* handles[0] is same as handles[1].
*/
if (mode_cmd->offsets[1] &&
mode_cmd->handles[0] == mode_cmd->handles[1])
cnt = 1;
}
return cnt;
+}
No, please don't add specific function. There is already drm_format_num_planes() function
I know that, but NV12M format is specific to Exynos. for this, we already had a discussion and you can refer to below link, http://web.archiveorange.com/archive/v/hhSc5JAv767vo7fKZLPf
- static struct drm_framebuffer * exynos_user_fb_create(struct drm_device *dev, struct drm_file
*file_priv, struct drm_mode_fb_cmd2 *mode_cmd) @@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_gem_object *obj; struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb;
int nr; int i; DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, } exynos_fb = to_exynos_fb(fb);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
for (i = 1; i < nr; i++) {
for (i = 1; i < exynos_fb->buf_cnt; i++) { obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); if (!obj) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 5082375..96262e5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -28,19 +28,6 @@ #ifndef _EXYNOS_DRM_FB_H_ #define _EXYNOS_DRM_FB_H -static inline int exynos_drm_format_num_buffers(uint32_t format) -{
switch (format) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV12MT:
return 2;
case DRM_FORMAT_YUV420:
return 3;
default:
return 1;
}
-}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -52,4 +39,11 @@ struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb, void exynos_drm_mode_config_init(struct drm_device *dev); +/* set a buffer count to drm framebuffer. */ +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt);
+/* get a buffer count to drm framebuffer. */ +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb);
- #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..5b125fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; }
/* buffer count to framebuffer always is 1 at booting time. */
exynos_drm_fb_set_buf_cnt(fb, 1);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.coffset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset += fbi->var.yoffset * fb->pitches[0];
b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b89829e..777e142 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
nr = exynos_drm_fb_get_buf_cnt(fb); for (i = 0; i < nr; i++) { struct exynos_drm_gem_buf *buffer =
exynos_drm_fb_buffer(fb, i);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On 08/20/2012 11:23 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 +++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- 4 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ccfe43..2d1bc3a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -41,10 +41,12 @@ * exynos specific framebuffer structure. * * @fb: drm framebuffer obejct.
- @buf_cnt: a buffer count to drm framebuffer.
- @exynos_gem_obj: array of exynos specific gem object containing a gem
object. */ struct exynos_drm_fb { struct drm_framebuffer fb;
}; @@ -101,6 +103,25 @@ static struct drm_framebuffer_funcsunsigned int buf_cnt; struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER];
exynos_drm_fb_funcs = { .dirty = exynos_drm_fb_dirty, }; +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt)
+{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
exynos_fb->buf_cnt = cnt;
+}
+unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) +{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
return exynos_fb->buf_cnt;
+}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return &exynos_fb->fb; } +static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) +{
unsigned int cnt = 0;
if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT)
return 2;
while (cnt != MAX_FB_BUFFER) {
if (!mode_cmd->handles[cnt])
break;
cnt++;
}
/*
* check if NV12 or NV12M.
*
* NV12
* handles[0] = base1, offsets[0] = 0
* handles[1] = base1, offsets[1] = Y_size
*
* NV12M
* handles[0] = base1, offsets[0] = 0
* handles[1] = base2, offsets[1] = 0
*/
if (cnt == 2) {
/*
* in case of NV12 format, offsets[1] is not 0 and
* handles[0] is same as handles[1].
*/
if (mode_cmd->offsets[1] &&
mode_cmd->handles[0] == mode_cmd->handles[1])
cnt = 1;
}
return cnt;
+}
No, please don't add specific function. There is already drm_format_num_planes() function
I know that, but NV12M format is specific to Exynos. for this, we already had a discussion and you can refer to below link, http://web.archiveorange.com/archive/v/hhSc5JAv767vo7fKZLPf
Yes, but this implementation is not clear, just get plane number using drm_format_num_planes() and check handle and offset argument when format is NV12.
- static struct drm_framebuffer * exynos_user_fb_create(struct drm_device *dev, struct drm_file
*file_priv, struct drm_mode_fb_cmd2 *mode_cmd) @@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_gem_object *obj; struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb;
int nr; int i; DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, } exynos_fb = to_exynos_fb(fb);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
for (i = 1; i < nr; i++) {
for (i = 1; i < exynos_fb->buf_cnt; i++) { obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); if (!obj) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 5082375..96262e5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -28,19 +28,6 @@ #ifndef _EXYNOS_DRM_FB_H_ #define _EXYNOS_DRM_FB_H -static inline int exynos_drm_format_num_buffers(uint32_t format) -{
switch (format) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV12MT:
return 2;
case DRM_FORMAT_YUV420:
return 3;
default:
return 1;
}
-}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -52,4 +39,11 @@ struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb, void exynos_drm_mode_config_init(struct drm_device *dev); +/* set a buffer count to drm framebuffer. */ +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt);
+/* get a buffer count to drm framebuffer. */ +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb);
- #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..5b125fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; }
/* buffer count to framebuffer always is 1 at booting time. */
exynos_drm_fb_set_buf_cnt(fb, 1);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.coffset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset += fbi->var.yoffset * fb->pitches[0];
b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b89829e..777e142 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
nr = exynos_drm_fb_get_buf_cnt(fb); for (i = 0; i < nr; i++) { struct exynos_drm_gem_buf *buffer =
exynos_drm_fb_buffer(fb, i);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:23 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 +++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- 4 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ccfe43..2d1bc3a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -41,10 +41,12 @@ * exynos specific framebuffer structure. * * @fb: drm framebuffer obejct.
- @buf_cnt: a buffer count to drm framebuffer.
- @exynos_gem_obj: array of exynos specific gem object containing a
gem object. */ struct exynos_drm_fb { struct drm_framebuffer fb;
}; @@ -101,6 +103,25 @@ static struct drm_framebuffer_funcsunsigned int buf_cnt; struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER];
exynos_drm_fb_funcs = { .dirty = exynos_drm_fb_dirty, }; +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt)
+{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
exynos_fb->buf_cnt = cnt;
+}
+unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) +{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
return exynos_fb->buf_cnt;
+}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return &exynos_fb->fb; } +static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) +{
unsigned int cnt = 0;
if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT)
return 2;
while (cnt != MAX_FB_BUFFER) {
if (!mode_cmd->handles[cnt])
break;
cnt++;
}
/*
* check if NV12 or NV12M.
*
* NV12
* handles[0] = base1, offsets[0] = 0
* handles[1] = base1, offsets[1] = Y_size
*
* NV12M
* handles[0] = base1, offsets[0] = 0
* handles[1] = base2, offsets[1] = 0
*/
if (cnt == 2) {
/*
* in case of NV12 format, offsets[1] is not 0 and
* handles[0] is same as handles[1].
*/
if (mode_cmd->offsets[1] &&
mode_cmd->handles[0] == mode_cmd->handles[1])
cnt = 1;
}
return cnt;
+}
No, please don't add specific function. There is already drm_format_num_planes() function
I know that, but NV12M format is specific to Exynos. for this, we already had a discussion and you can refer to below link, http://web.archiveorange.com/archive/v/hhSc5JAv767vo7fKZLPf
Yes, but this implementation is not clear, just get plane number using drm_format_num_planes() and check handle and offset argument when format is NV12.
drm_format_num_planes() doesn't include NV12MT format type so first that format should be added and then we can get plane count using drm_format_num_planes if not NV12. but if not, exynos_drm_format_num_buffers() like below,
if (mode_cmd == DRM_FORMAT_NV12)
- static struct drm_framebuffer * exynos_user_fb_create(struct drm_device *dev, struct drm_file
*file_priv, struct drm_mode_fb_cmd2 *mode_cmd) @@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_gem_object *obj; struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb;
int nr; int i; DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, } exynos_fb = to_exynos_fb(fb);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
for (i = 1; i < nr; i++) {
for (i = 1; i < exynos_fb->buf_cnt; i++) { obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); if (!obj) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 5082375..96262e5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -28,19 +28,6 @@ #ifndef _EXYNOS_DRM_FB_H_ #define _EXYNOS_DRM_FB_H -static inline int exynos_drm_format_num_buffers(uint32_t format) -{
switch (format) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV12MT:
return 2;
case DRM_FORMAT_YUV420:
return 3;
default:
return 1;
}
-}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -52,4 +39,11 @@ struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb, void exynos_drm_mode_config_init(struct drm_device *dev); +/* set a buffer count to drm framebuffer. */ +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt);
+/* get a buffer count to drm framebuffer. */ +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb);
- #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..5b125fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; }
/* buffer count to framebuffer always is 1 at booting time. */
exynos_drm_fb_set_buf_cnt(fb, 1);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.coffset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset += fbi->var.yoffset * fb->pitches[0];
b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b89829e..777e142 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
nr = exynos_drm_fb_get_buf_cnt(fb); for (i = 0; i < nr; i++) { struct exynos_drm_gem_buf *buffer =
exynos_drm_fb_buffer(fb, i);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
sorry, again.
2012/8/20 InKi Dae inki.dae@samsung.com:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:23 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 +++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- 4 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ccfe43..2d1bc3a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -41,10 +41,12 @@ * exynos specific framebuffer structure. * * @fb: drm framebuffer obejct.
- @buf_cnt: a buffer count to drm framebuffer.
- @exynos_gem_obj: array of exynos specific gem object containing a
gem object. */ struct exynos_drm_fb { struct drm_framebuffer fb;
}; @@ -101,6 +103,25 @@ static struct drm_framebuffer_funcsunsigned int buf_cnt; struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER];
exynos_drm_fb_funcs = { .dirty = exynos_drm_fb_dirty, }; +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt)
+{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
exynos_fb->buf_cnt = cnt;
+}
+unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) +{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
return exynos_fb->buf_cnt;
+}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return &exynos_fb->fb; } +static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) +{
unsigned int cnt = 0;
if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT)
return 2;
while (cnt != MAX_FB_BUFFER) {
if (!mode_cmd->handles[cnt])
break;
cnt++;
}
/*
* check if NV12 or NV12M.
*
* NV12
* handles[0] = base1, offsets[0] = 0
* handles[1] = base1, offsets[1] = Y_size
*
* NV12M
* handles[0] = base1, offsets[0] = 0
* handles[1] = base2, offsets[1] = 0
*/
if (cnt == 2) {
/*
* in case of NV12 format, offsets[1] is not 0 and
* handles[0] is same as handles[1].
*/
if (mode_cmd->offsets[1] &&
mode_cmd->handles[0] == mode_cmd->handles[1])
cnt = 1;
}
return cnt;
+}
No, please don't add specific function. There is already drm_format_num_planes() function
I know that, but NV12M format is specific to Exynos. for this, we already had a discussion and you can refer to below link, http://web.archiveorange.com/archive/v/hhSc5JAv767vo7fKZLPf
Yes, but this implementation is not clear, just get plane number using drm_format_num_planes() and check handle and offset argument when format is NV12.
drm_format_num_planes() doesn't include NV12MT format type so first that format should be added and then we can get plane count using drm_format_num_planes if not NV12. but if not, exynos_drm_format_num_buffers() like below,
if (mode_cmd == DRM_FORMAT_NV12)
if (mode_cmd->pixel_format == DRM_FORMAT_NV12) exynos_fb->buf_cnt = exynos_drm_format_num_buffers(dev, ...); else exynos_fb->buf_cnt = drm_format_num_planes(....);
- static struct drm_framebuffer * exynos_user_fb_create(struct drm_device *dev, struct drm_file
*file_priv, struct drm_mode_fb_cmd2 *mode_cmd) @@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_gem_object *obj; struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb;
int nr; int i; DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, } exynos_fb = to_exynos_fb(fb);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
for (i = 1; i < nr; i++) {
for (i = 1; i < exynos_fb->buf_cnt; i++) { obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); if (!obj) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 5082375..96262e5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -28,19 +28,6 @@ #ifndef _EXYNOS_DRM_FB_H_ #define _EXYNOS_DRM_FB_H -static inline int exynos_drm_format_num_buffers(uint32_t format) -{
switch (format) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV12MT:
return 2;
case DRM_FORMAT_YUV420:
return 3;
default:
return 1;
}
-}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -52,4 +39,11 @@ struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb, void exynos_drm_mode_config_init(struct drm_device *dev); +/* set a buffer count to drm framebuffer. */ +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt);
+/* get a buffer count to drm framebuffer. */ +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb);
- #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..5b125fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; }
/* buffer count to framebuffer always is 1 at booting time. */
exynos_drm_fb_set_buf_cnt(fb, 1);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.coffset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset += fbi->var.yoffset * fb->pitches[0];
b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b89829e..777e142 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
nr = exynos_drm_fb_get_buf_cnt(fb); for (i = 0; i < nr; i++) { struct exynos_drm_gem_buf *buffer =
exynos_drm_fb_buffer(fb, i);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On 08/20/2012 02:15 PM, InKi Dae wrote:
sorry, again.
2012/8/20 InKi Dae inki.dae@samsung.com:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:23 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch adds buf_cnt variable in exynos_drm_fb structure and that means a buffer count to drm framebuffer and also adds two functions to get/set the buffer count from/to exynos_drm_fb structure. if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count to drm framebuffer refering to mode_cmd->handles and offsets. but when booted, the buffer count will always be 1 because pixel format of console framebuffer is RGB format.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_fb.c | 65
+++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- 4 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ccfe43..2d1bc3a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -41,10 +41,12 @@ * exynos specific framebuffer structure. * * @fb: drm framebuffer obejct.
- @buf_cnt: a buffer count to drm framebuffer.
- @exynos_gem_obj: array of exynos specific gem object containing a
gem object. */ struct exynos_drm_fb { struct drm_framebuffer fb;
}; @@ -101,6 +103,25 @@ static struct drm_framebuffer_funcsunsigned int buf_cnt; struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER];
exynos_drm_fb_funcs = { .dirty = exynos_drm_fb_dirty, }; +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt)
+{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
exynos_fb->buf_cnt = cnt;
+}
+unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) +{
struct exynos_drm_fb *exynos_fb;
exynos_fb = to_exynos_fb(fb);
return exynos_fb->buf_cnt;
+}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return &exynos_fb->fb; } +static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) +{
unsigned int cnt = 0;
if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT)
return 2;
while (cnt != MAX_FB_BUFFER) {
if (!mode_cmd->handles[cnt])
break;
cnt++;
}
/*
* check if NV12 or NV12M.
*
* NV12
* handles[0] = base1, offsets[0] = 0
* handles[1] = base1, offsets[1] = Y_size
*
* NV12M
* handles[0] = base1, offsets[0] = 0
* handles[1] = base2, offsets[1] = 0
*/
if (cnt == 2) {
/*
* in case of NV12 format, offsets[1] is not 0 and
* handles[0] is same as handles[1].
*/
if (mode_cmd->offsets[1] &&
mode_cmd->handles[0] == mode_cmd->handles[1])
cnt = 1;
}
return cnt;
+}
No, please don't add specific function. There is already drm_format_num_planes() function
I know that, but NV12M format is specific to Exynos. for this, we already had a discussion and you can refer to below link, http://web.archiveorange.com/archive/v/hhSc5JAv767vo7fKZLPf
Yes, but this implementation is not clear, just get plane number using drm_format_num_planes() and check handle and offset argument when format is NV12.
drm_format_num_planes() doesn't include NV12MT format type so first that format should be added and then we can get plane count using drm_format_num_planes if not NV12. but if not, exynos_drm_format_num_buffers() like below,
if (mode_cmd == DRM_FORMAT_NV12)
if (mode_cmd->pixel_format == DRM_FORMAT_NV12) exynos_fb->buf_cnt = exynos_drm_format_num_buffers(dev, ...); else exynos_fb->buf_cnt = drm_format_num_planes(....);
I think that just reuse exynos_drm_format_num_buffers(), and call drm_format_num_planes() and check NV12 format in that function.
- static struct drm_framebuffer * exynos_user_fb_create(struct drm_device *dev, struct drm_file
*file_priv, struct drm_mode_fb_cmd2 *mode_cmd) @@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_gem_object *obj; struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb;
int nr; int i; DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, } exynos_fb = to_exynos_fb(fb);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
for (i = 1; i < nr; i++) {
for (i = 1; i < exynos_fb->buf_cnt; i++) { obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[i]); if (!obj) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 5082375..96262e5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -28,19 +28,6 @@ #ifndef _EXYNOS_DRM_FB_H_ #define _EXYNOS_DRM_FB_H -static inline int exynos_drm_format_num_buffers(uint32_t format) -{
switch (format) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV12MT:
return 2;
case DRM_FORMAT_YUV420:
return 3;
default:
return 1;
}
-}
- struct drm_framebuffer * exynos_drm_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -52,4 +39,11 @@ struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb, void exynos_drm_mode_config_init(struct drm_device *dev); +/* set a buffer count to drm framebuffer. */ +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb,
unsigned int cnt);
+/* get a buffer count to drm framebuffer. */ +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb);
- #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..5b125fe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; } + /* buffer count to framebuffer always is 1 at booting time. */
exynos_drm_fb_set_buf_cnt(fb, 1);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.coffset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset += fbi->var.yoffset * fb->pitches[0];
b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b89829e..777e142 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - nr = exynos_drm_format_num_buffers(fb->pixel_format);
nr = exynos_drm_fb_get_buf_cnt(fb); for (i = 0; i < nr; i++) { struct exynos_drm_gem_buf *buffer =
exynos_drm_fb_buffer(fb, i);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 02:15 PM, InKi Dae wrote:
sorry, again.
2012/8/20 InKi Dae inki.dae@samsung.com:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:23 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote: > > this patch adds buf_cnt variable in exynos_drm_fb structure and > that means a buffer count to drm framebuffer and also adds two > functions to get/set the buffer count from/to exynos_drm_fb > structure. > if pixel format is not DRM_FORMAT_NV12MT then it gets a buffer count > to drm framebuffer refering to mode_cmd->handles and offsets. > but when booted, the buffer count will always be 1 because pixel > format of console framebuffer is RGB format. > > Signed-off-by: Inki Dae inki.dae@samsung.com > Signed-off-by: Kyungmin Park kyungmin.park@samsung.com > --- > drivers/gpu/drm/exynos/exynos_drm_fb.c | 65 > +++++++++++++++++++++++++++- > drivers/gpu/drm/exynos/exynos_drm_fb.h | 20 +++------ > drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 + > drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- > 4 files changed, 73 insertions(+), 17 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c > b/drivers/gpu/drm/exynos/exynos_drm_fb.c > index 4ccfe43..2d1bc3a 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c > @@ -41,10 +41,12 @@ > * exynos specific framebuffer structure. > * > * @fb: drm framebuffer obejct. > + * @buf_cnt: a buffer count to drm framebuffer. > * @exynos_gem_obj: array of exynos specific gem object > containing a > gem > object. > */ > struct exynos_drm_fb { > struct drm_framebuffer fb; > + unsigned int buf_cnt; > struct exynos_drm_gem_obj > *exynos_gem_obj[MAX_FB_BUFFER]; > }; > @@ -101,6 +103,25 @@ static struct drm_framebuffer_funcs > exynos_drm_fb_funcs = { > .dirty = exynos_drm_fb_dirty, > }; > +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb, > + unsigned int cnt) > +{ > + struct exynos_drm_fb *exynos_fb; > + > + exynos_fb = to_exynos_fb(fb); > + > + exynos_fb->buf_cnt = cnt; > +} > + > +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) > +{ > + struct exynos_drm_fb *exynos_fb; > + > + exynos_fb = to_exynos_fb(fb); > + > + return exynos_fb->buf_cnt; > +} > + > struct drm_framebuffer * > exynos_drm_framebuffer_init(struct drm_device *dev, > struct drm_mode_fb_cmd2 *mode_cmd, > @@ -127,6 +148,43 @@ exynos_drm_framebuffer_init(struct drm_device > *dev, > return &exynos_fb->fb; > } > +static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 > *mode_cmd) > +{ > + unsigned int cnt = 0; > + > + if (mode_cmd->pixel_format == DRM_FORMAT_NV12MT) > + return 2; > + > + while (cnt != MAX_FB_BUFFER) { > + if (!mode_cmd->handles[cnt]) > + break; > + cnt++; > + } > + > + /* > + * check if NV12 or NV12M. > + * > + * NV12 > + * handles[0] = base1, offsets[0] = 0 > + * handles[1] = base1, offsets[1] = Y_size > + * > + * NV12M > + * handles[0] = base1, offsets[0] = 0 > + * handles[1] = base2, offsets[1] = 0 > + */ > + if (cnt == 2) { > + /* > + * in case of NV12 format, offsets[1] is not 0 and > + * handles[0] is same as handles[1]. > + */ > + if (mode_cmd->offsets[1] && > + mode_cmd->handles[0] == mode_cmd->handles[1]) > + cnt = 1; > + } > + > + return cnt; > +}
No, please don't add specific function. There is already drm_format_num_planes() function
I know that, but NV12M format is specific to Exynos. for this, we already had a discussion and you can refer to below link, http://web.archiveorange.com/archive/v/hhSc5JAv767vo7fKZLPf
Yes, but this implementation is not clear, just get plane number using drm_format_num_planes() and check handle and offset argument when format is NV12.
drm_format_num_planes() doesn't include NV12MT format type so first that format should be added and then we can get plane count using drm_format_num_planes if not NV12. but if not, exynos_drm_format_num_buffers() like below,
if (mode_cmd == DRM_FORMAT_NV12)
if (mode_cmd->pixel_format == DRM_FORMAT_NV12) exynos_fb->buf_cnt = exynos_drm_format_num_buffers(dev, ...); else exynos_fb->buf_cnt = drm_format_num_planes(....);
I think that just reuse exynos_drm_format_num_buffers(), and call drm_format_num_planes() and check NV12 format in that function.
Okey~
> + > static struct drm_framebuffer * > exynos_user_fb_create(struct drm_device *dev, struct drm_file > *file_priv, > struct drm_mode_fb_cmd2 *mode_cmd) > @@ -134,7 +192,6 @@ exynos_user_fb_create(struct drm_device *dev, > struct > drm_file *file_priv, > struct drm_gem_object *obj; > struct drm_framebuffer *fb; > struct exynos_drm_fb *exynos_fb; > - int nr; > int i; > DRM_DEBUG_KMS("%s\n", __FILE__); > @@ -152,9 +209,11 @@ exynos_user_fb_create(struct drm_device *dev, > struct > drm_file *file_priv, > } > exynos_fb = to_exynos_fb(fb); > - nr = exynos_drm_format_num_buffers(fb->pixel_format); > + exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd); > + > + DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); > - for (i = 1; i < nr; i++) { > + for (i = 1; i < exynos_fb->buf_cnt; i++) { > obj = drm_gem_object_lookup(dev, file_priv, > mode_cmd->handles[i]); > if (!obj) { > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h > b/drivers/gpu/drm/exynos/exynos_drm_fb.h > index 5082375..96262e5 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h > +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h > @@ -28,19 +28,6 @@ > #ifndef _EXYNOS_DRM_FB_H_ > #define _EXYNOS_DRM_FB_H > -static inline int exynos_drm_format_num_buffers(uint32_t format) > -{ > - switch (format) { > - case DRM_FORMAT_NV12: > - case DRM_FORMAT_NV12MT: > - return 2; > - case DRM_FORMAT_YUV420: > - return 3; > - default: > - return 1; > - } > -} > - > struct drm_framebuffer * > exynos_drm_framebuffer_init(struct drm_device *dev, > struct drm_mode_fb_cmd2 *mode_cmd, > @@ -52,4 +39,11 @@ struct exynos_drm_gem_buf > *exynos_drm_fb_buffer(struct > drm_framebuffer *fb, > void exynos_drm_mode_config_init(struct drm_device *dev); > +/* set a buffer count to drm framebuffer. */ > +void exynos_drm_fb_set_buf_cnt(struct drm_framebuffer *fb, > + unsigned int cnt); > + > +/* get a buffer count to drm framebuffer. */ > +unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb); > + > #endif > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c > b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c > index d5586cc..5b125fe 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c > @@ -79,6 +79,9 @@ static int exynos_drm_fbdev_update(struct > drm_fb_helper > *helper, > return -EFAULT; > } > + /* buffer count to framebuffer always is 1 at booting time. > */ > + exynos_drm_fb_set_buf_cnt(fb, 1); > + > offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); > offset += fbi->var.yoffset * fb->pitches[0]; > diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c > b/drivers/gpu/drm/exynos/exynos_drm_plane.c > index b89829e..777e142 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c > @@ -48,7 +48,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, > struct drm_crtc *crtc, > DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); > - nr = exynos_drm_format_num_buffers(fb->pixel_format); > + nr = exynos_drm_fb_get_buf_cnt(fb); > for (i = 0; i < nr; i++) { > struct exynos_drm_gem_buf *buffer = > exynos_drm_fb_buffer(fb, i); > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
if old_crtc isn't same as encoder->crtc then it means that user changed crtc id to another one so a plane to old_crtc should be disabled so that current plane can be updated safely and plane->crtc should be set to new crtc(encoder->crtc)
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 59 +++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index a562a94..7bcace8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -44,6 +44,7 @@ * @dpms: store the encoder dpms value. */ struct exynos_drm_encoder { + struct drm_crtc *old_crtc; struct drm_encoder drm_encoder; struct exynos_drm_manager *manager; int dpms; @@ -106,22 +107,74 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, return true; }
+static void disable_plane_to_crtc(struct drm_device *dev, + struct drm_crtc *old_crtc, + struct drm_crtc *new_crtc) +{ + struct drm_plane *plane; + + /* + * if old_crtc isn't same as encoder->crtc then it means that + * user changed crtc id to another one so the plane to old_crtc + * should be disabled and plane->crtc should be set to new_crtc + * (encoder->crtc) + */ + list_for_each_entry(plane, &dev->mode_config.plane_list, head) { + if (plane->crtc == old_crtc) { + /* + * do not change below call order. + * + * plane->funcs->disable_plane call checks + * if encoder->crtc is same as plane->crtc and if same + * then overlay_ops->disable callback will be called + * to diasble current hw overlay so plane->crtc should + * have new_crtc because new_crtc was set to + * encoder->crtc in advance. + */ + plane->crtc = new_crtc; + plane->funcs->disable_plane(plane); + } + } +} + static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_device *dev = encoder->dev; struct drm_connector *connector; - struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); - struct exynos_drm_manager_ops *manager_ops = manager->ops; + struct exynos_drm_manager *manager; + struct exynos_drm_manager_ops *manager_ops;
DRM_DEBUG_KMS("%s\n", __FILE__);
list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - if (connector->encoder == encoder) + if (connector->encoder == encoder) { + struct exynos_drm_encoder *exynos_encoder; + + exynos_encoder = to_exynos_encoder(encoder); + + if (exynos_encoder->old_crtc != encoder->crtc && + exynos_encoder->old_crtc) { + + /* + * disable a plane to old crtc and change + * crtc of the plane to new one. + */ + disable_plane_to_crtc(dev, + exynos_encoder->old_crtc, + encoder->crtc); + } + + manager = exynos_drm_get_manager(encoder); + manager_ops = manager->ops; + if (manager_ops && manager_ops->mode_set) manager_ops->mode_set(manager->dev, adjusted_mode); + + exynos_encoder->old_crtc = encoder->crtc; + } } }
On 08/17/2012 06:50 PM, Inki Dae wrote:
if old_crtc isn't same as encoder->crtc then it means that user changed crtc id to another one so a plane to old_crtc should be disabled so that current plane can be updated safely and plane->crtc should be set to new crtc(encoder->crtc)
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_encoder.c | 59 +++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index a562a94..7bcace8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -44,6 +44,7 @@
- @dpms: store the encoder dpms value.
*/ struct exynos_drm_encoder {
- struct drm_crtc *old_crtc; struct drm_encoder drm_encoder; struct exynos_drm_manager *manager; int dpms;
@@ -106,22 +107,74 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, return true; }
+static void disable_plane_to_crtc(struct drm_device *dev,
struct drm_crtc *old_crtc,
struct drm_crtc *new_crtc)
+{
- struct drm_plane *plane;
- /*
* if old_crtc isn't same as encoder->crtc then it means that
* user changed crtc id to another one so the plane to old_crtc
* should be disabled and plane->crtc should be set to new_crtc
* (encoder->crtc)
*/
- list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
if (plane->crtc == old_crtc) {
/*
* do not change below call order.
*
* plane->funcs->disable_plane call checks
* if encoder->crtc is same as plane->crtc and if same
* then overlay_ops->disable callback will be called
* to diasble current hw overlay so plane->crtc should
* have new_crtc because new_crtc was set to
* encoder->crtc in advance.
*/
plane->crtc = new_crtc;
plane->funcs->disable_plane(plane);
}
- }
+}
- static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_device *dev = encoder->dev; struct drm_connector *connector;
- struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
- struct exynos_drm_manager_ops *manager_ops = manager->ops;
struct exynos_drm_manager *manager;
struct exynos_drm_manager_ops *manager_ops;
DRM_DEBUG_KMS("%s\n", __FILE__);
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if (connector->encoder == encoder)
if (connector->encoder == encoder) {
struct exynos_drm_encoder *exynos_encoder;
exynos_encoder = to_exynos_encoder(encoder);
Does needs to do this in for statement?
if (exynos_encoder->old_crtc != encoder->crtc &&
exynos_encoder->old_crtc) {
/*
* disable a plane to old crtc and change
* crtc of the plane to new one.
*/
disable_plane_to_crtc(dev,
exynos_encoder->old_crtc,
encoder->crtc);
}
manager = exynos_drm_get_manager(encoder);
manager_ops = manager->ops;
Does needs to do this in for statement?
if (manager_ops && manager_ops->mode_set) manager_ops->mode_set(manager->dev, adjusted_mode);
exynos_encoder->old_crtc = encoder->crtc;
} }}
this patch changes ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable makes it confused.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 3fdf0b6..bced38e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->is_connected) - return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx); + return hdmi_ops->is_connected(ctx->hdmi_ctx->client);
return false; } @@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->get_edid) - return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid, - len); + return hdmi_ops->get_edid(ctx->hdmi_ctx->client, connector, + edid, len);
return 0; } @@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->check_timing) - return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing); + return hdmi_ops->check_timing(ctx->hdmi_ctx->client, timing);
return 0; } @@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->power_on) - return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode); + return hdmi_ops->power_on(ctx->hdmi_ctx->client, mode);
return 0; } @@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->enable_vblank) - return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx, + return mixer_ops->enable_vblank(ctx->mixer_ctx->client, manager->pipe);
return 0; @@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->disable_vblank) - return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); + return mixer_ops->disable_vblank(ctx->mixer_ctx->client); }
static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector, - const struct drm_display_mode *mode, + struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_hdmi_context *ctx = to_context(subdrv_dev); @@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->mode_fixup) - hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode, + hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector, mode, adjusted_mode); }
@@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->mode_set) - hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode); + hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode); }
static void drm_hdmi_get_max_resol(struct device *subdrv_dev, @@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->get_max_resol) - hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height); + hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width, height); }
static void drm_hdmi_commit(struct device *subdrv_dev) @@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->commit) - hdmi_ops->commit(ctx->hdmi_ctx->ctx); + hdmi_ops->commit(ctx->hdmi_ctx->client); }
static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) @@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->dpms) - mixer_ops->dpms(ctx->mixer_ctx->ctx, mode); + mixer_ops->dpms(ctx->mixer_ctx->client, mode);
if (hdmi_ops && hdmi_ops->dpms) - hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode); + hdmi_ops->dpms(ctx->hdmi_ctx->client, mode); }
static void drm_hdmi_apply(struct device *subdrv_dev) @@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device *subdrv_dev) if (!ctx->enabled[i]) continue; if (mixer_ops && mixer_ops->win_commit) - mixer_ops->win_commit(ctx->mixer_ctx->ctx, i); + mixer_ops->win_commit(ctx->mixer_ctx->client, i); }
if (hdmi_ops && hdmi_ops->commit) - hdmi_ops->commit(ctx->hdmi_ctx->ctx); + hdmi_ops->commit(ctx->hdmi_ctx->client); }
static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { @@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->win_mode_set) - mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); + mixer_ops->win_mode_set(ctx->mixer_ctx->client, overlay); }
static void drm_mixer_commit(struct device *subdrv_dev, int zpos) @@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) }
if (mixer_ops && mixer_ops->win_commit) - mixer_ops->win_commit(ctx->mixer_ctx->ctx, win); + mixer_ops->win_commit(ctx->mixer_ctx->client, win);
ctx->enabled[win] = true; } @@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) }
if (mixer_ops && mixer_ops->win_disable) - mixer_ops->win_disable(ctx->mixer_ctx->ctx, win); + mixer_ops->win_disable(ctx->mixer_ctx->client, win);
ctx->enabled[win] = false; } diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index a91c420..237434d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -33,12 +33,12 @@ * exynos hdmi common context structure. * * @drm_dev: pointer to drm_device. - * @ctx: pointer to the context of specific device driver. + * @client: pointer to the context of specific device driver. * this context should be hdmi_context or mixer_context. */ struct exynos_drm_hdmi_context { struct drm_device *drm_dev; - void *ctx; + void *client; };
struct exynos_hdmi_ops { diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bb504cb..7538489 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg; - struct hdmi_context *hdata = ctx->ctx; + struct hdmi_context *hdata = ctx->client;
if (!hdata->get_hpd) goto out; @@ -2127,7 +2127,7 @@ out: static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg; - struct hdmi_context *hdata = ctx->ctx; + struct hdmi_context *hdata = ctx->client; u32 intc_flag;
intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); @@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
mutex_init(&hdata->hdmi_mutex);
- drm_hdmi_ctx->ctx = (void *)hdata; + drm_hdmi_ctx->client = (void *)hdata; hdata->parent_ctx = (void *)drm_hdmi_ctx;
platform_set_drvdata(pdev, drm_hdmi_ctx); @@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); - struct hdmi_context *hdata = ctx->ctx; + struct hdmi_context *hdata = ctx->client;
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
@@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) static int hdmi_suspend(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev); - struct hdmi_context *hdata = ctx->ctx; + struct hdmi_context *hdata = ctx->client;
disable_irq(hdata->internal_irq); disable_irq(hdata->external_irq); @@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) static int hdmi_resume(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev); - struct hdmi_context *hdata = ctx->ctx; + struct hdmi_context *hdata = ctx->client;
enable_irq(hdata->external_irq); enable_irq(hdata->internal_irq); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 30fcc12..d3ff595 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; - struct mixer_context *ctx = drm_hdmi_ctx->ctx; + struct mixer_context *ctx = drm_hdmi_ctx->client; struct mixer_resources *res = &ctx->mixer_res; u32 val, base, shadow;
@@ -909,7 +909,7 @@ out: static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, struct platform_device *pdev) { - struct mixer_context *mixer_ctx = ctx->ctx; + struct mixer_context *mixer_ctx = ctx->client; struct device *dev = &pdev->dev; struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; struct resource *res; @@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex);
ctx->dev = &pdev->dev; - drm_hdmi_ctx->ctx = (void *)ctx; + drm_hdmi_ctx->client = (void *)ctx;
platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -1070,7 +1070,7 @@ static int mixer_remove(struct platform_device *pdev) static int mixer_suspend(struct device *dev) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev); - struct mixer_context *ctx = drm_hdmi_ctx->ctx; + struct mixer_context *ctx = drm_hdmi_ctx->client;
mixer_poweroff(ctx);
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch changes ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable makes it confused.
I don't prefer "client" name. This is not client and server relationship.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 3fdf0b6..bced38e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->is_connected)
return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);
return hdmi_ops->is_connected(ctx->hdmi_ctx->client);
return false; }
@@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->get_edid)
return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid,
len);
return hdmi_ops->get_edid(ctx->hdmi_ctx->client, connector,
edid, len);
return 0; }
@@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);
return hdmi_ops->check_timing(ctx->hdmi_ctx->client, timing);
return 0; }
@@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->power_on)
return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
return hdmi_ops->power_on(ctx->hdmi_ctx->client, mode);
return 0; }
@@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->enable_vblank)
return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx,
return mixer_ops->enable_vblank(ctx->mixer_ctx->client, manager->pipe);
return 0;
@@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
return mixer_ops->disable_vblank(ctx->mixer_ctx->client);
}
static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector,
const struct drm_display_mode *mode,
{ struct drm_hdmi_context *ctx = to_context(subdrv_dev);struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
@@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->mode_fixup)
hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode,
}hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector, mode, adjusted_mode);
@@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode);
}
static void drm_hdmi_get_max_resol(struct device *subdrv_dev,
@@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height);
hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width, height);
}
static void drm_hdmi_commit(struct device *subdrv_dev)
@@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__);
if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
hdmi_ops->commit(ctx->hdmi_ctx->client);
}
static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)
@@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->dpms)
mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);
mixer_ops->dpms(ctx->mixer_ctx->client, mode);
if (hdmi_ops && hdmi_ops->dpms)
hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
hdmi_ops->dpms(ctx->hdmi_ctx->client, mode);
}
static void drm_hdmi_apply(struct device *subdrv_dev)
@@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device *subdrv_dev) if (!ctx->enabled[i]) continue; if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, i);
mixer_ops->win_commit(ctx->mixer_ctx->client, i);
}
if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
hdmi_ops->commit(ctx->hdmi_ctx->client);
}
static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {
@@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__);
if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
mixer_ops->win_mode_set(ctx->mixer_ctx->client, overlay);
}
static void drm_mixer_commit(struct device *subdrv_dev, int zpos)
@@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) }
if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, win);
mixer_ops->win_commit(ctx->mixer_ctx->client, win);
ctx->enabled[win] = true; }
@@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) }
if (mixer_ops && mixer_ops->win_disable)
mixer_ops->win_disable(ctx->mixer_ctx->ctx, win);
mixer_ops->win_disable(ctx->mixer_ctx->client, win);
ctx->enabled[win] = false; }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index a91c420..237434d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -33,12 +33,12 @@
- exynos hdmi common context structure.
- @drm_dev: pointer to drm_device.
- @ctx: pointer to the context of specific device driver.
*/ struct exynos_drm_hdmi_context { struct drm_device *drm_dev;
- @client: pointer to the context of specific device driver.
- this context should be hdmi_context or mixer_context.
- void *ctx;
void *client; };
struct exynos_hdmi_ops {
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bb504cb..7538489 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
- struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client;
if (!hdata->get_hpd) goto out;
@@ -2127,7 +2127,7 @@ out: static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
- struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; u32 intc_flag;
intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
@@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
mutex_init(&hdata->hdmi_mutex);
- drm_hdmi_ctx->ctx = (void *)hdata;
drm_hdmi_ctx->client = (void *)hdata; hdata->parent_ctx = (void *)drm_hdmi_ctx;
platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
- struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client;
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
@@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) static int hdmi_suspend(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
- struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client;
disable_irq(hdata->internal_irq); disable_irq(hdata->external_irq);
@@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) static int hdmi_resume(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
- struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client;
enable_irq(hdata->external_irq); enable_irq(hdata->internal_irq);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 30fcc12..d3ff595 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
- struct mixer_context *ctx = drm_hdmi_ctx->ctx;
- struct mixer_context *ctx = drm_hdmi_ctx->client; struct mixer_resources *res = &ctx->mixer_res; u32 val, base, shadow;
@@ -909,7 +909,7 @@ out: static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, struct platform_device *pdev) {
- struct mixer_context *mixer_ctx = ctx->ctx;
- struct mixer_context *mixer_ctx = ctx->client; struct device *dev = &pdev->dev; struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; struct resource *res;
@@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex);
ctx->dev = &pdev->dev;
- drm_hdmi_ctx->ctx = (void *)ctx;
drm_hdmi_ctx->client = (void *)ctx;
platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -1070,7 +1070,7 @@ static int mixer_remove(struct platform_device *pdev) static int mixer_suspend(struct device *dev) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev);
- struct mixer_context *ctx = drm_hdmi_ctx->ctx;
struct mixer_context *ctx = drm_hdmi_ctx->client;
mixer_poweroff(ctx);
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch changes ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable makes it confused.
I don't prefer "client" name. This is not client and server relationship.
Okay, give me your opinion. which one do you prefer?
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 3fdf0b6..bced38e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->is_connected)
return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);
}return hdmi_ops->is_connected(ctx->hdmi_ctx->client); return false;
@@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_edid)
return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector,
edid,
len);
return hdmi_ops->get_edid(ctx->hdmi_ctx->client,
connector,
}edid, len); return 0;
@@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);
return hdmi_ops->check_timing(ctx->hdmi_ctx->client,
timing); return 0; } @@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->power_on)
return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
}return hdmi_ops->power_on(ctx->hdmi_ctx->client, mode); return 0;
@@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->enable_vblank)
return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx,
return mixer_ops->enable_vblank(ctx->mixer_ctx->client, manager->pipe); return 0;
@@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
} static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector,return mixer_ops->disable_vblank(ctx->mixer_ctx->client);
const struct drm_display_mode *mode,
{ struct drm_hdmi_context *ctx = to_context(subdrv_dev);struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
@@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_fixup)
hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode,
hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector,
mode, adjusted_mode); } @@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_get_max_resol(struct device *subdrv_dev,hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode);
@@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width,
height);
hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width,
height); } static void drm_hdmi_commit(struct device *subdrv_dev) @@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->dpms)
mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);
mixer_ops->dpms(ctx->mixer_ctx->client, mode); if (hdmi_ops && hdmi_ops->dpms)
hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_apply(struct device *subdrv_dev)hdmi_ops->dpms(ctx->hdmi_ctx->client, mode);
@@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device *subdrv_dev) if (!ctx->enabled[i]) continue; if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, i);
mixer_ops->win_commit(ctx->mixer_ctx->client, i); } if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
} static void drm_mixer_commit(struct device *subdrv_dev, int zpos)mixer_ops->win_mode_set(ctx->mixer_ctx->client, overlay);
@@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_commit(ctx->mixer_ctx->client, win); ctx->enabled[win] = true;
@@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_disable)
mixer_ops->win_disable(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_disable(ctx->mixer_ctx->client, win); ctx->enabled[win] = false;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index a91c420..237434d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -33,12 +33,12 @@
- exynos hdmi common context structure.
- @drm_dev: pointer to drm_device.
- @ctx: pointer to the context of specific device driver.
*/ struct exynos_drm_hdmi_context { struct drm_device *drm_dev;
- @client: pointer to the context of specific device driver.
- this context should be hdmi_context or mixer_context.
void *ctx;
}; struct exynos_hdmi_ops {void *client;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bb504cb..7538489 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; if (!hdata->get_hpd) goto out;
@@ -2127,7 +2127,7 @@ out: static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; u32 intc_flag; intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
@@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) mutex_init(&hdata->hdmi_mutex);
drm_hdmi_ctx->ctx = (void *)hdata;
drm_hdmi_ctx->client = (void *)hdata; hdata->parent_ctx = (void *)drm_hdmi_ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
struct hdmi_context *hdata = ctx->ctx;
@@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(structstruct hdmi_context *hdata = ctx->client; DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
platform_device *pdev) static int hdmi_suspend(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; disable_irq(hdata->internal_irq); disable_irq(hdata->external_irq);
@@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) static int hdmi_resume(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; enable_irq(hdata->external_irq); enable_irq(hdata->internal_irq);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 30fcc12..d3ff595 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
@@ -909,7 +909,7 @@ out: static int __devinit mixer_resources_init(struct exynos_drm_hdmi_contextstruct mixer_context *ctx = drm_hdmi_ctx->client; struct mixer_resources *res = &ctx->mixer_res; u32 val, base, shadow;
*ctx, struct platform_device *pdev) {
struct mixer_context *mixer_ctx = ctx->ctx;
struct mixer_context *mixer_ctx = ctx->client; struct device *dev = &pdev->dev; struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; struct resource *res;
@@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex); ctx->dev = &pdev->dev;
drm_hdmi_ctx->ctx = (void *)ctx;
@@ -1070,7 +1070,7 @@ static int mixer_remove(struct platform_devicedrm_hdmi_ctx->client = (void *)ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
*pdev) static int mixer_suspend(struct device *dev) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev);
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
struct mixer_context *ctx = drm_hdmi_ctx->client; mixer_poweroff(ctx);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On 08/20/2012 11:29 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch changes ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable makes it confused.
I don't prefer "client" name. This is not client and server relationship.
Okay, give me your opinion. which one do you prefer?
Just "data".
Thanks.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 3fdf0b6..bced38e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->is_connected)
return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);
}return hdmi_ops->is_connected(ctx->hdmi_ctx->client); return false;
@@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_edid)
return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector,
edid,
len);
return hdmi_ops->get_edid(ctx->hdmi_ctx->client,
connector,
}edid, len); return 0;
@@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);
return hdmi_ops->check_timing(ctx->hdmi_ctx->client,
timing); return 0; } @@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->power_on)
return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
}return hdmi_ops->power_on(ctx->hdmi_ctx->client, mode); return 0;
@@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->enable_vblank)
return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx,
return mixer_ops->enable_vblank(ctx->mixer_ctx->client, manager->pipe); return 0;
@@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
} static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector,return mixer_ops->disable_vblank(ctx->mixer_ctx->client);
const struct drm_display_mode *mode,
{ struct drm_hdmi_context *ctx = to_context(subdrv_dev);struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
@@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_fixup)
hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode,
hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector,
mode, adjusted_mode); } @@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_get_max_resol(struct device *subdrv_dev,hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode);
@@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width,
height);
hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width,
height); } static void drm_hdmi_commit(struct device *subdrv_dev) @@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->dpms)
mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);
mixer_ops->dpms(ctx->mixer_ctx->client, mode); if (hdmi_ops && hdmi_ops->dpms)
hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_apply(struct device *subdrv_dev)hdmi_ops->dpms(ctx->hdmi_ctx->client, mode);
@@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device *subdrv_dev) if (!ctx->enabled[i]) continue; if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, i);
mixer_ops->win_commit(ctx->mixer_ctx->client, i); } if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
} static void drm_mixer_commit(struct device *subdrv_dev, int zpos)mixer_ops->win_mode_set(ctx->mixer_ctx->client, overlay);
@@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_commit(ctx->mixer_ctx->client, win); ctx->enabled[win] = true;
@@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_disable)
mixer_ops->win_disable(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_disable(ctx->mixer_ctx->client, win); ctx->enabled[win] = false;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index a91c420..237434d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -33,12 +33,12 @@ * exynos hdmi common context structure. * * @drm_dev: pointer to drm_device.
- @ctx: pointer to the context of specific device driver.
struct exynos_drm_hdmi_context { struct drm_device *drm_dev;
- @client: pointer to the context of specific device driver.
*/
- this context should be hdmi_context or mixer_context.
void *ctx;
}; struct exynos_hdmi_ops {void *client;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bb504cb..7538489 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; if (!hdata->get_hpd) goto out;
@@ -2127,7 +2127,7 @@ out: static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; u32 intc_flag; intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
@@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) mutex_init(&hdata->hdmi_mutex);
drm_hdmi_ctx->ctx = (void *)hdata;
drm_hdmi_ctx->client = (void *)hdata; hdata->parent_ctx = (void *)drm_hdmi_ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
struct hdmi_context *hdata = ctx->ctx;
@@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(structstruct hdmi_context *hdata = ctx->client; DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
platform_device *pdev) static int hdmi_suspend(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; disable_irq(hdata->internal_irq); disable_irq(hdata->external_irq);
@@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) static int hdmi_resume(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; enable_irq(hdata->external_irq); enable_irq(hdata->internal_irq);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 30fcc12..d3ff595 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
@@ -909,7 +909,7 @@ out: static int __devinit mixer_resources_init(struct exynos_drm_hdmi_contextstruct mixer_context *ctx = drm_hdmi_ctx->client; struct mixer_resources *res = &ctx->mixer_res; u32 val, base, shadow;
*ctx, struct platform_device *pdev) {
struct mixer_context *mixer_ctx = ctx->ctx;
struct mixer_context *mixer_ctx = ctx->client; struct device *dev = &pdev->dev; struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; struct resource *res;
@@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex); ctx->dev = &pdev->dev;
drm_hdmi_ctx->ctx = (void *)ctx;
@@ -1070,7 +1070,7 @@ static int mixer_remove(struct platform_devicedrm_hdmi_ctx->client = (void *)ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
*pdev) static int mixer_suspend(struct device *dev) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev);
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
struct mixer_context *ctx = drm_hdmi_ctx->client; mixer_poweroff(ctx);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:29 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch changes ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable makes it confused.
I don't prefer "client" name. This is not client and server relationship.
Okay, give me your opinion. which one do you prefer?
Just "data".
It's not clear. "data" is so comprehensive just use "child_ctx". we already use "parent_ctx" as the context of exynos_drm_hdmi module.
Thanks.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 3fdf0b6..bced38e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->is_connected)
return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);
}return hdmi_ops->is_connected(ctx->hdmi_ctx->client); return false;
@@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_edid)
return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector,
edid,
len);
return hdmi_ops->get_edid(ctx->hdmi_ctx->client,
connector,
}edid, len); return 0;
@@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx,
timing);
return hdmi_ops->check_timing(ctx->hdmi_ctx->client,
timing); return 0; } @@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->power_on)
return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
}return hdmi_ops->power_on(ctx->hdmi_ctx->client, mode); return 0;
@@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->enable_vblank)
return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx,
return mixer_ops->enable_vblank(ctx->mixer_ctx->client, manager->pipe); return 0;
@@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
return
mixer_ops->disable_vblank(ctx->mixer_ctx->client); } static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector,
const struct drm_display_mode *mode,
{ struct drm_hdmi_context *ctx = to_context(subdrv_dev);struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
@@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_fixup)
hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector,
mode,
hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector,
mode, adjusted_mode); } @@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_get_max_resol(struct device *subdrv_dev,hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode);
@@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width,
height);
hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width,
height); } static void drm_hdmi_commit(struct device *subdrv_dev) @@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->dpms)
mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);
mixer_ops->dpms(ctx->mixer_ctx->client, mode); if (hdmi_ops && hdmi_ops->dpms)
hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_apply(struct device *subdrv_dev)hdmi_ops->dpms(ctx->hdmi_ctx->client, mode);
@@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device *subdrv_dev) if (!ctx->enabled[i]) continue; if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, i);
mixer_ops->win_commit(ctx->mixer_ctx->client,
i); } if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
mixer_ops->win_mode_set(ctx->mixer_ctx->client,
overlay); } static void drm_mixer_commit(struct device *subdrv_dev, int zpos) @@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_commit(ctx->mixer_ctx->client, win); ctx->enabled[win] = true;
@@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_disable)
mixer_ops->win_disable(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_disable(ctx->mixer_ctx->client, win); ctx->enabled[win] = false;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index a91c420..237434d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -33,12 +33,12 @@ * exynos hdmi common context structure. * * @drm_dev: pointer to drm_device.
- @ctx: pointer to the context of specific device driver.
struct exynos_drm_hdmi_context { struct drm_device *drm_dev;
- @client: pointer to the context of specific device driver.
*/
- this context should be hdmi_context or mixer_context.
void *ctx;
}; struct exynos_hdmi_ops {void *client;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bb504cb..7538489 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; if (!hdata->get_hpd) goto out;
@@ -2127,7 +2127,7 @@ out: static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; u32 intc_flag; intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
@@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) mutex_init(&hdata->hdmi_mutex);
drm_hdmi_ctx->ctx = (void *)hdata;
drm_hdmi_ctx->client = (void *)hdata; hdata->parent_ctx = (void *)drm_hdmi_ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
struct hdmi_context *hdata = ctx->ctx;
@@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(structstruct hdmi_context *hdata = ctx->client; DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
platform_device *pdev) static int hdmi_suspend(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; disable_irq(hdata->internal_irq); disable_irq(hdata->external_irq);
@@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) static int hdmi_resume(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; enable_irq(hdata->external_irq); enable_irq(hdata->internal_irq);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 30fcc12..d3ff595 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
@@ -909,7 +909,7 @@ out: static int __devinit mixer_resources_init(structstruct mixer_context *ctx = drm_hdmi_ctx->client; struct mixer_resources *res = &ctx->mixer_res; u32 val, base, shadow;
exynos_drm_hdmi_context *ctx, struct platform_device *pdev) {
struct mixer_context *mixer_ctx = ctx->ctx;
struct mixer_context *mixer_ctx = ctx->client; struct device *dev = &pdev->dev; struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; struct resource *res;
@@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex); ctx->dev = &pdev->dev;
drm_hdmi_ctx->ctx = (void *)ctx;
@@ -1070,7 +1070,7 @@ static int mixer_remove(struct platform_devicedrm_hdmi_ctx->client = (void *)ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
*pdev) static int mixer_suspend(struct device *dev) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev);
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
struct mixer_context *ctx = drm_hdmi_ctx->client; mixer_poweroff(ctx);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On 08/20/2012 03:17 PM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:29 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch changes ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable makes it confused.
I don't prefer "client" name. This is not client and server relationship.
Okay, give me your opinion. which one do you prefer?
Just "data".
It's not clear. "data" is so comprehensive just use "child_ctx". we already use "parent_ctx" as the context of exynos_drm_hdmi module.
Actually, i prefer "data" term than "ctx" term. Anyway i want to focus why this problem is occurred because i think that codes are some ugly. I think we first need to consider to solve this situation using code redesign, structure change and etc.
Thanks.
Thanks.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38
+++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 3fdf0b6..bced38e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->is_connected)
return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);
}return hdmi_ops->is_connected(ctx->hdmi_ctx->client); return false;
@@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_edid)
return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector,
edid,
len);
return hdmi_ops->get_edid(ctx->hdmi_ctx->client,
connector,
}edid, len); return 0;
@@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx,
timing);
return hdmi_ops->check_timing(ctx->hdmi_ctx->client,
timing); return 0; } @@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->power_on)
return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
}return hdmi_ops->power_on(ctx->hdmi_ctx->client, mode); return 0;
@@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->enable_vblank)
return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx,
return mixer_ops->enable_vblank(ctx->mixer_ctx->client, manager->pipe); return 0;
@@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
return
mixer_ops->disable_vblank(ctx->mixer_ctx->client); } static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector,
const struct drm_display_mode *mode,
{ struct drm_hdmi_context *ctx = to_context(subdrv_dev);struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
@@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_fixup)
hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector,
mode,
hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector,
mode, adjusted_mode); } @@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_get_max_resol(struct device *subdrv_dev,hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode);
@@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width,
height);
hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width,
height); } static void drm_hdmi_commit(struct device *subdrv_dev) @@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->dpms)
mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);
mixer_ops->dpms(ctx->mixer_ctx->client, mode); if (hdmi_ops && hdmi_ops->dpms)
hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_apply(struct device *subdrv_dev)hdmi_ops->dpms(ctx->hdmi_ctx->client, mode);
@@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device *subdrv_dev) if (!ctx->enabled[i]) continue; if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, i);
mixer_ops->win_commit(ctx->mixer_ctx->client,
i); } if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
mixer_ops->win_mode_set(ctx->mixer_ctx->client,
overlay); } static void drm_mixer_commit(struct device *subdrv_dev, int zpos) @@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_commit(ctx->mixer_ctx->client, win); ctx->enabled[win] = true;
@@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_disable)
mixer_ops->win_disable(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_disable(ctx->mixer_ctx->client, win); ctx->enabled[win] = false;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index a91c420..237434d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -33,12 +33,12 @@ * exynos hdmi common context structure. * * @drm_dev: pointer to drm_device.
- @ctx: pointer to the context of specific device driver.
- @client: pointer to the context of specific device driver.
*/ struct exynos_drm_hdmi_context { struct drm_device *drm_dev;
- this context should be hdmi_context or mixer_context.
void *ctx;
}; struct exynos_hdmi_ops {void *client;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bb504cb..7538489 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; if (!hdata->get_hpd) goto out;
@@ -2127,7 +2127,7 @@ out: static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; u32 intc_flag; intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
@@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) mutex_init(&hdata->hdmi_mutex); - drm_hdmi_ctx->ctx = (void *)hdata;
drm_hdmi_ctx->client = (void *)hdata; hdata->parent_ctx = (void *)drm_hdmi_ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
struct hdmi_context *hdata = ctx->ctx;
@@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(structstruct hdmi_context *hdata = ctx->client; DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
platform_device *pdev) static int hdmi_suspend(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; disable_irq(hdata->internal_irq); disable_irq(hdata->external_irq);
@@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) static int hdmi_resume(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; enable_irq(hdata->external_irq); enable_irq(hdata->internal_irq);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 30fcc12..d3ff595 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
@@ -909,7 +909,7 @@ out: static int __devinit mixer_resources_init(structstruct mixer_context *ctx = drm_hdmi_ctx->client; struct mixer_resources *res = &ctx->mixer_res; u32 val, base, shadow;
exynos_drm_hdmi_context *ctx, struct platform_device *pdev) {
struct mixer_context *mixer_ctx = ctx->ctx;
struct mixer_context *mixer_ctx = ctx->client; struct device *dev = &pdev->dev; struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; struct resource *res;
@@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex); ctx->dev = &pdev->dev;
drm_hdmi_ctx->ctx = (void *)ctx;
@@ -1070,7 +1070,7 @@ static int mixer_remove(struct platform_devicedrm_hdmi_ctx->client = (void *)ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
*pdev) static int mixer_suspend(struct device *dev) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev);
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
struct mixer_context *ctx = drm_hdmi_ctx->client; mixer_poweroff(ctx);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 03:17 PM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:29 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote:
this patch changes ctx variable name in exynos_drm_hdmi_context structure to client because the use of ctx variable makes it confused.
I don't prefer "client" name. This is not client and server relationship.
Okay, give me your opinion. which one do you prefer?
Just "data".
It's not clear. "data" is so comprehensive just use "child_ctx". we already use "parent_ctx" as the context of exynos_drm_hdmi module.
Actually, i prefer "data" term than "ctx" term. Anyway i want to focus why this problem is occurred because i think that codes are some ugly. I think we first need to consider to solve this situation using code redesign, structure change and etc.
calm down and focus on the use of term. this is so minor and this is not related to design issue.
Thanks.
Thanks.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38
+++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- 4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 3fdf0b6..bced38e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->is_connected)
return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);
}return hdmi_ops->is_connected(ctx->hdmi_ctx->client); return false;
@@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_edid)
return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx,
connector, edid,
len);
return hdmi_ops->get_edid(ctx->hdmi_ctx->client,
connector,
}edid, len); return 0;
@@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx,
timing);
return hdmi_ops->check_timing(ctx->hdmi_ctx->client,
timing); return 0; } @@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->power_on)
return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
return hdmi_ops->power_on(ctx->hdmi_ctx->client,
mode); return 0; } @@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->enable_vblank)
return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx,
return
mixer_ops->enable_vblank(ctx->mixer_ctx->client, manager->pipe); return 0; @@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
return
mixer_ops->disable_vblank(ctx->mixer_ctx->client); } static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector,
const struct drm_display_mode *mode,
struct drm_display_mode *mode, struct drm_display_mode
*adjusted_mode) { struct drm_hdmi_context *ctx = to_context(subdrv_dev); @@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_fixup)
hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector,
mode,
hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector,
mode, adjusted_mode); } @@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_get_max_resol(struct device *subdrv_dev,hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode);
@@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width,
height);
hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width,
height); } static void drm_hdmi_commit(struct device *subdrv_dev) @@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device *subdrv_dev) DRM_DEBUG_KMS("%s\n", __FILE__); if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->dpms)
mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);
mixer_ops->dpms(ctx->mixer_ctx->client, mode); if (hdmi_ops && hdmi_ops->dpms)
hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
} static void drm_hdmi_apply(struct device *subdrv_dev)hdmi_ops->dpms(ctx->hdmi_ctx->client, mode);
@@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device *subdrv_dev) if (!ctx->enabled[i]) continue; if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, i);
mixer_ops->win_commit(ctx->mixer_ctx->client,
i); } if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {hdmi_ops->commit(ctx->hdmi_ctx->client);
@@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, DRM_DEBUG_KMS("%s\n", __FILE__); if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
mixer_ops->win_mode_set(ctx->mixer_ctx->client,
overlay); } static void drm_mixer_commit(struct device *subdrv_dev, int zpos) @@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_commit(ctx->mixer_ctx->client, win); ctx->enabled[win] = true;
@@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) } if (mixer_ops && mixer_ops->win_disable)
mixer_ops->win_disable(ctx->mixer_ctx->ctx, win);
}mixer_ops->win_disable(ctx->mixer_ctx->client, win); ctx->enabled[win] = false;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index a91c420..237434d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -33,12 +33,12 @@ * exynos hdmi common context structure. * * @drm_dev: pointer to drm_device.
- @ctx: pointer to the context of specific device driver.
- @client: pointer to the context of specific device driver.
*/ struct exynos_drm_hdmi_context { struct drm_device *drm_dev;
- this context should be hdmi_context or mixer_context.
void *ctx;
}; struct exynos_hdmi_ops {void *client;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bb504cb..7538489 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; if (!hdata->get_hpd) goto out;
@@ -2127,7 +2127,7 @@ out: static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg;
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; u32 intc_flag; intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
@@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) mutex_init(&hdata->hdmi_mutex); - drm_hdmi_ctx->ctx = (void *)hdata;
drm_hdmi_ctx->client = (void *)hdata; hdata->parent_ctx = (void *)drm_hdmi_ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
@@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
struct hdmi_context *hdata = ctx->ctx;
@@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(structstruct hdmi_context *hdata = ctx->client; DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
platform_device *pdev) static int hdmi_suspend(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; disable_irq(hdata->internal_irq); disable_irq(hdata->external_irq);
@@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) static int hdmi_resume(struct device *dev) { struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
struct hdmi_context *hdata = ctx->client; enable_irq(hdata->external_irq); enable_irq(hdata->internal_irq);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 30fcc12..d3ff595 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
@@ -909,7 +909,7 @@ out: static int __devinit mixer_resources_init(structstruct mixer_context *ctx = drm_hdmi_ctx->client; struct mixer_resources *res = &ctx->mixer_res; u32 val, base, shadow;
exynos_drm_hdmi_context *ctx, struct platform_device *pdev) {
struct mixer_context *mixer_ctx = ctx->ctx;
struct mixer_context *mixer_ctx = ctx->client; struct device *dev = &pdev->dev; struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; struct resource *res;
@@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) mutex_init(&ctx->mixer_mutex); ctx->dev = &pdev->dev;
drm_hdmi_ctx->ctx = (void *)ctx;
@@ -1070,7 +1070,7 @@ static int mixer_remove(structdrm_hdmi_ctx->client = (void *)ctx; platform_set_drvdata(pdev, drm_hdmi_ctx);
platform_device *pdev) static int mixer_suspend(struct device *dev) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev);
struct mixer_context *ctx = drm_hdmi_ctx->ctx;
struct mixer_context *ctx = drm_hdmi_ctx->client; mixer_poweroff(ctx);
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/8/20 InKi Dae inki.dae@samsung.com:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 03:17 PM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/20/2012 11:29 AM, InKi Dae wrote:
2012/8/20 Joonyoung Shim jy0922.shim@samsung.com:
On 08/17/2012 06:50 PM, Inki Dae wrote: > > this patch changes ctx variable name in exynos_drm_hdmi_context > structure to client because the use of ctx variable makes it confused.
I don't prefer "client" name. This is not client and server relationship.
Okay, give me your opinion. which one do you prefer?
Just "data".
It's not clear. "data" is so comprehensive just use "child_ctx". we already use "parent_ctx" as the context of exynos_drm_hdmi module.
Actually, i prefer "data" term than "ctx" term. Anyway i want to focus why this problem is occurred because i think that codes are some ugly. I think we first need to consider to solve this situation using code redesign, structure change and etc.
calm down and focus on the use of term. this is so minor and this is not related to design issue.
and it's not important whether you prefer this term or not. if the use of "data" term is logical enough then we will use it otherwise "child_ctx" so give me your comment why you don't prefer "child_ctx" term. actually, now hdmi codes use "hdata" term as context's instance but other use "ctx" term. as I mentioned before, I gave you my opinion that "data" term is so comprehensive so I DON'T PREFER "data" term.
Thanks.
Thanks.
> Signed-off-by: Inki Dae inki.dae@samsung.com > Signed-off-by: Kyungmin Park kyungmin.park@samsung.com > --- > drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 38 > +++++++++++++++--------------- > drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 4 +- > drivers/gpu/drm/exynos/exynos_hdmi.c | 12 ++++---- > drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++--- > 4 files changed, 31 insertions(+), 31 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c > b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c > index 3fdf0b6..bced38e 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c > @@ -64,7 +64,7 @@ static bool drm_hdmi_is_connected(struct device > *dev) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->is_connected) > - return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx); > + return hdmi_ops->is_connected(ctx->hdmi_ctx->client); > return false; > } > @@ -77,8 +77,8 @@ static int drm_hdmi_get_edid(struct device *dev, > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->get_edid) > - return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, > connector, > edid, > - len); > + return hdmi_ops->get_edid(ctx->hdmi_ctx->client, > connector, > + edid, len); > return 0; > } > @@ -90,7 +90,7 @@ static int drm_hdmi_check_timing(struct device *dev, > void *timing) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->check_timing) > - return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, > timing); > + return hdmi_ops->check_timing(ctx->hdmi_ctx->client, > timing); > return 0; > } > @@ -102,7 +102,7 @@ static int drm_hdmi_power_on(struct device *dev, > int > mode) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->power_on) > - return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode); > + return hdmi_ops->power_on(ctx->hdmi_ctx->client, > mode); > return 0; > } > @@ -124,7 +124,7 @@ static int drm_hdmi_enable_vblank(struct device > *subdrv_dev) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (mixer_ops && mixer_ops->enable_vblank) > - return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx, > + return > mixer_ops->enable_vblank(ctx->mixer_ctx->client, > manager->pipe); > return 0; > @@ -137,12 +137,12 @@ static void drm_hdmi_disable_vblank(struct > device > *subdrv_dev) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (mixer_ops && mixer_ops->disable_vblank) > - return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); > + return > mixer_ops->disable_vblank(ctx->mixer_ctx->client); > } > static void drm_hdmi_mode_fixup(struct device *subdrv_dev, > struct drm_connector *connector, > - const struct drm_display_mode *mode, > + struct drm_display_mode *mode, > struct drm_display_mode > *adjusted_mode) > { > struct drm_hdmi_context *ctx = to_context(subdrv_dev); > @@ -150,7 +150,7 @@ static void drm_hdmi_mode_fixup(struct device > *subdrv_dev, > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->mode_fixup) > - hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, > mode, > + hdmi_ops->mode_fixup(ctx->hdmi_ctx->client, connector, > mode, > adjusted_mode); > } > @@ -161,7 +161,7 @@ static void drm_hdmi_mode_set(struct device > *subdrv_dev, void *mode) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->mode_set) > - hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode); > + hdmi_ops->mode_set(ctx->hdmi_ctx->client, mode); > } > static void drm_hdmi_get_max_resol(struct device *subdrv_dev, > @@ -172,7 +172,7 @@ static void drm_hdmi_get_max_resol(struct device > *subdrv_dev, > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->get_max_resol) > - hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, > height); > + hdmi_ops->get_max_resol(ctx->hdmi_ctx->client, width, > height); > } > static void drm_hdmi_commit(struct device *subdrv_dev) > @@ -182,7 +182,7 @@ static void drm_hdmi_commit(struct device > *subdrv_dev) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (hdmi_ops && hdmi_ops->commit) > - hdmi_ops->commit(ctx->hdmi_ctx->ctx); > + hdmi_ops->commit(ctx->hdmi_ctx->client); > } > static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) > @@ -192,10 +192,10 @@ static void drm_hdmi_dpms(struct device > *subdrv_dev, > int mode) > DRM_DEBUG_KMS("%s\n", __FILE__); > if (mixer_ops && mixer_ops->dpms) > - mixer_ops->dpms(ctx->mixer_ctx->ctx, mode); > + mixer_ops->dpms(ctx->mixer_ctx->client, mode); > if (hdmi_ops && hdmi_ops->dpms) > - hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode); > + hdmi_ops->dpms(ctx->hdmi_ctx->client, mode); > } > static void drm_hdmi_apply(struct device *subdrv_dev) > @@ -209,11 +209,11 @@ static void drm_hdmi_apply(struct device > *subdrv_dev) > if (!ctx->enabled[i]) > continue; > if (mixer_ops && mixer_ops->win_commit) > - mixer_ops->win_commit(ctx->mixer_ctx->ctx, i); > + mixer_ops->win_commit(ctx->mixer_ctx->client, > i); > } > if (hdmi_ops && hdmi_ops->commit) > - hdmi_ops->commit(ctx->hdmi_ctx->ctx); > + hdmi_ops->commit(ctx->hdmi_ctx->client); > } > static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { > @@ -235,7 +235,7 @@ static void drm_mixer_mode_set(struct device > *subdrv_dev, > DRM_DEBUG_KMS("%s\n", __FILE__); > if (mixer_ops && mixer_ops->win_mode_set) > - mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); > + mixer_ops->win_mode_set(ctx->mixer_ctx->client, > overlay); > } > static void drm_mixer_commit(struct device *subdrv_dev, int > zpos) > @@ -251,7 +251,7 @@ static void drm_mixer_commit(struct device > *subdrv_dev, int zpos) > } > if (mixer_ops && mixer_ops->win_commit) > - mixer_ops->win_commit(ctx->mixer_ctx->ctx, win); > + mixer_ops->win_commit(ctx->mixer_ctx->client, win); > ctx->enabled[win] = true; > } > @@ -269,7 +269,7 @@ static void drm_mixer_disable(struct device > *subdrv_dev, int zpos) > } > if (mixer_ops && mixer_ops->win_disable) > - mixer_ops->win_disable(ctx->mixer_ctx->ctx, win); > + mixer_ops->win_disable(ctx->mixer_ctx->client, win); > ctx->enabled[win] = false; > } > diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h > b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h > index a91c420..237434d 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h > +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h > @@ -33,12 +33,12 @@ > * exynos hdmi common context structure. > * > * @drm_dev: pointer to drm_device. > - * @ctx: pointer to the context of specific device driver. > + * @client: pointer to the context of specific device driver. > * this context should be hdmi_context or mixer_context. > */ > struct exynos_drm_hdmi_context { > struct drm_device *drm_dev; > - void *ctx; > + void *client; > }; > struct exynos_hdmi_ops { > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c > b/drivers/gpu/drm/exynos/exynos_hdmi.c > index bb504cb..7538489 100644 > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c > @@ -2108,7 +2108,7 @@ static struct exynos_hdmi_ops hdmi_ops = { > static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) > { > struct exynos_drm_hdmi_context *ctx = arg; > - struct hdmi_context *hdata = ctx->ctx; > + struct hdmi_context *hdata = ctx->client; > if (!hdata->get_hpd) > goto out; > @@ -2127,7 +2127,7 @@ out: > static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) > { > struct exynos_drm_hdmi_context *ctx = arg; > - struct hdmi_context *hdata = ctx->ctx; > + struct hdmi_context *hdata = ctx->client; > u32 intc_flag; > intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); > @@ -2295,7 +2295,7 @@ static int __devinit hdmi_probe(struct > platform_device *pdev) > mutex_init(&hdata->hdmi_mutex); > - drm_hdmi_ctx->ctx = (void *)hdata; > + drm_hdmi_ctx->client = (void *)hdata; > hdata->parent_ctx = (void *)drm_hdmi_ctx; > platform_set_drvdata(pdev, drm_hdmi_ctx); > @@ -2395,7 +2395,7 @@ static int __devexit hdmi_remove(struct > platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct exynos_drm_hdmi_context *ctx = > platform_get_drvdata(pdev); > - struct hdmi_context *hdata = ctx->ctx; > + struct hdmi_context *hdata = ctx->client; > DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); > @@ -2417,7 +2417,7 @@ static int __devexit hdmi_remove(struct > platform_device *pdev) > static int hdmi_suspend(struct device *dev) > { > struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev); > - struct hdmi_context *hdata = ctx->ctx; > + struct hdmi_context *hdata = ctx->client; > disable_irq(hdata->internal_irq); > disable_irq(hdata->external_irq); > @@ -2434,7 +2434,7 @@ static int hdmi_suspend(struct device *dev) > static int hdmi_resume(struct device *dev) > { > struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev); > - struct hdmi_context *hdata = ctx->ctx; > + struct hdmi_context *hdata = ctx->client; > enable_irq(hdata->external_irq); > enable_irq(hdata->internal_irq); > diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c > b/drivers/gpu/drm/exynos/exynos_mixer.c > index 30fcc12..d3ff595 100644 > --- a/drivers/gpu/drm/exynos/exynos_mixer.c > +++ b/drivers/gpu/drm/exynos/exynos_mixer.c > @@ -864,7 +864,7 @@ static void mixer_finish_pageflip(struct > drm_device > *drm_dev, int crtc) > static irqreturn_t mixer_irq_handler(int irq, void *arg) > { > struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; > - struct mixer_context *ctx = drm_hdmi_ctx->ctx; > + struct mixer_context *ctx = drm_hdmi_ctx->client; > struct mixer_resources *res = &ctx->mixer_res; > u32 val, base, shadow; > @@ -909,7 +909,7 @@ out: > static int __devinit mixer_resources_init(struct > exynos_drm_hdmi_context > *ctx, > struct platform_device *pdev) > { > - struct mixer_context *mixer_ctx = ctx->ctx; > + struct mixer_context *mixer_ctx = ctx->client; > struct device *dev = &pdev->dev; > struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; > struct resource *res; > @@ -1035,7 +1035,7 @@ static int __devinit mixer_probe(struct > platform_device *pdev) > mutex_init(&ctx->mixer_mutex); > ctx->dev = &pdev->dev; > - drm_hdmi_ctx->ctx = (void *)ctx; > + drm_hdmi_ctx->client = (void *)ctx; > platform_set_drvdata(pdev, drm_hdmi_ctx); > @@ -1070,7 +1070,7 @@ static int mixer_remove(struct > platform_device > *pdev) > static int mixer_suspend(struct device *dev) > { > struct exynos_drm_hdmi_context *drm_hdmi_ctx = > get_mixer_context(dev); > - struct mixer_context *ctx = drm_hdmi_ctx->ctx; > + struct mixer_context *ctx = drm_hdmi_ctx->client; > mixer_poweroff(ctx); > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
the argument of drm_hdmi_mode_fixup function, struct drm_display_mode should be declared as const.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index bced38e..38250cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -142,7 +142,7 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev)
static void drm_hdmi_mode_fixup(struct device *subdrv_dev, struct drm_connector *connector, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_hdmi_context *ctx = to_context(subdrv_dev);
the values set to registers will be updated into real registers at vsync so dma operation could be malfunctioned when accessed to memory after gem buffer was released. this patch makes sure that hw overlay is disabled before the gem buffer is released.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 11 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 1 + drivers/gpu/drm/exynos/exynos_mixer.c | 13 +++++++++++++ 3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 38250cb..6323cc8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -274,10 +274,21 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) ctx->enabled[win] = false; }
+static void drm_mixer_wait_for_vblank(struct device *subdrv_dev) +{ + struct drm_hdmi_context *ctx = to_context(subdrv_dev); + + DRM_DEBUG_KMS("%s\n", __FILE__); + + if (mixer_ops && mixer_ops->wait_for_vblank) + mixer_ops->wait_for_vblank(ctx->mixer_ctx->client); +} + static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { .mode_set = drm_mixer_mode_set, .commit = drm_mixer_commit, .disable = drm_mixer_disable, + .wait_for_vblank = drm_mixer_wait_for_vblank, };
static struct exynos_drm_manager hdmi_manager = { diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 237434d..93e8a2b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -67,6 +67,7 @@ struct exynos_mixer_ops { void (*dpms)(void *ctx, int mode);
/* overlay */ + void (*wait_for_vblank)(void *ctx); void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); void (*win_commit)(void *ctx, int zpos); void (*win_disable)(void *ctx, int zpos); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index d3ff595..1ab5267 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -726,6 +726,18 @@ static void mixer_dpms(void *ctx, int mode) } }
+static void mixer_wait_for_vblank(void *ctx) +{ + struct mixer_context *mixer_ctx = ctx; + struct mixer_resources *res = &mixer_ctx->mixer_res; + int ret; + + ret = wait_for((mixer_reg_read(res, MXR_INT_STATUS) & + MXR_INT_STATUS_VSYNC), 50); + if (ret < 0) + DRM_DEBUG_KMS("vblank wait timed out.\n"); +} + static void mixer_win_mode_set(void *ctx, struct exynos_drm_overlay *overlay) { @@ -818,6 +830,7 @@ static struct exynos_mixer_ops mixer_ops = { .dpms = mixer_dpms,
/* overlay */ + .wait_for_vblank = mixer_wait_for_vblank, .win_mode_set = mixer_win_mode_set, .win_commit = mixer_win_commit, .win_disable = mixer_win_disable,
dri-devel@lists.freedesktop.org