@@ -1711,44 +1711,6 @@ void drm_reinit_primary_mode_group(struct drm_device *dev)
EXPORT_SYMBOL(drm_reinit_primary_mode_group);
/**
- * drm_crtc_convert_to_umode - convert a drm_display_mode into a modeinfo
- * @out: drm_mode_modeinfo struct to return to the user
- * @in: drm_display_mode to use
- *
- * Convert a drm_display_mode into a drm_mode_modeinfo structure to return to
- * the user.
- */
-static void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,
- const struct drm_display_mode *in)
-{
- WARN(in->hdisplay > USHRT_MAX || in->hsync_start > USHRT_MAX ||
- in->hsync_end > USHRT_MAX || in->htotal > USHRT_MAX ||
- in->hskew > USHRT_MAX || in->vdisplay > USHRT_MAX ||
- in->vsync_start > USHRT_MAX || in->vsync_end > USHRT_MAX ||
- in->vtotal > USHRT_MAX || in->vscan > USHRT_MAX,
- "timing values too large for mode info\n");
-
- out->clock = in->clock;
- out->hdisplay = in->hdisplay;
- out->hsync_start = in->hsync_start;
- out->hsync_end = in->hsync_end;
- out->htotal = in->htotal;
- out->hskew = in->hskew;
- out->vdisplay = in->vdisplay;
- out->vsync_start = in->vsync_start;
- out->vsync_end = in->vsync_end;
- out->vtotal = in->vtotal;
- out->vscan = in->vscan;
- out->vrefresh = in->vrefresh;
- out->flags = in->flags;
- out->type = in->type;
- strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
- out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
-}
-
-
-
-/**
* drm_mode_getresources - get graphics configuration
* @dev: drm device for the ioctl
* @data: data pointer for the ioctl
@@ -1975,7 +1937,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
crtc_resp->y = crtc->primary->state->src_y >> 16;
if (crtc->state->enable) {
WARN_ON(!crtc->state->mode);
- drm_crtc_convert_to_umode(&crtc_resp->mode, crtc->state->mode);
+ drm_mode_convert_to_umode(&crtc_resp->mode, crtc->state->mode);
crtc_resp->mode_valid = 1;
} else {
@@ -1986,7 +1948,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
crtc_resp->y = crtc->y;
if (crtc->enabled) {
WARN_ON(!crtc->mode);
- drm_crtc_convert_to_umode(&crtc_resp->mode,
+ drm_mode_convert_to_umode(&crtc_resp->mode,
crtc->mode);
crtc_resp->mode_valid = 1;
@@ -2144,7 +2106,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
if (!drm_mode_expose_to_userspace(mode, file_priv))
continue;
- drm_crtc_convert_to_umode(&u_mode, mode);
+ drm_mode_convert_to_umode(&u_mode, mode);
if (copy_to_user(mode_ptr + copied,
&u_mode, sizeof(u_mode))) {
ret = -EFAULT;
@@ -892,6 +892,42 @@ struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
EXPORT_SYMBOL(drm_mode_duplicate);
/**
+ * drm_mode_convert_to_umode - convert a drm_display_mode into a modeinfo
+ * @out: drm_mode_modeinfo struct to return to the user
+ * @in: drm_display_mode to use
+ *
+ * Convert a drm_display_mode into a drm_mode_modeinfo structure to return to
+ * the user.
+ */
+void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
+ const struct drm_display_mode *in)
+{
+ WARN(in->hdisplay > USHRT_MAX || in->hsync_start > USHRT_MAX ||
+ in->hsync_end > USHRT_MAX || in->htotal > USHRT_MAX ||
+ in->hskew > USHRT_MAX || in->vdisplay > USHRT_MAX ||
+ in->vsync_start > USHRT_MAX || in->vsync_end > USHRT_MAX ||
+ in->vtotal > USHRT_MAX || in->vscan > USHRT_MAX,
+ "timing values too large for mode info\n");
+
+ out->clock = in->clock;
+ out->hdisplay = in->hdisplay;
+ out->hsync_start = in->hsync_start;
+ out->hsync_end = in->hsync_end;
+ out->htotal = in->htotal;
+ out->hskew = in->hskew;
+ out->vdisplay = in->vdisplay;
+ out->vsync_start = in->vsync_start;
+ out->vsync_end = in->vsync_end;
+ out->vtotal = in->vtotal;
+ out->vscan = in->vscan;
+ out->vrefresh = in->vrefresh;
+ out->flags = in->flags;
+ out->type = in->type;
+ strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
+ out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
+}
+
+/**
* drm_mode_new_from_umode - convert a modeinfo into a drm_display_mode
* @dev: DRM device to create mode for
* @in: drm_mode_modeinfo to use
@@ -218,6 +218,8 @@ struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
const struct drm_display_mode *mode);
struct drm_display_mode *drm_mode_new_from_umode(struct drm_device *dev,
const struct drm_mode_modeinfo *in);
+void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
+ const struct drm_display_mode *in);
bool drm_mode_equal(const struct drm_display_mode *mode1,
const struct drm_display_mode *mode2);
bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
This will become useful for us in generic mode-handling code later. Signed-off-by: Daniel Stone <daniels@collabora.com> --- drivers/gpu/drm/drm_crtc.c | 44 +++----------------------------------------- drivers/gpu/drm/drm_modes.c | 36 ++++++++++++++++++++++++++++++++++++ include/drm/drm_modes.h | 2 ++ 3 files changed, 41 insertions(+), 41 deletions(-)