summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdrm/xf86drmMode.c6
-rw-r--r--libdrm/xf86drmMode.h3
-rw-r--r--linux-core/drm_bo.c2
-rw-r--r--linux-core/drm_crtc.c68
-rw-r--r--linux-core/drm_crtc.h12
-rw-r--r--linux-core/drm_edid.c6
-rw-r--r--linux-core/intel_crt.c3
-rw-r--r--linux-core/intel_lvds.c3
-rw-r--r--linux-core/intel_sdvo.c31
-rw-r--r--shared-core/drm.h9
-rw-r--r--shared-core/i915_init.c4
-rw-r--r--tests/mode/modetest.c2
12 files changed, 70 insertions, 79 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index 726c55ab..0edb1d7d 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -328,6 +328,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
drmModeOutputPtr r = NULL;
out.output = output_id;
+ out.output_type_id = 0;
+ out.output_type = 0;
out.count_crtcs = 0;
out.crtcs = 0;
out.count_clones = 0;
@@ -372,8 +374,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
r->props = drmAllocCpy(U642VOID(out.props_ptr), out.count_props, sizeof(uint32_t));
r->prop_values = drmAllocCpy(U642VOID(out.prop_values_ptr), out.count_props, sizeof(uint64_t));
r->modes = drmAllocCpy(U642VOID(out.modes_ptr), out.count_modes, sizeof(struct drm_mode_modeinfo));
- strncpy(r->name, out.name, DRM_OUTPUT_NAME_LEN);
- r->name[DRM_OUTPUT_NAME_LEN-1] = 0;
+ r->output_type = out.output_type;
+ r->output_type_id = out.output_type_id;
err_allocs:
drmFree(U642VOID(out.prop_values_ptr));
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index 05b61bc8..e2dda8ac 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -125,7 +125,8 @@ typedef struct _drmModeOutput {
unsigned int output_id;
unsigned int crtc; /**< Crtc currently connected to */
- unsigned char name[DRM_OUTPUT_NAME_LEN];
+ unsigned int output_type;
+ unsigned int output_type_id;
drmModeConnection connection;
uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
drmModeSubPixel subpixel;
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 7a123dad..c89d6608 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1650,7 +1650,7 @@ int drm_buffer_object_create(struct drm_device *dev,
size += buffer_start & ~PAGE_MASK;
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
if (num_pages == 0) {
- DRM_ERROR("Illegal buffer object size.\n");
+ DRM_ERROR("Illegal buffer object size %d.\n", size);
return -EINVAL;
}
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index e1b37c0b..9a840ea1 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -58,7 +58,22 @@ static struct drm_prop_enum_list drm_conn_enum_list[] =
{ ConnectorHDMIA, "HDMI Type A" },
{ ConnectorHDMIB, "HDMI Type B" },
};
+static struct drm_prop_enum_list drm_output_enum_list[] =
+{ { DRM_MODE_OUTPUT_NONE, "None" },
+ { DRM_MODE_OUTPUT_DAC, "DAC" },
+ { DRM_MODE_OUTPUT_TMDS, "TMDS" },
+ { DRM_MODE_OUTPUT_LVDS, "LVDS" },
+ { DRM_MODE_OUTPUT_TVDAC, "TV" },
+};
+char *drm_get_output_name(struct drm_output *output)
+{
+ static char buf[32];
+
+ snprintf(buf, 32, "%s-%d", drm_output_enum_list[output->output_type].name,
+ output->output_type_id);
+ return buf;
+}
/**
* drm_idr_get - allocate a new identifier
@@ -322,7 +337,7 @@ void drm_crtc_probe_single_output_modes(struct drm_output *output, int maxX, int
output->status = (*output->funcs->detect)(output);
if (output->status == output_status_disconnected) {
- DRM_DEBUG("%s is disconnected\n", output->name);
+ DRM_DEBUG("%s is disconnected\n", drm_get_output_name(output));
/* TODO set EDID to NULL */
return;
}
@@ -347,7 +362,7 @@ void drm_crtc_probe_single_output_modes(struct drm_output *output, int maxX, int
if (list_empty(&output->modes)) {
struct drm_display_mode *stdmode;
- DRM_DEBUG("No valid modes on %s\n", output->name);
+ DRM_DEBUG("No valid modes on %s\n", drm_get_output_name(output));
/* Should we do this here ???
* When no valid EDID modes are available we end up
@@ -360,12 +375,12 @@ void drm_crtc_probe_single_output_modes(struct drm_output *output, int maxX, int
&output->modes);
DRM_DEBUG("Adding standard 640x480 @ 60Hz to %s\n",
- output->name);
+ drm_get_output_name(output));
}
drm_mode_sort(&output->modes);
- DRM_DEBUG("Probed modes for %s\n", output->name);
+ DRM_DEBUG("Probed modes for %s\n", drm_get_output_name(output));
list_for_each_entry_safe(mode, t, &output->modes, head) {
mode->vrefresh = drm_mode_vrefresh(mode);
@@ -472,7 +487,7 @@ bool drm_crtc_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
if (output->crtc != crtc)
continue;
- DRM_INFO("%s: set mode %s %x\n", output->name, mode->name, mode->mode_id);
+ DRM_INFO("%s: set mode %s %x\n", drm_get_output_name(output), mode->name, mode->mode_id);
output->funcs->mode_set(output, mode, adjusted_mode);
}
@@ -591,7 +606,7 @@ EXPORT_SYMBOL(drm_mode_remove);
*/
struct drm_output *drm_output_create(struct drm_device *dev,
const struct drm_output_funcs *funcs,
- const char *name)
+ int output_type)
{
struct drm_output *output = NULL;
@@ -602,9 +617,8 @@ struct drm_output *drm_output_create(struct drm_device *dev,
output->dev = dev;
output->funcs = funcs;
output->id = drm_idr_get(dev, output);
- if (name)
- strncpy(output->name, name, DRM_OUTPUT_LEN);
- output->name[DRM_OUTPUT_LEN - 1] = 0;
+ output->output_type = output_type;
+ output->output_type_id = 1; /* TODO */
output->subpixel_order = SubPixelUnknown;
INIT_LIST_HEAD(&output->user_modes);
INIT_LIST_HEAD(&output->probed_modes);
@@ -663,35 +677,6 @@ void drm_output_destroy(struct drm_output *output)
}
EXPORT_SYMBOL(drm_output_destroy);
-/**
- * drm_output_rename - rename an output
- * @output: output to rename
- * @name: new user visible name
- *
- * LOCKING:
- * None.
- *
- * Simply stuff a new name into @output's name field, based on @name.
- *
- * RETURNS:
- * True if the name was changed, false otherwise.
- */
-bool drm_output_rename(struct drm_output *output, const char *name)
-{
- if (!name)
- return false;
-
- strncpy(output->name, name, DRM_OUTPUT_LEN);
- output->name[DRM_OUTPUT_LEN - 1] = 0;
-
- DRM_DEBUG("Changed name to %s\n", output->name);
-// drm_output_set_monitor(output);
-// if (drm_output_ignored(output))
-// return FALSE;
-
- return TRUE;
-}
-EXPORT_SYMBOL(drm_output_rename);
/**
* drm_mode_create - create a new display mode
@@ -912,7 +897,7 @@ static void drm_pick_crtcs (struct drm_device *dev)
list_for_each_entry(modes_equal, &output_equal->modes, head) {
if (drm_mode_equal (modes, modes_equal)) {
if ((output->possible_clones & output_equal->possible_clones) && (output_equal->crtc == crtc)) {
- printk("Cloning %s (0x%lx) to %s (0x%lx)\n",output->name,output->possible_clones,output_equal->name,output_equal->possible_clones);
+ printk("Cloning %s (0x%lx) to %s (0x%lx)\n",drm_get_output_name(output),output->possible_clones,drm_get_output_name(output_equal),output_equal->possible_clones);
assigned = 0;
goto clone;
}
@@ -1408,9 +1393,8 @@ int drm_mode_getoutput(struct drm_device *dev,
drm_crtc_probe_single_output_modes(output, dev->mode_config.max_width, dev->mode_config.max_height);
}
- strncpy(out_resp->name, output->name, DRM_OUTPUT_NAME_LEN);
- out_resp->name[DRM_OUTPUT_NAME_LEN-1] = 0;
-
+ out_resp->output_type = output->output_type;
+ out_resp->output_type_id = output->output_type_id;
out_resp->mm_width = output->mm_width;
out_resp->mm_height = output->mm_height;
out_resp->subpixel = output->subpixel_order;
diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h
index 6b6e1dbf..dbb41867 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -433,7 +433,6 @@ struct drm_output_funcs {
* @subpixel_order: for this output
* @mm_width: displayable width of output in mm
* @mm_height: displayable height of output in mm
- * @name: name of output (should be one of a few standard names)
* @funcs: output control functions
* @driver_private: private driver data
*
@@ -447,6 +446,9 @@ struct drm_output {
struct list_head head;
struct drm_crtc *crtc;
int id; /* idr assigned */
+
+ int output_type;
+ int output_type_id;
unsigned long possible_crtcs;
unsigned long possible_clones;
bool interlace_allowed;
@@ -467,8 +469,7 @@ struct drm_output {
enum subpixel_order subpixel_order;
int mm_width, mm_height;
struct drm_display_info *monitor_info; /* if any */
- char name[DRM_OUTPUT_LEN];
- const struct drm_output_funcs *funcs;
+ const struct drm_output_funcs *funcs;
void *driver_private;
struct list_head user_modes;
@@ -526,9 +527,10 @@ struct drm_mode_config {
struct drm_output *drm_output_create(struct drm_device *dev,
const struct drm_output_funcs *funcs,
- const char *name);
+ int type);
+
+extern char *drm_get_output_name(struct drm_output *output);
extern void drm_output_destroy(struct drm_output *output);
-extern bool drm_output_rename(struct drm_output *output, const char *name);
extern void drm_fb_release(struct file *filp);
extern struct edid *drm_get_edid(struct drm_output *output,
diff --git a/linux-core/drm_edid.c b/linux-core/drm_edid.c
index 7068cef3..41aa8f5e 100644
--- a/linux-core/drm_edid.c
+++ b/linux-core/drm_edid.c
@@ -443,12 +443,12 @@ struct edid *drm_get_edid(struct drm_output *output,
edid = (struct edid *)drm_ddc_read(adapter);
if (!edid) {
dev_warn(&output->dev->pdev->dev, "%s: no EDID data\n",
- output->name);
+ drm_get_output_name(output));
return NULL;
}
if (!edid_valid(edid)) {
dev_warn(&output->dev->pdev->dev, "%s: EDID invalid.\n",
- output->name);
+ drm_get_output_name(output));
kfree(edid);
return NULL;
}
@@ -474,7 +474,7 @@ int drm_add_edid_modes(struct drm_output *output, struct edid *edid)
}
if (!edid_valid(edid)) {
dev_warn(&output->dev->pdev->dev, "%s: EDID invalid.\n",
- output->name);
+ drm_get_output_name(output));
return 0;
}
num_modes += add_established_modes(output, edid);
diff --git a/linux-core/intel_crt.c b/linux-core/intel_crt.c
index 722a62c8..74e3dcd6 100644
--- a/linux-core/intel_crt.c
+++ b/linux-core/intel_crt.c
@@ -240,7 +240,8 @@ void intel_crt_init(struct drm_device *dev)
struct drm_output *output;
struct intel_output *intel_output;
- output = drm_output_create(dev, &intel_crt_output_funcs, "VGA");
+ output = drm_output_create(dev, &intel_crt_output_funcs,
+ DRM_MODE_OUTPUT_DAC);
intel_output = kmalloc(sizeof(struct intel_output), GFP_KERNEL);
if (!intel_output) {
diff --git a/linux-core/intel_lvds.c b/linux-core/intel_lvds.c
index 94232b94..80f77af6 100644
--- a/linux-core/intel_lvds.c
+++ b/linux-core/intel_lvds.c
@@ -372,7 +372,8 @@ void intel_lvds_init(struct drm_device *dev)
u32 lvds;
int pipe;
- output = drm_output_create(dev, &intel_lvds_output_funcs, "LVDS");
+ output = drm_output_create(dev, &intel_lvds_output_funcs,
+ DRM_MODE_OUTPUT_LVDS);
if (!output)
return;
diff --git a/linux-core/intel_sdvo.c b/linux-core/intel_sdvo.c
index 0da57faa..7f55829b 100644
--- a/linux-core/intel_sdvo.c
+++ b/linux-core/intel_sdvo.c
@@ -953,12 +953,10 @@ void intel_sdvo_init(struct drm_device *dev, int output_device)
int connector_type;
u8 ch[0x40];
int i;
- char name[DRM_OUTPUT_LEN];
- char *name_prefix;
- char *name_suffix;
-
+ int output_type, output_id;
- output = drm_output_create(dev, &intel_sdvo_output_funcs, NULL);
+ output = drm_output_create(dev, &intel_sdvo_output_funcs,
+ DRM_MODE_OUTPUT_NONE);
if (!output)
return;
@@ -988,10 +986,10 @@ void intel_sdvo_init(struct drm_device *dev, int output_device)
sdvo_priv->i2c_bus = i2cbus;
if (output_device == SDVOB) {
- name_suffix = "-1";
+ output_id = 1;
sdvo_priv->i2c_bus->slave_addr = 0x38;
} else {
- name_suffix = "-2";
+ output_id = 2;
sdvo_priv->i2c_bus->slave_addr = 0x39;
}
@@ -1019,28 +1017,28 @@ void intel_sdvo_init(struct drm_device *dev, int output_device)
{
sdvo_priv->active_outputs = SDVO_OUTPUT_RGB0;
output->subpixel_order = SubPixelHorizontalRGB;
- name_prefix="RGB";
+ output_type = DRM_MODE_OUTPUT_DAC;
connector_type = ConnectorVGA;
}
else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1)
{
sdvo_priv->active_outputs = SDVO_OUTPUT_RGB1;
output->subpixel_order = SubPixelHorizontalRGB;
- name_prefix="RGB";
+ output_type = DRM_MODE_OUTPUT_DAC;
connector_type = ConnectorVGA;
}
else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS0)
{
sdvo_priv->active_outputs = SDVO_OUTPUT_TMDS0;
output->subpixel_order = SubPixelHorizontalRGB;
- name_prefix="TMDS";
+ output_type = DRM_MODE_OUTPUT_TMDS;
connector_type = ConnectorDVID;
}
else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS1)
{
sdvo_priv->active_outputs = SDVO_OUTPUT_TMDS1;
output->subpixel_order = SubPixelHorizontalRGB;
- name_prefix="TMDS";
+ output_type = DRM_MODE_OUTPUT_TMDS;
connector_type = ConnectorDVID;
}
else
@@ -1054,14 +1052,9 @@ void intel_sdvo_init(struct drm_device *dev, int output_device)
drm_output_destroy(output);
return;
}
- strcpy (name, name_prefix);
- strcat (name, name_suffix);
- if (!drm_output_rename(output, name))
- {
- drm_output_destroy(output);
- return;
- }
-
+
+ output->output_type = output_type;
+ output->output_type_id = output_id;
/* Set the input timing to the screen. Assume always input 0. */
intel_sdvo_set_target_input(output, true, false);
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 9a8dc1d2..f8d44048 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -950,6 +950,12 @@ struct drm_mode_crtc {
struct drm_mode_modeinfo mode;
};
+#define DRM_MODE_OUTPUT_NONE 0
+#define DRM_MODE_OUTPUT_DAC 1
+#define DRM_MODE_OUTPUT_TMDS 2
+#define DRM_MODE_OUTPUT_LVDS 3
+#define DRM_MODE_OUTPUT_TVDAC 4
+
struct drm_mode_get_output {
uint64_t modes_ptr;
@@ -960,7 +966,8 @@ struct drm_mode_get_output {
int count_props;
unsigned int output; /**< Id */
unsigned int crtc; /**< Id of crtc */
- unsigned char name[DRM_OUTPUT_NAME_LEN];
+ unsigned int output_type;
+ unsigned int output_type_id;
unsigned int connection;
unsigned int mm_width, mm_height; /**< HxW in millimeters */
diff --git a/shared-core/i915_init.c b/shared-core/i915_init.c
index 3b43c722..e44cb930 100644
--- a/shared-core/i915_init.c
+++ b/shared-core/i915_init.c
@@ -188,8 +188,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
ret = drm_buffer_object_create(dev, size, drm_bo_type_kernel,
DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE |
DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_NO_EVICT |
- DRM_BO_HINT_DONT_FENCE, 0, 0x1, 0,
+ DRM_BO_FLAG_NO_EVICT,
+ DRM_BO_HINT_DONT_FENCE, 0x1, 0,
&dev_priv->ring_buffer);
if (ret < 0) {
DRM_ERROR("Unable to allocate or pin ring buffer\n");
diff --git a/tests/mode/modetest.c b/tests/mode/modetest.c
index f1fe64df..bd8372dc 100644
--- a/tests/mode/modetest.c
+++ b/tests/mode/modetest.c
@@ -54,7 +54,7 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id)
drmModePropertyPtr props;
unsigned char *name = NULL;
- printf("Output: %s\n", output->name);
+ printf("Output: %d-%d\n", output->output_type, output->output_type_id);
printf("\tid : %i\n", id);
printf("\tcrtc id : %i\n", output->crtc);
printf("\tconn : %s\n", getConnectionText(output->connection));