drm: Add update_native_mode callback to connectors
Subsystems (3)
RFC PATCH 1/1 drm: Add update_native_mode callback to connectors
When reading EDID from firmware file, the nouveau driver can not setup it's native_mode like when reading EDID from hardware.
Add this callback to allow driver to update their native_mode.
---
This might be a fast forward hack. I'm wondering if there is a better way to achieve the same.
The actual problem is that nv_connector->native_mode stays NULL when EDID is read from file instead of hardware because nouveau_connector_get_modes isn't called in that case. Neither is nouveau_connector_native_mode which would update native_mode.
drivers/gpu/drm/drm_crtc_helper.c | 3 +++ drivers/gpu/drm/nouveau/nouveau_connector.c | 11 +++++++++++ include/drm/drm_crtc_helper.h | 1 + 3 files changed, 15 insertions(+)
drivers/gpu/drm/drm_crtc_helper.c +3 -0
@@ -173,6 +173,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,if (count ==0 ) goto prune; +if (*connector_funcs->update_native_mode) + (*connector_funcs->update_native_mode)(connector); +drm_mode_connector_list_update (connector);if (maxX && maxY)
drivers/gpu/drm/nouveau/nouveau_connector.c +11 -0
@@ -880,11 +880,22 @@ nouveau_connector_best_encoder(struct drm_connector *connector)return NULL ; } +static void +nouveau_connector_update_native_mode (struct drm_connector *connector) +{ +struct nouveau_connector *nv_connector =nouveau_connector (connector); + +if (!nv_connector->native_mode) + nv_connector->native_mode = +nouveau_connector_native_mode (connector); +} +static const struct drm_connector_helper_funcs nouveau_connector_helper_funcs = { .get_modes = nouveau_connector_get_modes, .mode_valid = nouveau_connector_mode_valid, .best_encoder = nouveau_connector_best_encoder, + .update_native_mode = nouveau_connector_update_native_mode, }; static const struct drm_connector_funcs
include/drm/drm_crtc_helper.h +1 -0
@@ -123,6 +123,7 @@ struct drm_connector_helper_funcs {enum drm_mode_status (*mode_valid)(struct drm_connector *connector,struct drm_display_mode *mode);struct drm_encoder *(*best_encoder)(struct drm_connector *connector); +void (*update_native_mode)(struct drm_connector *connector); };extern int drm_helper_probe_single_connector_modes (struct drm_connector *connector,uint32_t maxX,uint32_t maxY);
Signature · 1 line
1.9.0
A message that is not in the archive (sent off-list or not yet received): 1395185950-14191-1-git-send-email-alexanders83-S0/[email protected]
Any updates on this?
Alexander
On Wednesday 19 March 2014, 00:39:10 wrote Alexander Stein:
Quoted 72 lines
When reading EDID from firmware file, the nouveau driver can not setup it's
native_modelike when reading EDID from hardware.
Add this callback to allow driver to update theirnative_mode.Signed-off-by Alexander Stein <alexanders83-S0/[email protected]>---
This might be a fast forward hack. I'm wondering if there is a better way to achieve the same.
The actual problem is thatnv_connector->native_modestays NULL when EDID is read from file instead of hardware becausenouveau_connector_get_modesisn't called in that case. Neither isnouveau_connector_native_modewhich would updatenative_mode.drivers/gpu/drm/drm_crtc_helper.c | 3 +++ drivers/gpu/drm/nouveau/nouveau_connector.c | 11 +++++++++++ include/drm/drm_crtc_helper.h | 1 + 3 files changed, 15 insertions(+)drivers/gpu/drm/drm_crtc_helper.c +3
-0@@ -173,6 +173,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,if (count ==0 ) goto prune; +if (*connector_funcs->update_native_mode) + (*connector_funcs->update_native_mode)(connector); +drm_mode_connector_list_update (connector);if (maxX && maxY)drivers/gpu/drm/nouveau/nouveau_connector.c +11
-0@@ -880,11 +880,22 @@ nouveau_connector_best_encoder(struct drm_connector *connector)return NULL ; } +static void +nouveau_connector_update_native_mode (struct drm_connector *connector) +{ +struct nouveau_connector *nv_connector =nouveau_connector (connector); + +if (!nv_connector->native_mode) + nv_connector->native_mode = +nouveau_connector_native_mode (connector); +} +static const struct drm_connector_helper_funcs nouveau_connector_helper_funcs = { .get_modes = nouveau_connector_get_modes, .mode_valid = nouveau_connector_mode_valid, .best_encoder = nouveau_connector_best_encoder, + .update_native_mode = nouveau_connector_update_native_mode, }; static const struct drm_connector_funcsinclude/drm/drm_crtc_helper.h +1
-0@@ -123,6 +123,7 @@ struct drm_connector_helper_funcs {enum drm_mode_status (*mode_valid)(struct drm_connector *connector,struct drm_display_mode *mode);struct drm_encoder *(*best_encoder)(struct drm_connector *connector); +void (*update_native_mode)(struct drm_connector *connector); };extern int drm_helper_probe_single_connector_modes (struct drm_connector *connector,uint32_t maxX,uint32_t maxY);