st/dri2: fix kms_swrast driconf option handling

Submitted by Rob Herring on Aug. 8, 2017, 4:50 p.m.

Details

Message ID 20170808165023.10141-1-robh@kernel.org
State New
Headers show
Series "st/dri2: fix kms_swrast driconf option handling" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Rob Herring Aug. 8, 2017, 4:50 p.m.
Commit e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
moved the option cache to the pipe_loader_device. However, the
screen->dev pointer is not set when dri_init_options() is called. Move
the call to after the pipe_loader_sw_probe_kms() call so screen->dev is
set. This mirrors the code flow for dri2_init_screen().

Fixes: e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 src/gallium/state_trackers/dri/dri2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 3555107856c8..680826f58144 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -2164,9 +2164,8 @@  dri_kms_init_screen(__DRIscreen * sPriv)
    if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
       goto free_screen;
 
-   dri_init_options(screen);
-
    if (pipe_loader_sw_probe_kms(&screen->dev, fd))
+      dri_init_options(screen);
       pscreen = pipe_loader_create_screen(screen->dev);
 
    if (!pscreen)

Comments

On Tue, Aug 8, 2017 at 12:50 PM, Rob Herring <robh@kernel.org> wrote:
> Commit e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
> moved the option cache to the pipe_loader_device. However, the
> screen->dev pointer is not set when dri_init_options() is called. Move
> the call to after the pipe_loader_sw_probe_kms() call so screen->dev is
> set. This mirrors the code flow for dri2_init_screen().
>
> Fixes: e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
> Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
> Cc: Marek Olšák <marek.olsak@amd.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  src/gallium/state_trackers/dri/dri2.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
> index 3555107856c8..680826f58144 100644
> --- a/src/gallium/state_trackers/dri/dri2.c
> +++ b/src/gallium/state_trackers/dri/dri2.c
> @@ -2164,9 +2164,8 @@ dri_kms_init_screen(__DRIscreen * sPriv)
>     if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
>        goto free_screen;
>
> -   dri_init_options(screen);
> -
>     if (pipe_loader_sw_probe_kms(&screen->dev, fd))

{

> +      dri_init_options(screen);
>        pscreen = pipe_loader_create_screen(screen->dev);

}

>
>     if (!pscreen)
> --
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
On Tue, Aug 8, 2017 at 11:56 AM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Tue, Aug 8, 2017 at 12:50 PM, Rob Herring <robh@kernel.org> wrote:
>> Commit e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
>> moved the option cache to the pipe_loader_device. However, the
>> screen->dev pointer is not set when dri_init_options() is called. Move
>> the call to after the pipe_loader_sw_probe_kms() call so screen->dev is
>> set. This mirrors the code flow for dri2_init_screen().
>>
>> Fixes: e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
>> Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
>> Cc: Marek Olšák <marek.olsak@amd.com>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>>  src/gallium/state_trackers/dri/dri2.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
>> index 3555107856c8..680826f58144 100644
>> --- a/src/gallium/state_trackers/dri/dri2.c
>> +++ b/src/gallium/state_trackers/dri/dri2.c
>> @@ -2164,9 +2164,8 @@ dri_kms_init_screen(__DRIscreen * sPriv)
>>     if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
>>        goto free_screen;
>>
>> -   dri_init_options(screen);
>> -
>>     if (pipe_loader_sw_probe_kms(&screen->dev, fd))
>
> {
>
>> +      dri_init_options(screen);
>>        pscreen = pipe_loader_create_screen(screen->dev);
>
> }

Good catch. By luck it worked for the non-error case.

Rob
On 08.08.2017 19:07, Rob Herring wrote:
> On Tue, Aug 8, 2017 at 11:56 AM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>> On Tue, Aug 8, 2017 at 12:50 PM, Rob Herring <robh@kernel.org> wrote:
>>> Commit e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
>>> moved the option cache to the pipe_loader_device. However, the
>>> screen->dev pointer is not set when dri_init_options() is called. Move
>>> the call to after the pipe_loader_sw_probe_kms() call so screen->dev is
>>> set. This mirrors the code flow for dri2_init_screen().
>>>
>>> Fixes: e794f8bf8bdb ("gallium: move loading of drirc to pipe-loader")
>>> Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>> Cc: Marek Olšák <marek.olsak@amd.com>
>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>> ---
>>>   src/gallium/state_trackers/dri/dri2.c | 3 +--
>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
>>> index 3555107856c8..680826f58144 100644
>>> --- a/src/gallium/state_trackers/dri/dri2.c
>>> +++ b/src/gallium/state_trackers/dri/dri2.c
>>> @@ -2164,9 +2164,8 @@ dri_kms_init_screen(__DRIscreen * sPriv)
>>>      if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
>>>         goto free_screen;
>>>
>>> -   dri_init_options(screen);
>>> -
>>>      if (pipe_loader_sw_probe_kms(&screen->dev, fd))
>>
>> {
>>
>>> +      dri_init_options(screen);
>>>         pscreen = pipe_loader_create_screen(screen->dev);
>>
>> }
> 
> Good catch. By luck it worked for the non-error case.

With that fixed, the patch is

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>


> 
> Rob
>