summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-05-30 12:19:13 +1000
committerDave Airlie <airlied@redhat.com>2008-05-30 12:19:13 +1000
commitb72419a8f74bfb1d3b6a5ca1d8f6dfa3c6a84e86 (patch)
tree26174ea05c2b436816349f6740e38d7e9c1b36fa
parentfae2c17b313e2838652c32ea4a576172b4063639 (diff)
drm: add encoder ids to the output handling
-rw-r--r--linux-core/drm_crtc.c23
-rw-r--r--linux-core/drm_crtc.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index 5d5448c5..fc35c1ab 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -1104,6 +1104,7 @@ int drm_mode_getoutput(struct drm_device *dev,
struct drm_display_mode *mode;
int mode_count = 0;
int props_count = 0;
+ int encoders_count = 0;
int ret = 0;
int copied = 0;
int i;
@@ -1111,6 +1112,7 @@ int drm_mode_getoutput(struct drm_device *dev,
struct drm_mode_modeinfo __user *mode_ptr;
uint32_t __user *prop_ptr;
uint64_t __user *prop_values;
+ uint32_t __user *encoder_ptr;
memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
@@ -1132,6 +1134,12 @@ int drm_mode_getoutput(struct drm_device *dev,
}
}
+ for (i = 0; i < DRM_OUTPUT_MAX_ENCODER; i++) {
+ if (output->encoder_ids[i] != 0) {
+ encoders_count++;
+ }
+ }
+
if (out_resp->count_modes == 0) {
drm_crtc_probe_single_output_modes(output, dev->mode_config.max_width, dev->mode_config.max_height);
}
@@ -1187,6 +1195,21 @@ int drm_mode_getoutput(struct drm_device *dev,
}
out_resp->count_props = props_count;
+ if ((out_resp->count_encoders >= encoders_count) && encoders_count) {
+ copied = 0;
+ encoder_ptr = (uint32_t *)(unsigned long)(out_resp->encoders_ptr);
+ for (i = 0; i < DRM_OUTPUT_MAX_ENCODER; i++) {
+ if (output->encoder_ids[i] != 0) {
+ if (put_user(output->encoder_ids[i], encoder_ptr + copied)) {
+ ret = -EFAULT;
+ goto out;
+ }
+ copied++;
+ }
+ }
+ }
+ out_resp->count_encoders = encoders_count;
+
out:
mutex_unlock(&dev->mode_config.mutex);
return ret;
diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h
index adaa49bd..ed8467e3 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -402,6 +402,7 @@ struct drm_encoder_funcs {
#define DRM_OUTPUT_MAX_UMODES 16
#define DRM_OUTPUT_MAX_PROPERTY 16
#define DRM_OUTPUT_LEN 32
+#define DRM_OUTPUT_MAX_ENCODER 2
/**
* drm_encoder - central DRM encoder structure
@@ -468,6 +469,8 @@ struct drm_output {
uint64_t property_values[DRM_OUTPUT_MAX_PROPERTY];
void *helper_private;
+
+ u32 encoder_ids[DRM_OUTPUT_MAX_ENCODER];
};
/**