* [PATCH v3 0/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
@ 2022-04-20 11:44 ` José Expósito
0 siblings, 0 replies; 10+ messages in thread
From: José Expósito @ 2022-04-20 11:44 UTC (permalink / raw)
To: emma
Cc: mripard, laurent.pinchart, airlied, daniel, p.zabel, dri-devel,
linux-kernel, José Expósito
Hi everyone,
These patches replace the calls to drm_detect_hdmi_monitor() with the
more efficient drm_display_info.is_hdmi in the VC4 driver and, since
this makes the vc4_hdmi_encoder struct redundant, also removes it.
Thanks,
José Expósito
v1: https://lore.kernel.org/dri-devel/20220406165514.6106-1-jose.exposito89@gmail.com/
v2: https://lore.kernel.org/dri-devel/20220415154745.170597-1-jose.exposito89@gmail.com/T/
Add the ftrace command used in the first patch
Remove vc4_hdmi_encoder.hdmi_monitor
(Thanks to Maxime for suggesting these changes)
v3: Squash the patches present in v2
Remove vc4_hdmi_encoder
(Thanks to Maxime for suggesting these changes)
José Expósito (2):
drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
drm/vc4: hdmi: Remove vc4_hdmi_encoder
drivers/gpu/drm/vc4/vc4_hdmi.c | 41 +++++++++++++++-------------------
drivers/gpu/drm/vc4/vc4_hdmi.h | 17 ++------------
2 files changed, 20 insertions(+), 38 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 0/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
@ 2022-04-20 11:44 ` José Expósito
0 siblings, 0 replies; 10+ messages in thread
From: José Expósito @ 2022-04-20 11:44 UTC (permalink / raw)
To: emma
Cc: airlied, linux-kernel, dri-devel, laurent.pinchart,
José Expósito
Hi everyone,
These patches replace the calls to drm_detect_hdmi_monitor() with the
more efficient drm_display_info.is_hdmi in the VC4 driver and, since
this makes the vc4_hdmi_encoder struct redundant, also removes it.
Thanks,
José Expósito
v1: https://lore.kernel.org/dri-devel/20220406165514.6106-1-jose.exposito89@gmail.com/
v2: https://lore.kernel.org/dri-devel/20220415154745.170597-1-jose.exposito89@gmail.com/T/
Add the ftrace command used in the first patch
Remove vc4_hdmi_encoder.hdmi_monitor
(Thanks to Maxime for suggesting these changes)
v3: Squash the patches present in v2
Remove vc4_hdmi_encoder
(Thanks to Maxime for suggesting these changes)
José Expósito (2):
drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
drm/vc4: hdmi: Remove vc4_hdmi_encoder
drivers/gpu/drm/vc4/vc4_hdmi.c | 41 +++++++++++++++-------------------
drivers/gpu/drm/vc4/vc4_hdmi.h | 17 ++------------
2 files changed, 20 insertions(+), 38 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 1/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
2022-04-20 11:44 ` José Expósito
@ 2022-04-20 11:44 ` José Expósito
-1 siblings, 0 replies; 10+ messages in thread
From: José Expósito @ 2022-04-20 11:44 UTC (permalink / raw)
To: emma
Cc: mripard, laurent.pinchart, airlied, daniel, p.zabel, dri-devel,
linux-kernel, José Expósito
Once EDID is parsed, the monitor HDMI support information is cached in
drm_display_info.is_hdmi by drm_parse_hdmi_vsdb_video().
This driver calls drm_detect_hdmi_monitor() to receive the same
information and stores its own cached value in
vc4_hdmi_encoder.hdmi_monitor, which is less efficient.
Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi
instead. This also allows to remove vc4_hdmi_encoder.hdmi_monitor.
drm_detect_hdmi_monitor() is called in vc4_hdmi_connector_detect() and
vc4_hdmi_connector_get_modes(). In both cases it is safe to rely on
drm_display_info.is_hdmi as shown by ftrace:
$ sudo trace-cmd record -p function_graph -l "vc4_hdmi_*" -l "drm_*"
vc4_hdmi_connector_detect:
vc4_hdmi_connector_detect() {
drm_get_edid() {
drm_connector_update_edid_property() {
drm_add_display_info() {
drm_reset_display_info();
drm_for_each_detailed_block.part.0();
drm_parse_cea_ext() {
drm_find_cea_extension();
drm_parse_hdmi_vsdb_video();
/* drm_display_info.is_hdmi is cached here */
}
}
}
}
/* drm_display_info.is_hdmi is used here */
}
vc4_hdmi_connector_get_modes:
vc4_hdmi_connector_get_modes() {
drm_get_edid() {
drm_connector_update_edid_property() {
drm_add_display_info() {
drm_reset_display_info();
drm_for_each_detailed_block.part.0();
drm_parse_cea_ext() {
drm_find_cea_extension();
drm_parse_hdmi_vsdb_video();
/* drm_display_info.is_hdmi is cached here */
}
}
}
}
/* drm_display_info.is_hdmi is used here */
drm_connector_update_edid_property();
}
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++++-----------
drivers/gpu/drm/vc4/vc4_hdmi.h | 1 -
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 6c58b0fd13fb..9c73a211ae80 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -107,9 +107,9 @@ static bool vc4_hdmi_mode_needs_scrambling(const struct drm_display_mode *mode)
static bool vc4_hdmi_is_full_range_rgb(struct vc4_hdmi *vc4_hdmi,
const struct drm_display_mode *mode)
{
- struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder;
+ struct drm_display_info *display = &vc4_hdmi->connector.display_info;
- return !vc4_encoder->hdmi_monitor ||
+ return !display->is_hdmi ||
drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_FULL;
}
@@ -216,7 +216,6 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
if (edid) {
cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid);
- vc4_hdmi->encoder.hdmi_monitor = drm_detect_hdmi_monitor(edid);
kfree(edid);
}
}
@@ -242,7 +241,6 @@ static void vc4_hdmi_connector_destroy(struct drm_connector *connector)
static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)
{
struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
- struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder;
int ret = 0;
struct edid *edid;
@@ -255,8 +253,6 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)
goto out;
}
- vc4_encoder->hdmi_monitor = drm_detect_hdmi_monitor(edid);
-
drm_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid);
kfree(edid);
@@ -578,13 +574,12 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder)
static bool vc4_hdmi_supports_scrambling(struct drm_encoder *encoder,
struct drm_display_mode *mode)
{
- struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
struct drm_display_info *display = &vc4_hdmi->connector.display_info;
lockdep_assert_held(&vc4_hdmi->mutex);
- if (!vc4_encoder->hdmi_monitor)
+ if (!display->is_hdmi)
return false;
if (!display->hdmi.scdc.supported ||
@@ -1147,7 +1142,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
{
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode;
- struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
+ struct drm_display_info *display = &vc4_hdmi->connector.display_info;
bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC;
unsigned long flags;
@@ -1168,7 +1163,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
HDMI_WRITE(HDMI_VID_CTL,
HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_BLANKPIX);
- if (vc4_encoder->hdmi_monitor) {
+ if (display->is_hdmi) {
HDMI_WRITE(HDMI_SCHEDULER_CONTROL,
HDMI_READ(HDMI_SCHEDULER_CONTROL) |
VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI);
@@ -1195,7 +1190,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
"!VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE\n");
}
- if (vc4_encoder->hdmi_monitor) {
+ if (display->is_hdmi) {
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index 1076faeab616..44977002445f 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -11,7 +11,6 @@
/* VC4 HDMI encoder KMS struct */
struct vc4_hdmi_encoder {
struct vc4_encoder base;
- bool hdmi_monitor;
};
static inline struct vc4_hdmi_encoder *
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 1/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
@ 2022-04-20 11:44 ` José Expósito
0 siblings, 0 replies; 10+ messages in thread
From: José Expósito @ 2022-04-20 11:44 UTC (permalink / raw)
To: emma
Cc: airlied, linux-kernel, dri-devel, laurent.pinchart,
José Expósito
Once EDID is parsed, the monitor HDMI support information is cached in
drm_display_info.is_hdmi by drm_parse_hdmi_vsdb_video().
This driver calls drm_detect_hdmi_monitor() to receive the same
information and stores its own cached value in
vc4_hdmi_encoder.hdmi_monitor, which is less efficient.
Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi
instead. This also allows to remove vc4_hdmi_encoder.hdmi_monitor.
drm_detect_hdmi_monitor() is called in vc4_hdmi_connector_detect() and
vc4_hdmi_connector_get_modes(). In both cases it is safe to rely on
drm_display_info.is_hdmi as shown by ftrace:
$ sudo trace-cmd record -p function_graph -l "vc4_hdmi_*" -l "drm_*"
vc4_hdmi_connector_detect:
vc4_hdmi_connector_detect() {
drm_get_edid() {
drm_connector_update_edid_property() {
drm_add_display_info() {
drm_reset_display_info();
drm_for_each_detailed_block.part.0();
drm_parse_cea_ext() {
drm_find_cea_extension();
drm_parse_hdmi_vsdb_video();
/* drm_display_info.is_hdmi is cached here */
}
}
}
}
/* drm_display_info.is_hdmi is used here */
}
vc4_hdmi_connector_get_modes:
vc4_hdmi_connector_get_modes() {
drm_get_edid() {
drm_connector_update_edid_property() {
drm_add_display_info() {
drm_reset_display_info();
drm_for_each_detailed_block.part.0();
drm_parse_cea_ext() {
drm_find_cea_extension();
drm_parse_hdmi_vsdb_video();
/* drm_display_info.is_hdmi is cached here */
}
}
}
}
/* drm_display_info.is_hdmi is used here */
drm_connector_update_edid_property();
}
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++++-----------
drivers/gpu/drm/vc4/vc4_hdmi.h | 1 -
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 6c58b0fd13fb..9c73a211ae80 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -107,9 +107,9 @@ static bool vc4_hdmi_mode_needs_scrambling(const struct drm_display_mode *mode)
static bool vc4_hdmi_is_full_range_rgb(struct vc4_hdmi *vc4_hdmi,
const struct drm_display_mode *mode)
{
- struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder;
+ struct drm_display_info *display = &vc4_hdmi->connector.display_info;
- return !vc4_encoder->hdmi_monitor ||
+ return !display->is_hdmi ||
drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_FULL;
}
@@ -216,7 +216,6 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
if (edid) {
cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid);
- vc4_hdmi->encoder.hdmi_monitor = drm_detect_hdmi_monitor(edid);
kfree(edid);
}
}
@@ -242,7 +241,6 @@ static void vc4_hdmi_connector_destroy(struct drm_connector *connector)
static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)
{
struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
- struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder;
int ret = 0;
struct edid *edid;
@@ -255,8 +253,6 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)
goto out;
}
- vc4_encoder->hdmi_monitor = drm_detect_hdmi_monitor(edid);
-
drm_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid);
kfree(edid);
@@ -578,13 +574,12 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder)
static bool vc4_hdmi_supports_scrambling(struct drm_encoder *encoder,
struct drm_display_mode *mode)
{
- struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
struct drm_display_info *display = &vc4_hdmi->connector.display_info;
lockdep_assert_held(&vc4_hdmi->mutex);
- if (!vc4_encoder->hdmi_monitor)
+ if (!display->is_hdmi)
return false;
if (!display->hdmi.scdc.supported ||
@@ -1147,7 +1142,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
{
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode;
- struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
+ struct drm_display_info *display = &vc4_hdmi->connector.display_info;
bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC;
unsigned long flags;
@@ -1168,7 +1163,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
HDMI_WRITE(HDMI_VID_CTL,
HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_BLANKPIX);
- if (vc4_encoder->hdmi_monitor) {
+ if (display->is_hdmi) {
HDMI_WRITE(HDMI_SCHEDULER_CONTROL,
HDMI_READ(HDMI_SCHEDULER_CONTROL) |
VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI);
@@ -1195,7 +1190,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
"!VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE\n");
}
- if (vc4_encoder->hdmi_monitor) {
+ if (display->is_hdmi) {
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index 1076faeab616..44977002445f 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -11,7 +11,6 @@
/* VC4 HDMI encoder KMS struct */
struct vc4_hdmi_encoder {
struct vc4_encoder base;
- bool hdmi_monitor;
};
static inline struct vc4_hdmi_encoder *
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] drm/vc4: hdmi: Remove vc4_hdmi_encoder
2022-04-20 11:44 ` José Expósito
@ 2022-04-20 11:45 ` José Expósito
-1 siblings, 0 replies; 10+ messages in thread
From: José Expósito @ 2022-04-20 11:45 UTC (permalink / raw)
To: emma
Cc: mripard, laurent.pinchart, airlied, daniel, p.zabel, dri-devel,
linux-kernel, José Expósito
The vc4_hdmi_encoder struct was used exclusively to cache the value
returned by drm_detect_hdmi_monitor() in order to avoid calling it
multiple times.
Now that drm_detect_hdmi_monitor() has been replaced with
drm_display_info.is_hdmi, there is no need to have an extra struct.
Remove vc4_hdmi_encoder.
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 24 ++++++++++++------------
drivers/gpu/drm/vc4/vc4_hdmi.h | 16 ++--------------
2 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 9c73a211ae80..f8d662fde5e0 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -220,7 +220,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
}
}
- vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base.base);
+ vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base);
pm_runtime_put(&vc4_hdmi->pdev->dev);
mutex_unlock(&vc4_hdmi->mutex);
return connector_status_connected;
@@ -357,7 +357,7 @@ static int vc4_hdmi_connector_init(struct drm_device *dev,
struct vc4_hdmi *vc4_hdmi)
{
struct drm_connector *connector = &vc4_hdmi->connector;
- struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
int ret;
drm_connector_init_with_ddc(dev, connector,
@@ -1463,7 +1463,7 @@ static int vc4_hdmi_audio_startup(struct device *dev, void *data)
static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi)
{
- struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
struct device *dev = &vc4_hdmi->pdev->dev;
unsigned long flags;
int ret;
@@ -1553,7 +1553,7 @@ static int vc4_hdmi_audio_prepare(struct device *dev, void *data,
struct hdmi_codec_params *params)
{
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
- struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
unsigned int sample_rate = params->sample_rate;
unsigned int channels = params->channels;
unsigned long flags;
@@ -2506,13 +2506,13 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
INIT_DELAYED_WORK(&vc4_hdmi->scrambling_work, vc4_hdmi_scrambling_wq);
dev_set_drvdata(dev, vc4_hdmi);
- encoder = &vc4_hdmi->encoder.base.base;
- vc4_hdmi->encoder.base.type = variant->encoder_type;
- vc4_hdmi->encoder.base.pre_crtc_configure = vc4_hdmi_encoder_pre_crtc_configure;
- vc4_hdmi->encoder.base.pre_crtc_enable = vc4_hdmi_encoder_pre_crtc_enable;
- vc4_hdmi->encoder.base.post_crtc_enable = vc4_hdmi_encoder_post_crtc_enable;
- vc4_hdmi->encoder.base.post_crtc_disable = vc4_hdmi_encoder_post_crtc_disable;
- vc4_hdmi->encoder.base.post_crtc_powerdown = vc4_hdmi_encoder_post_crtc_powerdown;
+ encoder = &vc4_hdmi->encoder.base;
+ vc4_hdmi->encoder.type = variant->encoder_type;
+ vc4_hdmi->encoder.pre_crtc_configure = vc4_hdmi_encoder_pre_crtc_configure;
+ vc4_hdmi->encoder.pre_crtc_enable = vc4_hdmi_encoder_pre_crtc_enable;
+ vc4_hdmi->encoder.post_crtc_enable = vc4_hdmi_encoder_post_crtc_enable;
+ vc4_hdmi->encoder.post_crtc_disable = vc4_hdmi_encoder_post_crtc_disable;
+ vc4_hdmi->encoder.post_crtc_powerdown = vc4_hdmi_encoder_post_crtc_powerdown;
vc4_hdmi->pdev = pdev;
vc4_hdmi->variant = variant;
@@ -2674,7 +2674,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master,
vc4_hdmi_cec_exit(vc4_hdmi);
vc4_hdmi_hotplug_exit(vc4_hdmi);
vc4_hdmi_connector_destroy(&vc4_hdmi->connector);
- drm_encoder_cleanup(&vc4_hdmi->encoder.base.base);
+ drm_encoder_cleanup(&vc4_hdmi->encoder.base);
pm_runtime_disable(dev);
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index 44977002445f..71768915cc4b 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -8,17 +8,6 @@
#include "vc4_drv.h"
-/* VC4 HDMI encoder KMS struct */
-struct vc4_hdmi_encoder {
- struct vc4_encoder base;
-};
-
-static inline struct vc4_hdmi_encoder *
-to_vc4_hdmi_encoder(struct drm_encoder *encoder)
-{
- return container_of(encoder, struct vc4_hdmi_encoder, base.base);
-}
-
struct vc4_hdmi;
struct vc4_hdmi_register;
struct vc4_hdmi_connector_state;
@@ -127,7 +116,7 @@ struct vc4_hdmi {
struct platform_device *pdev;
const struct vc4_hdmi_variant *variant;
- struct vc4_hdmi_encoder encoder;
+ struct vc4_encoder encoder;
struct drm_connector connector;
struct delayed_work scrambling_work;
@@ -230,8 +219,7 @@ connector_to_vc4_hdmi(struct drm_connector *connector)
static inline struct vc4_hdmi *
encoder_to_vc4_hdmi(struct drm_encoder *encoder)
{
- struct vc4_hdmi_encoder *_encoder = to_vc4_hdmi_encoder(encoder);
-
+ struct vc4_encoder *_encoder = to_vc4_encoder(encoder);
return container_of(_encoder, struct vc4_hdmi, encoder);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] drm/vc4: hdmi: Remove vc4_hdmi_encoder
@ 2022-04-20 11:45 ` José Expósito
0 siblings, 0 replies; 10+ messages in thread
From: José Expósito @ 2022-04-20 11:45 UTC (permalink / raw)
To: emma
Cc: airlied, linux-kernel, dri-devel, laurent.pinchart,
José Expósito
The vc4_hdmi_encoder struct was used exclusively to cache the value
returned by drm_detect_hdmi_monitor() in order to avoid calling it
multiple times.
Now that drm_detect_hdmi_monitor() has been replaced with
drm_display_info.is_hdmi, there is no need to have an extra struct.
Remove vc4_hdmi_encoder.
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 24 ++++++++++++------------
drivers/gpu/drm/vc4/vc4_hdmi.h | 16 ++--------------
2 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 9c73a211ae80..f8d662fde5e0 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -220,7 +220,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
}
}
- vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base.base);
+ vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base);
pm_runtime_put(&vc4_hdmi->pdev->dev);
mutex_unlock(&vc4_hdmi->mutex);
return connector_status_connected;
@@ -357,7 +357,7 @@ static int vc4_hdmi_connector_init(struct drm_device *dev,
struct vc4_hdmi *vc4_hdmi)
{
struct drm_connector *connector = &vc4_hdmi->connector;
- struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
int ret;
drm_connector_init_with_ddc(dev, connector,
@@ -1463,7 +1463,7 @@ static int vc4_hdmi_audio_startup(struct device *dev, void *data)
static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi)
{
- struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
struct device *dev = &vc4_hdmi->pdev->dev;
unsigned long flags;
int ret;
@@ -1553,7 +1553,7 @@ static int vc4_hdmi_audio_prepare(struct device *dev, void *data,
struct hdmi_codec_params *params)
{
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
- struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
unsigned int sample_rate = params->sample_rate;
unsigned int channels = params->channels;
unsigned long flags;
@@ -2506,13 +2506,13 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
INIT_DELAYED_WORK(&vc4_hdmi->scrambling_work, vc4_hdmi_scrambling_wq);
dev_set_drvdata(dev, vc4_hdmi);
- encoder = &vc4_hdmi->encoder.base.base;
- vc4_hdmi->encoder.base.type = variant->encoder_type;
- vc4_hdmi->encoder.base.pre_crtc_configure = vc4_hdmi_encoder_pre_crtc_configure;
- vc4_hdmi->encoder.base.pre_crtc_enable = vc4_hdmi_encoder_pre_crtc_enable;
- vc4_hdmi->encoder.base.post_crtc_enable = vc4_hdmi_encoder_post_crtc_enable;
- vc4_hdmi->encoder.base.post_crtc_disable = vc4_hdmi_encoder_post_crtc_disable;
- vc4_hdmi->encoder.base.post_crtc_powerdown = vc4_hdmi_encoder_post_crtc_powerdown;
+ encoder = &vc4_hdmi->encoder.base;
+ vc4_hdmi->encoder.type = variant->encoder_type;
+ vc4_hdmi->encoder.pre_crtc_configure = vc4_hdmi_encoder_pre_crtc_configure;
+ vc4_hdmi->encoder.pre_crtc_enable = vc4_hdmi_encoder_pre_crtc_enable;
+ vc4_hdmi->encoder.post_crtc_enable = vc4_hdmi_encoder_post_crtc_enable;
+ vc4_hdmi->encoder.post_crtc_disable = vc4_hdmi_encoder_post_crtc_disable;
+ vc4_hdmi->encoder.post_crtc_powerdown = vc4_hdmi_encoder_post_crtc_powerdown;
vc4_hdmi->pdev = pdev;
vc4_hdmi->variant = variant;
@@ -2674,7 +2674,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master,
vc4_hdmi_cec_exit(vc4_hdmi);
vc4_hdmi_hotplug_exit(vc4_hdmi);
vc4_hdmi_connector_destroy(&vc4_hdmi->connector);
- drm_encoder_cleanup(&vc4_hdmi->encoder.base.base);
+ drm_encoder_cleanup(&vc4_hdmi->encoder.base);
pm_runtime_disable(dev);
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index 44977002445f..71768915cc4b 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -8,17 +8,6 @@
#include "vc4_drv.h"
-/* VC4 HDMI encoder KMS struct */
-struct vc4_hdmi_encoder {
- struct vc4_encoder base;
-};
-
-static inline struct vc4_hdmi_encoder *
-to_vc4_hdmi_encoder(struct drm_encoder *encoder)
-{
- return container_of(encoder, struct vc4_hdmi_encoder, base.base);
-}
-
struct vc4_hdmi;
struct vc4_hdmi_register;
struct vc4_hdmi_connector_state;
@@ -127,7 +116,7 @@ struct vc4_hdmi {
struct platform_device *pdev;
const struct vc4_hdmi_variant *variant;
- struct vc4_hdmi_encoder encoder;
+ struct vc4_encoder encoder;
struct drm_connector connector;
struct delayed_work scrambling_work;
@@ -230,8 +219,7 @@ connector_to_vc4_hdmi(struct drm_connector *connector)
static inline struct vc4_hdmi *
encoder_to_vc4_hdmi(struct drm_encoder *encoder)
{
- struct vc4_hdmi_encoder *_encoder = to_vc4_hdmi_encoder(encoder);
-
+ struct vc4_encoder *_encoder = to_vc4_encoder(encoder);
return container_of(_encoder, struct vc4_hdmi, encoder);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: (subset) [PATCH v3 1/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
2022-04-20 11:44 ` José Expósito
@ 2022-04-21 7:07 ` Maxime Ripard
-1 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2022-04-21 7:07 UTC (permalink / raw)
To: emma, José Expósito
Cc: Maxime Ripard, mripard, daniel, laurent.pinchart, dri-devel,
linux-kernel, airlied, p.zabel
On Wed, 20 Apr 2022 13:44:59 +0200, José Expósito wrote:
> Once EDID is parsed, the monitor HDMI support information is cached in
> drm_display_info.is_hdmi by drm_parse_hdmi_vsdb_video().
>
> This driver calls drm_detect_hdmi_monitor() to receive the same
> information and stores its own cached value in
> vc4_hdmi_encoder.hdmi_monitor, which is less efficient.
>
> [...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: (subset) [PATCH v3 1/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
@ 2022-04-21 7:07 ` Maxime Ripard
0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2022-04-21 7:07 UTC (permalink / raw)
To: emma, José Expósito
Cc: airlied, linux-kernel, dri-devel, Maxime Ripard, laurent.pinchart
On Wed, 20 Apr 2022 13:44:59 +0200, José Expósito wrote:
> Once EDID is parsed, the monitor HDMI support information is cached in
> drm_display_info.is_hdmi by drm_parse_hdmi_vsdb_video().
>
> This driver calls drm_detect_hdmi_monitor() to receive the same
> information and stores its own cached value in
> vc4_hdmi_encoder.hdmi_monitor, which is less efficient.
>
> [...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: (subset) [PATCH v3 2/2] drm/vc4: hdmi: Remove vc4_hdmi_encoder
2022-04-20 11:45 ` José Expósito
@ 2022-04-21 7:07 ` Maxime Ripard
-1 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2022-04-21 7:07 UTC (permalink / raw)
To: emma, José Expósito
Cc: Maxime Ripard, mripard, daniel, laurent.pinchart, dri-devel,
airlied, linux-kernel, p.zabel
On Wed, 20 Apr 2022 13:45:00 +0200, José Expósito wrote:
> The vc4_hdmi_encoder struct was used exclusively to cache the value
> returned by drm_detect_hdmi_monitor() in order to avoid calling it
> multiple times.
>
> Now that drm_detect_hdmi_monitor() has been replaced with
> drm_display_info.is_hdmi, there is no need to have an extra struct.
>
> [...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: (subset) [PATCH v3 2/2] drm/vc4: hdmi: Remove vc4_hdmi_encoder
@ 2022-04-21 7:07 ` Maxime Ripard
0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2022-04-21 7:07 UTC (permalink / raw)
To: emma, José Expósito
Cc: airlied, linux-kernel, dri-devel, Maxime Ripard, laurent.pinchart
On Wed, 20 Apr 2022 13:45:00 +0200, José Expósito wrote:
> The vc4_hdmi_encoder struct was used exclusively to cache the value
> returned by drm_detect_hdmi_monitor() in order to avoid calling it
> multiple times.
>
> Now that drm_detect_hdmi_monitor() has been replaced with
> drm_display_info.is_hdmi, there is no need to have an extra struct.
>
> [...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-04-21 7:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 11:44 [PATCH v3 0/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi José Expósito
2022-04-20 11:44 ` José Expósito
2022-04-20 11:44 ` [PATCH v3 1/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi José Expósito
2022-04-20 11:44 ` José Expósito
2022-04-21 7:07 ` (subset) " Maxime Ripard
2022-04-21 7:07 ` Maxime Ripard
2022-04-20 11:45 ` [PATCH v3 2/2] drm/vc4: hdmi: Remove vc4_hdmi_encoder José Expósito
2022-04-20 11:45 ` José Expósito
2022-04-21 7:07 ` (subset) " Maxime Ripard
2022-04-21 7:07 ` Maxime Ripard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.