Re: [Nouveau] [PATCH 08/12] drm/nouveau/graph: enable when using external firmware

2014-04-02 Thread Alexandre Courbot
On Wed, Mar 26, 2014 at 1:21 PM, Ben Skeggs  wrote:
> On Tue, Mar 25, 2014 at 8:58 AM, Thierry Reding
>  wrote:
>> On Mon, Mar 24, 2014 at 05:42:30PM +0900, Alexandre Courbot wrote:
>> [...]
>>> diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c 
>>> b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
>>> index 6ef8bf181b2d..f997a18f5760 100644
>>> --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
>>> +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
>>> @@ -1133,10 +1133,14 @@ nvc0_graph_ctor(struct nouveau_object *parent, 
>>> struct nouveau_object *engine,
>>>   struct nvc0_graph_oclass *oclass = (void *)bclass;
>>>   struct nouveau_device *device = nv_device(parent);
>>>   struct nvc0_graph_priv *priv;
>>> + bool use_fw;
>>
>> Perhaps "ext_fw" or "use_ext_fw" would be more accurate.
>>
>>>   int ret, i;
>>>
>>> + use_fw = nouveau_boolopt(device->cfgopt, "NvGrUseFW", false);
>>> +
>>>   ret = nouveau_graph_create(parent, engine, bclass,
>>> -(oclass->fecs.ucode != NULL), &priv);
>>> +(oclass->fecs.ucode != NULL) || use_fw,
>>> +&priv);
>>
>> Or perhaps a more intuitive way would be to name the variable "enable"
>> and have something like:
>>
>> if (!nouveau_boolopt(device->cfgopt, "NvGrUseFW", false))
>> enable = oclass->fecs.ucode != NULL;
>> else
>> enable = true;
>>
>> ret = nouveau_graph_create(parent, engine, bclass, enable, &priv);
>> ...
> Agreed, this looks a lot nicer.

Will fix that, thanks!
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH 08/12] drm/nouveau/graph: enable when using external firmware

2014-03-25 Thread Ben Skeggs
On Tue, Mar 25, 2014 at 8:58 AM, Thierry Reding
 wrote:
> On Mon, Mar 24, 2014 at 05:42:30PM +0900, Alexandre Courbot wrote:
> [...]
>> diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c 
>> b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
>> index 6ef8bf181b2d..f997a18f5760 100644
>> --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
>> +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
>> @@ -1133,10 +1133,14 @@ nvc0_graph_ctor(struct nouveau_object *parent, 
>> struct nouveau_object *engine,
>>   struct nvc0_graph_oclass *oclass = (void *)bclass;
>>   struct nouveau_device *device = nv_device(parent);
>>   struct nvc0_graph_priv *priv;
>> + bool use_fw;
>
> Perhaps "ext_fw" or "use_ext_fw" would be more accurate.
>
>>   int ret, i;
>>
>> + use_fw = nouveau_boolopt(device->cfgopt, "NvGrUseFW", false);
>> +
>>   ret = nouveau_graph_create(parent, engine, bclass,
>> -(oclass->fecs.ucode != NULL), &priv);
>> +(oclass->fecs.ucode != NULL) || use_fw,
>> +&priv);
>
> Or perhaps a more intuitive way would be to name the variable "enable"
> and have something like:
>
> if (!nouveau_boolopt(device->cfgopt, "NvGrUseFW", false))
> enable = oclass->fecs.ucode != NULL;
> else
> enable = true;
>
> ret = nouveau_graph_create(parent, engine, bclass, enable, &priv);
> ...
Agreed, this looks a lot nicer.

>
> Thierry
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH 08/12] drm/nouveau/graph: enable when using external firmware

2014-03-24 Thread Thierry Reding
On Mon, Mar 24, 2014 at 05:42:30PM +0900, Alexandre Courbot wrote:
[...]
> diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c 
> b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
> index 6ef8bf181b2d..f997a18f5760 100644
> --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
> +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
> @@ -1133,10 +1133,14 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct 
> nouveau_object *engine,
>   struct nvc0_graph_oclass *oclass = (void *)bclass;
>   struct nouveau_device *device = nv_device(parent);
>   struct nvc0_graph_priv *priv;
> + bool use_fw;

Perhaps "ext_fw" or "use_ext_fw" would be more accurate.

>   int ret, i;
>  
> + use_fw = nouveau_boolopt(device->cfgopt, "NvGrUseFW", false);
> +
>   ret = nouveau_graph_create(parent, engine, bclass,
> -(oclass->fecs.ucode != NULL), &priv);
> +(oclass->fecs.ucode != NULL) || use_fw,
> +&priv);

Or perhaps a more intuitive way would be to name the variable "enable"
and have something like:

if (!nouveau_boolopt(device->cfgopt, "NvGrUseFW", false))
enable = oclass->fecs.ucode != NULL;
else
enable = true;

ret = nouveau_graph_create(parent, engine, bclass, enable, &priv);
...

Thierry


pgpZyJacVVZ8O.pgp
Description: PGP signature
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH 08/12] drm/nouveau/graph: enable when using external firmware

2014-03-24 Thread Alexandre Courbot
nvc0_graph_ctor() would only let the graphics engine be enabled if its
oclass has a proper microcode linked to it. This prevents GR from being
enabled at all on chips that rely exclusively on external firmware, even
though such a use-case is valid.

Relax the conditions enabling the GR engine to also include the case
where an external firmware has also been loaded.

Signed-off-by: Alexandre Courbot 
---
 drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c 
b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
index 6ef8bf181b2d..f997a18f5760 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
@@ -1133,10 +1133,14 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct 
nouveau_object *engine,
struct nvc0_graph_oclass *oclass = (void *)bclass;
struct nouveau_device *device = nv_device(parent);
struct nvc0_graph_priv *priv;
+   bool use_fw;
int ret, i;
 
+   use_fw = nouveau_boolopt(device->cfgopt, "NvGrUseFW", false);
+
ret = nouveau_graph_create(parent, engine, bclass,
-  (oclass->fecs.ucode != NULL), &priv);
+  (oclass->fecs.ucode != NULL) || use_fw,
+  &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
@@ -1146,7 +1150,7 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct 
nouveau_object *engine,
 
priv->base.units = nvc0_graph_units;
 
-   if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
+   if (use_fw) {
nv_info(priv, "using external firmware\n");
if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
nvc0_graph_ctor_fw(priv, "fuc409d", &priv->fuc409d) ||
-- 
1.9.1

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau