[Mesa-stable] [Mesa-dev] [PATCH] st/mesa: use surface format to generate mipmaps when available

Ilia Mirkin imirkin at alum.mit.edu
Thu Jan 14 11:42:35 PST 2016


Hmmmm.... well I set ->surface_based = TRUE on texture views. It
seemed to correspond to the restrictions of surface-based elsewhere,
but I probably wasn't 100% sure what the deal was back when I added
the logic.

On Thu, Jan 14, 2016 at 2:38 PM, Marek Olšák <maraeo at gmail.com> wrote:
> Hi Ilia,
>
> surface_based originally meant that the resource has been imported
> from a DMABUF or GEM FLINK handle. Such resources can't be reallocated
> ever, nor can they be mipmapped.
>
> Marek
>
> On Thu, Jan 14, 2016 at 7:46 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> This fixes the recently posted mipmap + texture views piglit test.
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>
>> ---
>>  src/mesa/state_tracker/st_gen_mipmap.c | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
>> index 3e6c0a7..c4b3492 100644
>> --- a/src/mesa/state_tracker/st_gen_mipmap.c
>> +++ b/src/mesa/state_tracker/st_gen_mipmap.c
>> @@ -80,6 +80,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
>>     struct st_texture_object *stObj = st_texture_object(texObj);
>>     struct pipe_resource *pt = st_get_texobj_resource(texObj);
>>     const uint baseLevel = texObj->BaseLevel;
>> +   enum pipe_format format;
>>     uint lastLevel, first_layer, last_layer;
>>     uint dstLevel;
>>
>> @@ -149,16 +150,21 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
>>        last_layer = util_max_layer(pt, baseLevel);
>>     }
>>
>> +   if (stObj->surface_based)
>> +      format = stObj->surface_format;
>> +   else
>> +      format = pt->format;
>> +
>>     /* 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 (!st->pipe->screen->get_param(st->pipe->screen,
>>                                      PIPE_CAP_GENERATE_MIPMAP) ||
>> -       !st->pipe->generate_mipmap(st->pipe, pt, pt->format, baseLevel,
>> +       !st->pipe->generate_mipmap(st->pipe, pt, format, baseLevel,
>>                                    lastLevel, first_layer, last_layer)) {
>>
>> -      if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
>> +      if (!util_gen_mipmap(st->pipe, pt, format, baseLevel, lastLevel,
>>                             first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
>>           _mesa_generate_mipmap(ctx, target, texObj);
>>        }
>> --
>> 2.4.10
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list