diff mbox

[13/14] drm: Adjust the maximum value of suggested [X|Y] properties

Message ID 1458027004-3180-13-git-send-email-thellstrom@vmware.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Hellstrom March 15, 2016, 7:30 a.m. UTC
X re-export these values as 32-bit, so they end up as -1.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/drm_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Vetter March 15, 2016, 8:14 a.m. UTC | #1
On Tue, Mar 15, 2016 at 08:30:03AM +0100, Thomas Hellstrom wrote:
> X re-export these values as 32-bit, so they end up as -1.
> 
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

Imo that's a bug in X, and X should clamp the range itself. Not the
kernel. Prop abi is pretty consistent that its all 64bit values.
-Daniel

> ---
>  drivers/gpu/drm/drm_crtc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 8451400..a27b2e0 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1789,10 +1789,10 @@ int drm_mode_create_suggested_offset_properties(struct drm_device *dev)
>  		return 0;
>  
>  	dev->mode_config.suggested_x_property =
> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0xffffffff);
> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0x7fffffff);
>  
>  	dev->mode_config.suggested_y_property =
> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0xffffffff);
> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0x7fffffff);
>  
>  	if (dev->mode_config.suggested_x_property == NULL ||
>  	    dev->mode_config.suggested_y_property == NULL)
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Hellstrom March 15, 2016, 8:32 a.m. UTC | #2
On 03/15/2016 09:14 AM, Daniel Vetter wrote:
> On Tue, Mar 15, 2016 at 08:30:03AM +0100, Thomas Hellstrom wrote:
>> X re-export these values as 32-bit, so they end up as -1.
>>
>> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Imo that's a bug in X, and X should clamp the range itself. Not the
> kernel. Prop abi is pretty consistent that its all 64bit values.
> -Daniel

True. Otoh, we can't really change old X servers to support this, and
the range doesn't really need to be that large.
(It's already restricted to 32 bits and restricting it to 31 bits
doesn't make a big difference).

/Thomas


>
>> ---
>>  drivers/gpu/drm/drm_crtc.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
>> index 8451400..a27b2e0 100644
>> --- a/drivers/gpu/drm/drm_crtc.c
>> +++ b/drivers/gpu/drm/drm_crtc.c
>> @@ -1789,10 +1789,10 @@ int drm_mode_create_suggested_offset_properties(struct drm_device *dev)
>>  		return 0;
>>  
>>  	dev->mode_config.suggested_x_property =
>> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0xffffffff);
>> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0x7fffffff);
>>  
>>  	dev->mode_config.suggested_y_property =
>> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0xffffffff);
>> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0x7fffffff);
>>  
>>  	if (dev->mode_config.suggested_x_property == NULL ||
>>  	    dev->mode_config.suggested_y_property == NULL)
>> -- 
>> 2.5.0
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_dri-2Ddevel&d=BQIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=vpukPkBtpoNQp2IUKuFviOmPNYWVKmen3Jeeu55zmEA&m=tk1_0FQoUlZD2ybivU9sASZgACk0FHEeIHWhp07U3Z0&s=2G9Zzwff6weMglpvwYsaZF9e1ginaxM62nYFBU0x2Bs&e=
Daniel Vetter March 15, 2016, 9:23 a.m. UTC | #3
On Tue, Mar 15, 2016 at 09:32:22AM +0100, Thomas Hellstrom wrote:
> On 03/15/2016 09:14 AM, Daniel Vetter wrote:
> > On Tue, Mar 15, 2016 at 08:30:03AM +0100, Thomas Hellstrom wrote:
> >> X re-export these values as 32-bit, so they end up as -1.
> >>
> >> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > Imo that's a bug in X, and X should clamp the range itself. Not the
> > kernel. Prop abi is pretty consistent that its all 64bit values.
> > -Daniel
> 
> True. Otoh, we can't really change old X servers to support this, and
> the range doesn't really need to be that large.
> (It's already restricted to 32 bits and restricting it to 31 bits
> doesn't make a big difference).

Well if current X is fixed (we don't want to repeat this fun for other
props) then I'm ok with this, with a comment. Just want to avoid working
around bugs in other software for no good reason.
-Daniel

> 
> /Thomas
> 
> 
> >
> >> ---
> >>  drivers/gpu/drm/drm_crtc.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> >> index 8451400..a27b2e0 100644
> >> --- a/drivers/gpu/drm/drm_crtc.c
> >> +++ b/drivers/gpu/drm/drm_crtc.c
> >> @@ -1789,10 +1789,10 @@ int drm_mode_create_suggested_offset_properties(struct drm_device *dev)
> >>  		return 0;
> >>  
> >>  	dev->mode_config.suggested_x_property =
> >> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0xffffffff);
> >> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0x7fffffff);
> >>  
> >>  	dev->mode_config.suggested_y_property =
> >> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0xffffffff);
> >> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0x7fffffff);
> >>  
> >>  	if (dev->mode_config.suggested_x_property == NULL ||
> >>  	    dev->mode_config.suggested_y_property == NULL)
> >> -- 
> >> 2.5.0
> >>
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_dri-2Ddevel&d=BQIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=vpukPkBtpoNQp2IUKuFviOmPNYWVKmen3Jeeu55zmEA&m=tk1_0FQoUlZD2ybivU9sASZgACk0FHEeIHWhp07U3Z0&s=2G9Zzwff6weMglpvwYsaZF9e1ginaxM62nYFBU0x2Bs&e= 
>
Daniel Vetter March 15, 2016, 9:25 a.m. UTC | #4
On Tue, Mar 15, 2016 at 10:23:04AM +0100, Daniel Vetter wrote:
> On Tue, Mar 15, 2016 at 09:32:22AM +0100, Thomas Hellstrom wrote:
> > On 03/15/2016 09:14 AM, Daniel Vetter wrote:
> > > On Tue, Mar 15, 2016 at 08:30:03AM +0100, Thomas Hellstrom wrote:
> > >> X re-export these values as 32-bit, so they end up as -1.
> > >>
> > >> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > > Imo that's a bug in X, and X should clamp the range itself. Not the
> > > kernel. Prop abi is pretty consistent that its all 64bit values.
> > > -Daniel
> > 
> > True. Otoh, we can't really change old X servers to support this, and
> > the range doesn't really need to be that large.
> > (It's already restricted to 32 bits and restricting it to 31 bits
> > doesn't make a big difference).
> 
> Well if current X is fixed (we don't want to repeat this fun for other
> props) then I'm ok with this, with a comment. Just want to avoid working
> around bugs in other software for no good reason.

And S32_MAX for readability please, I can't count rows of fffffff ;-)
-Daniel
Thomas Hellstrom March 15, 2016, 9:26 a.m. UTC | #5
On 03/15/2016 10:23 AM, Daniel Vetter wrote:
> On Tue, Mar 15, 2016 at 09:32:22AM +0100, Thomas Hellstrom wrote:
>> On 03/15/2016 09:14 AM, Daniel Vetter wrote:
>>> On Tue, Mar 15, 2016 at 08:30:03AM +0100, Thomas Hellstrom wrote:
>>>> X re-export these values as 32-bit, so they end up as -1.
>>>>
>>>> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>> Imo that's a bug in X, and X should clamp the range itself. Not the
>>> kernel. Prop abi is pretty consistent that its all 64bit values.
>>> -Daniel
>> True. Otoh, we can't really change old X servers to support this, and
>> the range doesn't really need to be that large.
>> (It's already restricted to 32 bits and restricting it to 31 bits
>> doesn't make a big difference).
> Well if current X is fixed (we don't want to repeat this fun for other
> props) then I'm ok with this, with a comment. Just want to avoid working
> around bugs in other software for no good reason.
> -Daniel

Actually, thinking of it, this only affects the modesetting driver
currently. For the vmwgfx driver the re-exporting of kernel properties
hasn't been formally released yet, so I can just limit the range in
vmwgfx, which is the driver we care most about.

That means I'll be dropping this commit.

/Thomas




>
>> /Thomas
>>
>>
>>>> ---
>>>>  drivers/gpu/drm/drm_crtc.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
>>>> index 8451400..a27b2e0 100644
>>>> --- a/drivers/gpu/drm/drm_crtc.c
>>>> +++ b/drivers/gpu/drm/drm_crtc.c
>>>> @@ -1789,10 +1789,10 @@ int drm_mode_create_suggested_offset_properties(struct drm_device *dev)
>>>>  		return 0;
>>>>  
>>>>  	dev->mode_config.suggested_x_property =
>>>> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0xffffffff);
>>>> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0x7fffffff);
>>>>  
>>>>  	dev->mode_config.suggested_y_property =
>>>> -		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0xffffffff);
>>>> +		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0x7fffffff);
>>>>  
>>>>  	if (dev->mode_config.suggested_x_property == NULL ||
>>>>  	    dev->mode_config.suggested_y_property == NULL)
>>>> -- 
>>>> 2.5.0
>>>>
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_dri-2Ddevel&d=BQIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=vpukPkBtpoNQp2IUKuFviOmPNYWVKmen3Jeeu55zmEA&m=tk1_0FQoUlZD2ybivU9sASZgACk0FHEeIHWhp07U3Z0&s=2G9Zzwff6weMglpvwYsaZF9e1ginaxM62nYFBU0x2Bs&e=
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 8451400..a27b2e0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1789,10 +1789,10 @@  int drm_mode_create_suggested_offset_properties(struct drm_device *dev)
 		return 0;
 
 	dev->mode_config.suggested_x_property =
-		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0xffffffff);
+		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested X", 0, 0x7fffffff);
 
 	dev->mode_config.suggested_y_property =
-		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0xffffffff);
+		drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "suggested Y", 0, 0x7fffffff);
 
 	if (dev->mode_config.suggested_x_property == NULL ||
 	    dev->mode_config.suggested_y_property == NULL)