summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2007-12-18 19:18:21 +1100
committerDave Airlie <airlied@redhat.com>2007-12-18 19:18:21 +1100
commit629231c62675fe09f4eb948861a21980a9b79a5a (patch)
tree097ebcbb9f305fdac4cb3ebc15ef89bb8cea20fd /linux-core
parentea915c77e169a50ca7dc557512212eafa93e2205 (diff)
parent6d03411e5faa124bac014ebacec470ffd7cf2ce4 (diff)
Merge branch 'modesetting-airlied' into modesetting-101
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_bo.c2
-rw-r--r--linux-core/drm_crtc.c69
-rw-r--r--linux-core/drm_crtc.h14
-rw-r--r--linux-core/drm_edid.c6
-rw-r--r--linux-core/drm_fops.c2
-rw-r--r--linux-core/intel_crt.c3
-rw-r--r--linux-core/intel_lvds.c3
-rw-r--r--linux-core/intel_sdvo.c31
8 files changed, 55 insertions, 75 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 068ccf00..e4ec24e2 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1649,7 +1649,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 4397b867..fef2700a 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
@@ -150,7 +165,6 @@ struct drm_framebuffer *drm_framebuffer_create(struct drm_device *dev)
/* Limit to single framebuffer for now */
if (dev->mode_config.num_fb > 1) {
- mutex_unlock(&dev->mode_config.mutex);
DRM_ERROR("Attempt to add multiple framebuffers failed\n");
return NULL;
}
@@ -322,7 +336,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 +361,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 +374,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);
@@ -473,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);
}
@@ -593,7 +607,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;
@@ -604,9 +618,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);
@@ -665,35 +678,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
@@ -914,7 +898,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;
}
@@ -1458,9 +1442,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 ce502062..54e0c000 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,10 +469,9 @@ 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;
-
+ uint32_t make_shit_work;
struct list_head user_modes;
struct drm_property_blob *edid_blob_ptr;
u32 property_ids[DRM_OUTPUT_MAX_PROPERTY];
@@ -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/drm_fops.c b/linux-core/drm_fops.c
index cc09fc14..7efcb23f 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -472,8 +472,8 @@ int drm_release(struct inode *inode, struct file *filp)
}
mutex_unlock(&dev->ctxlist_mutex);
- mutex_lock(&dev->struct_mutex);
drm_fb_release(filp);
+ mutex_lock(&dev->struct_mutex);
drm_object_release(filp);
if (file_priv->remove_auth_on_close == 1) {
struct drm_file *temp;
diff --git a/linux-core/intel_crt.c b/linux-core/intel_crt.c
index 864b1a25..4be71cba 100644
--- a/linux-core/intel_crt.c
+++ b/linux-core/intel_crt.c
@@ -250,7 +250,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 1d7d0b7d..3887df00 100644
--- a/linux-core/intel_sdvo.c
+++ b/linux-core/intel_sdvo.c
@@ -1033,12 +1033,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;
@@ -1068,10 +1066,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;
}
@@ -1100,28 +1098,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
@@ -1135,14 +1133,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);