All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Marek Olšák" <maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [Mesa-dev] gallium state tracker calls calloc for 0 sizes arrays ?
Date: Thu, 27 Aug 2015 19:55:37 +0200	[thread overview]
Message-ID: <55DF4F19.8030708@redhat.com> (raw)
In-Reply-To: <CAAxE2A5GenNVbaFo9cV=U_FOkavpo=o5dHHQkqeBZpG0bqhggQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi,

On 27-08-15 15:46, Marek Olšák wrote:
> On Thu, Aug 27, 2015 at 3:09 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> Hi All,
>>
>> While debugging: https://bugzilla.redhat.com/show_bug.cgi?id=1008089
>>
>> I made a apitrace recording of the a single slide transition
>> animation, and since I suspected memory corruption replayed
>> it using ElectrFence + glretrace, this finds a 0 sized array
>> allocation at src/mesa/state_tracker/st_glsl_to_tgsi.cpp: 5565:
>>
>>     if (proginfo->Parameters) {
>>        t->constants = (struct ureg_src *)
>>           calloc(proginfo->Parameters->NumParameters,
>> sizeof(t->constants[0]));
>>
>> And if I protect the code against that one, another one at 5618:
>>
>>     t->immediates = (struct ureg_src *)
>>        calloc(program->num_immediates, sizeof(struct ureg_src));
>>
>> With the regular glibc malloc these both succeed as it actually
>> returns a valid memory address (posix says it may also return NULL)
>>
>> I believe that the fragment program in question comes from:
>>
>> src/mesa/main/state.c update_program() and then from the
>>
>>     else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
>>        /* Use fragment program generated from fixed-function state */
>>
>>     }
>>
>> block.
>>
>> Interestingly enough if I allow malloc(0) to proceed from ElectricFence,
>> then the glretrace runs fine, and even renders correctly, where as
>> running the same gl command stream from libreoffice impress leads
>> to missrendering on nv3c.
>>
>> So 2 questions:
>>
>> 1) Is it normal / expected for st_translate_program() to get called
>> with an empty but not NULL proginfo->Parameters resp. num_immediates == 0 ?
>>
>> If not where would I begin to look for finding the culprit of this ?
>
> Yes, it's normal.

OK, thanks for the clear answer on this.

>> 2) Since the glretrace does work outside of libreoffice impress, I think
>> it may have something to do with the visual chosen by libreoffice impress,
>> is there an easy way to find out what visual lo is choosing?
>
> No, it's not because of the visual. It seems to me that libreoffice
> changed the behavior of malloc and calloc.

I'm pretty sure that this is not libreoffice changing malloc / calloc,
it links normally to libc, and the same slide transition works fine
with an nv84 card which also has a gallium based mesa driver.

I really believe this is due to libreoffice doing something opengl
related differently then glretrace, be it the visual or something else
back buffer related ...

Regards,

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

  parent reply	other threads:[~2015-08-27 17:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 13:09 gallium state tracker calls calloc for 0 sizes arrays ? Hans de Goede
2015-08-27 13:46 ` Marek Olšák
     [not found]   ` <CAAxE2A5GenNVbaFo9cV=U_FOkavpo=o5dHHQkqeBZpG0bqhggQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-27 17:55     ` Hans de Goede [this message]
2015-08-27 17:59       ` Alex Deucher
2015-08-27 18:19         ` [Nouveau] " Ilia Mirkin
2015-08-28  8:54           ` nv3x libreoffice impress opengl animations not working Hans de Goede
2015-08-28  9:02             ` Ilia Mirkin
     [not found]               ` <CAKb7UvjGWMSDc2fpHpXWw9F7uQabmh1trUQJSbG9JVQBKPSm4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-31 12:58                 ` Hans de Goede
     [not found]                   ` <55E44F79.8000800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-08-31 16:30                     ` Ilia Mirkin
     [not found]                       ` <CAKb7UvihbT+Uf2h2wA=iLkhuYjmRWM6h+=sk-vagkL4mt7-5xg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-02  9:48                         ` Hans de Goede
     [not found]                           ` <55E6C5DF.6010100-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-02 14:44                             ` Ilia Mirkin
2015-09-03 11:09                               ` Hans de Goede
     [not found]                                 ` <55E82A52.5040705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-03 17:36                                   ` Ilia Mirkin
2015-09-04 12:37                                     ` Hans de Goede
     [not found]             ` <55E021A9.7070700-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-08-28 11:01               ` Marek Olšák
     [not found]                 ` <CAAxE2A5EDWp9n_xmpMy8zF81yPgM1R409qNEWxek5N96RE05Bg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-28 11:04                   ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55DF4F19.8030708@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.