[Intel-gfx] [PATCH V1] drm: export get and put connector type id

Ma, Ling ling.ma at intel.com
Tue May 26 05:12:53 CEST 2009


 

>-----Original Message-----
>From: Eric Anholt [mailto:eric at anholt.net] 
>Sent: Saturday, May 23, 2009 3:12 AM
>To: Ma, Ling
>Cc: dri-devel at lists.sourceforge.net; intel-gfx at lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH V1] drm: export get and put 
>connector type id
>
>On Fri, 2009-05-22 at 20:15 +0800, Ma Ling wrote:
>> We use connector type id as sequence to avoid duplicate 
>connector name.
>> However for some connectors that advertise multiple functions
>> we have to meet the same issue, i.e. connector advertise two 
>functions-
>> DVI and VGA, actually only VGA is real one, in init function 
>card0-VGA-1
>> is allocated for CRT, and card0-DVI-D-1 is allocated for 
>DVI, but until
>> detection process complete we could be aware of VGA, not DVI 
>for this connector,
>> then we change constructed connector type as VGA, which cause that
>> the name card0-VGA-1 would be allocated to both a CRT and 
>that connector.
>> The patch intends to avoid above case by exporting get and 
>put connector type id.
>
>This whole renaming connectors thing seems broken to me.  Whatever
>detection is required should be done once at init, and appropriate
>connectors created.  Is there something preventing that?
>
We determin real output by response from sdvocommand.
 At init if we don't plug any output, the response from sdvo device is 0, 
so we have to chose real output untile detection complete.

Thanks
Ma Ling

>> Signed-off-by: Ma Ling <ling.ma at intel.com>
>> ---
>>  drivers/gpu/drm/drm_crtc.c  |   14 ++++++++++++--
>>  drivers/gpu/drm/drm_sysfs.c |    3 +++
>>  include/drm/drm_crtc.h      |    3 +++
>>  3 files changed, 18 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
>> index 94a7688..a876f71 100644
>> --- a/drivers/gpu/drm/drm_crtc.c
>> +++ b/drivers/gpu/drm/drm_crtc.c
>> @@ -148,6 +148,16 @@ static struct drm_conn_prop_enum_list 
>drm_connector_enum_list[] =
>>  	{ DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 },
>>  };
>>  
>> +int drm_get_connector_type_id(struct drm_connector *connector)
>> +{
>> +	return	
>++drm_connector_enum_list[connector->connector_type].count;
>> +}
>> +
>> +void drm_put_connector_type_id(struct drm_connector *connector)
>> +{
>> +	--drm_connector_enum_list[connector->connector_type].count;
>> +}
>> +
>>  static struct drm_prop_enum_list drm_encoder_enum_list[] =
>>  {	{ DRM_MODE_ENCODER_NONE, "None" },
>>  	{ DRM_MODE_ENCODER_DAC, "DAC" },
>> @@ -451,8 +461,7 @@ void drm_connector_init(struct drm_device *dev,
>>  	connector->funcs = funcs;
>>  	drm_mode_object_get(dev, &connector->base, 
>DRM_MODE_OBJECT_CONNECTOR);
>>  	connector->connector_type = connector_type;
>> -	connector->connector_type_id =
>> -		
>++drm_connector_enum_list[connector_type].count; /* TODO */
>> +	connector->connector_type_id = 
>drm_get_connector_type_id(connector);
>>  	INIT_LIST_HEAD(&connector->user_modes);
>>  	INIT_LIST_HEAD(&connector->probed_modes);
>>  	INIT_LIST_HEAD(&connector->modes);
>> @@ -485,6 +494,7 @@ void drm_connector_cleanup(struct 
>drm_connector *connector)
>>  	struct drm_device *dev = connector->dev;
>>  	struct drm_display_mode *mode, *t;
>>  
>> +	drm_put_connector_type_id(connector);
>>  	list_for_each_entry_safe(mode, t, 
>&connector->probed_modes, head)
>>  		drm_mode_remove(connector, mode);
>>  
>> diff --git a/drivers/gpu/drm/drm_sysfs.c 
>b/drivers/gpu/drm/drm_sysfs.c
>> index 8f93729..b56c0b9 100644
>> --- a/drivers/gpu/drm/drm_sysfs.c
>> +++ b/drivers/gpu/drm/drm_sysfs.c
>> @@ -343,6 +343,8 @@ int drm_sysfs_connector_add(struct 
>drm_connector *connector)
>>  	/* We shouldn't get called more than once for the same 
>connector */
>>  	BUG_ON(device_is_registered(&connector->kdev));
>>  
>> +	drm_put_connector_type_id(connector);
>> +	drm_get_connector_type_id(connector);
>>  	connector->kdev.parent = &dev->primary->kdev;
>>  	connector->kdev.class = drm_class;
>>  	connector->kdev.release = drm_sysfs_device_release;
>> @@ -428,6 +430,7 @@ void drm_sysfs_connector_remove(struct 
>drm_connector *connector)
>>  	DRM_DEBUG("removing \"%s\" from sysfs\n",
>>  		  drm_get_connector_name(connector));
>>  
>> +	drm_put_connector_type_id(connector);
>>  	for (i = 0; i < ARRAY_SIZE(connector_attrs); i++)
>>  		device_remove_file(&connector->kdev, 
>&connector_attrs[i]);
>>  	sysfs_remove_bin_file(&connector->kdev.kobj, &edid_attr);
>> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
>> index 3c1924c..64ce824 100644
>> --- a/include/drm/drm_crtc.h
>> +++ b/include/drm/drm_crtc.h
>> @@ -733,4 +733,7 @@ extern int 
>drm_mode_gamma_get_ioctl(struct drm_device *dev,
>>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
>>  				    void *data, struct drm_file 
>*file_priv);
>>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
>> +
>> +extern int drm_get_connector_type_id(struct drm_connector 
>*connector);
>> +extern void drm_put_connector_type_id(struct drm_connector 
>*connector);
>>  #endif /* __DRM_CRTC_H__ */
>> -- 
>> 1.5.4.4
>> 
>> 
>> 
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>-- 
>Eric Anholt
>eric at anholt.net                         eric.anholt at intel.com
>
>
>


More information about the Intel-gfx mailing list