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;
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));
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;
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;
}
{ 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
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;
}
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
&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);
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);
}
*/
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;
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);
}
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
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;
}
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;
* @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
*
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;
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;
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,
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;
}
}
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);
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) {
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;
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;
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;
}
{
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
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);
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;
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 */
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");
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));