From: bugzilla-daemon@freedesktop.org Subject: [Bug 61182] r600g causes KWin crashes with kernel 3.8 Date: Sun, 21 Apr 2013 19:03:16 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0500582607==" Return-path: Received: from culpepper.freedesktop.org (unknown [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id 22091E646E for ; Sun, 21 Apr 2013 12:03:17 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0500582607== Content-Type: multipart/alternative; boundary="1366570997.50be83.9972"; charset="us-ascii" --1366570997.50be83.9972 Date: Sun, 21 Apr 2013 19:03:17 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=61182 --- Comment #40 from D. Hugh Redelmeier --- Thanks, Neils, for the patch in comment #38. Warning: the following comments are made with no understanding of X code. "writting" should be "writing" What is 0x000fffff? I would find the code clearer if this constant were given a name (RADEON_MAX_DMA?). Why code nfill = (size / 0x000fffff) + !!(size % 0x000fffff); instead of the generally more efficient nfill = (size+ 0x000fffff - 1) / 0x000fffff; My guess: to avoid overflow. But if that is the case, then nfill should be uint64_t (like size), not just unsigned (which might be only 32 bits). Any case where the second statement might have an overflow problem would also be a problem with nfill being only unsigned 32. If you know size is not 0, this is even better: nfill = ((size - 1) / 0x000fffff) + 1; If size can be 0, it is probably worth an early-out test to avoid bothering the GPU anyway: if (size == 0) return 0; I find code is easier to read if the scope of a variable is minimized. So I'd make the assignment to fsize also its declaration. Have you created a patch to get these functions called in place of the currently broken code? -- You are receiving this mail because: You are the assignee for the bug. --1366570997.50be83.9972 Date: Sun, 21 Apr 2013 19:03:17 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 40 on bug 61182 from
Thanks, Neils, for the patch in comment #38.

Warning: the following comments are made with no understanding of X code.

"writting" should be "writing"

What is 0x000fffff?  I would find the code clearer if this constant were given
a name (RADEON_MAX_DMA?).

Why code
  nfill = (size / 0x000fffff) + !!(size % 0x000fffff);
instead of the generally more efficient
  nfill = (size+ 0x000fffff - 1) / 0x000fffff;
My guess: to avoid overflow.  But if that is the case, then nfill should be
uint64_t (like size), not just unsigned (which might be only 32 bits).  Any
case where the second statement might have an overflow problem would also be a
problem with nfill being only unsigned 32.

If you know size is not 0, this is even better:
  nfill = ((size - 1) / 0x000fffff) + 1;
If size can be 0, it is probably worth an early-out test to avoid bothering the
GPU anyway:
  if (size == 0) return 0;

I find code is easier to read if the scope of a variable is minimized.  So I'd
make the assignment to fsize also its declaration.

Have you created a patch to get these functions called in place of the
currently broken code?


You are receiving this mail because:
  • You are the assignee for the bug.
--1366570997.50be83.9972-- --===============0500582607== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0500582607==--