[Mesa-dev] [PATCH 01/12] panfrost: Cleanup needless if in create_bo

Tomeu Vizoso tomeu at tomeuvizoso.net
Mon Mar 11 12:50:32 UTC 2019


On Sun, 10 Mar 2019 at 07:50, Alyssa Rosenzweig <alyssa at rosenzweig.io> wrote:
>
> I'm not sure why we were checking for these additional criteria (likely
> inherited from some other driver); remove the needless checks to cleanup
> the code and perhaps fix some bugs down the line.
>
> Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

Reviewed-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>

> ---
>  src/gallium/drivers/panfrost/pan_resource.c | 56 ++++++++++-----------
>  1 file changed, 26 insertions(+), 30 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
> index f26f33db96b..7dfeb773d8b 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -246,37 +246,33 @@ panfrost_resource_create(struct pipe_screen *screen,
>                          assert(0);
>          }
>
> -        if ((template->bind & PIPE_BIND_RENDER_TARGET) || (template->bind & PIPE_BIND_DEPTH_STENCIL)) {
> -                if (template->bind & PIPE_BIND_DISPLAY_TARGET ||
> -                    template->bind & PIPE_BIND_SCANOUT ||
> -                    template->bind & PIPE_BIND_SHARED) {
> -                        struct pipe_resource scanout_templat = *template;
> -                        struct renderonly_scanout *scanout;
> -                        struct winsys_handle handle;
> -
> -                        /* TODO: align width0 and height0? */
> -
> -                        scanout = renderonly_scanout_for_resource(&scanout_templat,
> -                                                                  pscreen->ro, &handle);
> -                        if (!scanout)
> -                                return NULL;
> -
> -                        assert(handle.type == WINSYS_HANDLE_TYPE_FD);
> -                        /* TODO: handle modifiers? */
> -                        so = pan_resource(screen->resource_from_handle(screen, template,
> -                                                                         &handle,
> -                                                                         PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE));
> -                        close(handle.handle);
> -                        if (!so)
> -                                return NULL;
> -
> -                        so->scanout = scanout;
> -                        pscreen->display_target = so;
> -                } else {
> -                       so->bo = panfrost_create_bo(pscreen, template);
> -                }
> +        if (template->bind & PIPE_BIND_DISPLAY_TARGET ||
> +            template->bind & PIPE_BIND_SCANOUT ||
> +            template->bind & PIPE_BIND_SHARED) {
> +                struct pipe_resource scanout_templat = *template;
> +                struct renderonly_scanout *scanout;
> +                struct winsys_handle handle;
> +
> +                /* TODO: align width0 and height0? */
> +
> +                scanout = renderonly_scanout_for_resource(&scanout_templat,
> +                                                          pscreen->ro, &handle);
> +                if (!scanout)
> +                        return NULL;
> +
> +                assert(handle.type == WINSYS_HANDLE_TYPE_FD);
> +                /* TODO: handle modifiers? */
> +                so = pan_resource(screen->resource_from_handle(screen, template,
> +                                                                 &handle,
> +                                                                 PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE));
> +                close(handle.handle);
> +                if (!so)
> +                        return NULL;
> +
> +                so->scanout = scanout;
> +                pscreen->display_target = so;
>          } else {
> -               so->bo = panfrost_create_bo(pscreen, template);
> +                so->bo = panfrost_create_bo(pscreen, template);
>          }
>
>          return (struct pipe_resource *)so;
> --
> 2.20.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list