[PATCH 1/2] drm/vmwgfx: Request SVGA version 2

2010-01-28 Thread Jakob Bornecrantz
From: Peter Hanzel 

This fixes the driver not loading on older versions of VMware.

Signed-off-by: Peter Hanzel 
Signed-off-by: Jakob Bornecrantz 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index f47ff2c..8e68333 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -209,6 +209,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned 
long chipset)
 {
struct vmw_private *dev_priv;
int ret;
+   long svga_id;
 
dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
if (unlikely(dev_priv == NULL)) {
@@ -239,6 +240,13 @@ static int vmw_driver_load(struct drm_device *dev, 
unsigned long chipset)
dev_priv->mmio_start = pci_resource_start(dev->pdev, 2);
 
mutex_lock(&dev_priv->hw_mutex);
+
+   vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
+   svga_id = vmw_read(dev_priv, SVGA_REG_ID);
+   if (svga_id == SVGA_ID_2) {
+   DRM_INFO("We have SVGA ID 2\n");
+   }
+
dev_priv->capabilities = vmw_read(dev_priv, SVGA_REG_CAPABILITIES);
 
if (dev_priv->capabilities & SVGA_CAP_GMR) {
-- 
1.6.0.4


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCH 1/2] drm/vmwgfx: Request SVGA version 2

2010-01-28 Thread Michel Dänzer
On Thu, 2010-01-28 at 18:59 +, Jakob Bornecrantz wrote: 
> From: Peter Hanzel 
> 
> This fixes the driver not loading on older versions of VMware.
> 
> Signed-off-by: Peter Hanzel 
> Signed-off-by: Jakob Bornecrantz 
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
> b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index f47ff2c..8e68333 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -209,6 +209,7 @@ static int vmw_driver_load(struct drm_device *dev, 
> unsigned long chipset)
>  {
>   struct vmw_private *dev_priv;
>   int ret;
> + long svga_id;

This should be uint32_t rather than long.


> @@ -239,6 +240,13 @@ static int vmw_driver_load(struct drm_device *dev, 
> unsigned long chipset)
>   dev_priv->mmio_start = pci_resource_start(dev->pdev, 2);
>  
>   mutex_lock(&dev_priv->hw_mutex);
> +
> + vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
> + svga_id = vmw_read(dev_priv, SVGA_REG_ID);
> + if (svga_id == SVGA_ID_2) {
> + DRM_INFO("We have SVGA ID 2\n");
> + }
> +
>   dev_priv->capabilities = vmw_read(dev_priv, SVGA_REG_CAPABILITIES);
>  
>   if (dev_priv->capabilities & SVGA_CAP_GMR) {


Shouldn't this be something like:

vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); 
svga_id = vmw_read(dev_priv, SVGA_REG_ID);
if (svga_id != SVGA_ID_2) {
DRM_ERROR("Unsupported SVGA ID 0x%lx\n", svga_id);
/* Bail */
}


-- 
Earthling Michel Dänzer   |http://www.vmware.com
Libre software enthusiast |  Debian, X and DRI developer

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCH 1/2] drm/vmwgfx: Request SVGA version 2

2010-01-29 Thread Jakob Bornecrantz
On 29 jan 2010, at 07.57, Michel Dänzer wrote:
> On Thu, 2010-01-28 at 18:59 +, Jakob Bornecrantz wrote:
>> From: Peter Hanzel 
>>
>> This fixes the driver not loading on older versions of VMware.
>>
>> Signed-off-by: Peter Hanzel 
>> Signed-off-by: Jakob Bornecrantz 
>> ---
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |8 
>> 1 files changed, 8 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/ 
>> vmwgfx/vmwgfx_drv.c
>> index f47ff2c..8e68333 100644
>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
>> @@ -209,6 +209,7 @@ static int vmw_driver_load(struct drm_device  
>> *dev, unsigned long chipset)
>> {
>>  struct vmw_private *dev_priv;
>>  int ret;
>> +long svga_id;
>
> This should be uint32_t rather than long.

Ah right.

>
>
>> @@ -239,6 +240,13 @@ static int vmw_driver_load(struct drm_device  
>> *dev, unsigned long chipset)
>>  dev_priv->mmio_start = pci_resource_start(dev->pdev, 2);
>>
>>  mutex_lock(&dev_priv->hw_mutex);
>> +
>> +vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
>> +svga_id = vmw_read(dev_priv, SVGA_REG_ID);
>> +if (svga_id == SVGA_ID_2) {
>> +DRM_INFO("We have SVGA ID 2\n");
>> +}
>> +
>>  dev_priv->capabilities = vmw_read(dev_priv, SVGA_REG_CAPABILITIES);
>>
>>  if (dev_priv->capabilities & SVGA_CAP_GMR) {
>
>
> Shouldn't this be something like:
>
> vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
>   svga_id = vmw_read(dev_priv, SVGA_REG_ID);
>   if (svga_id != SVGA_ID_2) {
>   DRM_ERROR("Unsupported SVGA ID 0x%lx\n", svga_id);
>   /* Bail */
>   }


I guess its better to bail on old hardware that we haven't tested on.

I'll respin this patch.

Cheers Jakob.
--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel