[Mesa-dev] [PATCH 1/3] gallium/st: add pipe_context::generate_mipmap()

Charmaine Lee charmainel at vmware.com
Mon Jan 11 19:54:36 PST 2016


>From: ibmirkin at gmail.com <ibmirkin at gmail.com> on behalf of Ilia Mirkin <imirkin at alum.mit.edu>
>Sent: Monday, January 11, 2016 7:12 PM
>To: Charmaine Lee
>Cc: mesa-dev at lists.freedesktop.org
>Subject: Re: [Mesa-dev] [PATCH 1/3] gallium/st: add pipe_context::generate_mipmap()

>On Mon, Jan 11, 2016 at 9:31 PM, Charmaine Lee <charmainel at vmware.com> wrote:
>> This patch adds a new interface to support hardware mipmap generation.
>> PIPE_CAP_GENERATE_MIPMAP is added to allow a driver to specify
>> if this new interface is supported; if not supported, the state tracker will
>> fallback to mipmap generation by rendering/texturing.
>> ---
>>  src/gallium/docs/source/context.rst    | 10 ++++++++++
>>  src/gallium/docs/source/screen.rst     |  2 ++
>>  src/gallium/drivers/trace/tr_context.c | 30 ++++++++++++++++++++++++++++++
>>  src/gallium/include/pipe/p_context.h   | 11 +++++++++++
>>  src/gallium/include/pipe/p_defines.h   |  1 +
>>  src/mesa/state_tracker/st_gen_mipmap.c | 17 ++++++++++++-----
>>  6 files changed, 66 insertions(+), 5 deletions(-)
...
>> diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
>> index b370040..94c1171 100644
>> --- a/src/mesa/state_tracker/st_gen_mipmap.c
>> +++ b/src/mesa/state_tracker/st_gen_mipmap.c
>> @@ -149,12 +149,19 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
>>        last_layer = util_max_layer(pt, baseLevel);
>>     }
>>
>> -   /* Try to generate the mipmap by rendering/texturing.  If that fails,
>> -    * use the software fallback.
>> +   /* First see if the driver supports hardware mipmap generation,
>> +    * if not then generate the mipmap by rendering/texturing.
>> +    * If that fails, use the software fallback.
>>      */
>> -   if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
>> -                        first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
>> -      _mesa_generate_mipmap(ctx, target, texObj);
>> +   if (!st->pipe->screen->get_param(st->pipe->screen,
>> +                                    PIPE_CAP_GENERATE_MIPMAP) ||

>This will cause errors to get logged on every driver. You have to go
>in and update every driver to add the cap to the disabled section. A
>little annoying, but that's how we've been doing everything. Grep for
>a recently-added cap and add below it -- works for most drivers.
>
Oh ya, I will fix it.  Thanks for reviewing.

> -ilia

-Charmaine


> +       !st->pipe->generate_mipmap(st->pipe, pt, baseLevel, lastLevel,
> +                                  first_layer, last_layer)) {
> +
> +      if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
> +                           first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
> +         _mesa_generate_mipmap(ctx, target, texObj);
> +      }
>     }
>
>     /* Fill in the Mesa gl_texture_image fields */
> --
> 1.8.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=dMTqrakxe895Y1JgK2Fm6G2IzlobZfMtVdJTlRk8YUY&m=KR0ZO91gNpu112oW_a8nEd3uGB96VPu_y8tjNUpqlFE&s=An_Ey25TOIQUQz0TyBaMuZgAdNrSLb6K6ERQ2MjlUZs&e=


More information about the mesa-dev mailing list