blob: a5c05d76cf48f74c3169dbd952ceaff021b5b67d [file] [log] [blame]
Chris Wilson9eb4de12010-02-12 13:28:40 +00001/* -*- c-basic-offset: 4 -*- */
2/*
3 * Copyright © 2007 Intel Corporation
4 * Copyright © 2009 Intel Corporation
5 * Copyright © 2010 Intel Corporation
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
16 * Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * IN THE SOFTWARE.
25 *
26 * Authors:
27 * Eric Anholt <eric@anholt.net>
28 * Carl Worth <cworth@cworth.org>
29 * Chris Wilson <chris@chris-wilson.co.uk>
30 *
31 */
32
33/** @file intel_decode.c
34 * This file contains code to print out batchbuffer contents in a
35 * human-readable format.
36 *
37 * The current version only supports i915 packets, and only pretty-prints a
38 * subset of them. The intention is for it to make just a best attempt to
39 * decode, but never crash in the process.
40 */
41
42#define _GNU_SOURCE
43#include <stdio.h>
44#include <stdlib.h>
45#include <stdarg.h>
46#include <string.h>
Chris Wilsona3a78632010-12-01 21:51:59 +000047#include <unistd.h>
Chris Wilson9eb4de12010-02-12 13:28:40 +000048#include <inttypes.h>
49#include <errno.h>
50#include <sys/stat.h>
51#include <err.h>
Daniel Vetter7ee9f162012-01-09 23:38:17 +010052#include <intel_bufmgr.h>
Chris Wilson9eb4de12010-02-12 13:28:40 +000053
Chris Wilson9eb4de12010-02-12 13:28:40 +000054#include "intel_chipset.h"
55#include "intel_gpu_tools.h"
56#include "instdone.h"
57
58static void
Chris Wilson95374222010-04-08 11:56:57 +010059print_instdone (uint32_t devid, unsigned int instdone, unsigned int instdone1)
Chris Wilson9eb4de12010-02-12 13:28:40 +000060{
61 int i;
Chris Wilson95374222010-04-08 11:56:57 +010062 static int once;
63
64 if (!once) {
65 init_instdone_definitions(devid);
66 once = 1;
67 }
Chris Wilson9eb4de12010-02-12 13:28:40 +000068
69 for (i = 0; i < num_instdone_bits; i++) {
70 int busy = 0;
71
72 if (instdone_bits[i].reg == INST_DONE_1) {
73 if (!(instdone1 & instdone_bits[i].bit))
74 busy = 1;
75 } else {
76 if (!(instdone & instdone_bits[i].bit))
77 busy = 1;
78 }
79
80 if (busy)
81 printf(" busy: %s\n", instdone_bits[i].name);
82 }
83}
84
85static void
Chris Wilsonbfc2b532010-03-04 21:56:04 +000086print_i830_pgtbl_err(unsigned int reg)
87{
88 const char *str;
89
90 switch((reg >> 3) & 0xf) {
91 case 0x1: str = "Overlay TLB"; break;
92 case 0x2: str = "Display A TLB"; break;
93 case 0x3: str = "Host TLB"; break;
94 case 0x4: str = "Render TLB"; break;
95 case 0x5: str = "Display C TLB"; break;
96 case 0x6: str = "Mapping TLB"; break;
97 case 0x7: str = "Command Stream TLB"; break;
98 case 0x8: str = "Vertex Buffer TLB"; break;
99 case 0x9: str = "Display B TLB"; break;
100 case 0xa: str = "Reserved System Memory"; break;
101 case 0xb: str = "Compressor TLB"; break;
102 case 0xc: str = "Binner TLB"; break;
103 default: str = "unknown"; break;
104 }
105
106 if (str)
107 printf (" source = %s\n", str);
108
109 switch(reg & 0x7) {
110 case 0x0: str = "Invalid GTT"; break;
111 case 0x1: str = "Invalid GTT PTE"; break;
112 case 0x2: str = "Invalid Memory"; break;
113 case 0x3: str = "Invalid TLB miss"; break;
114 case 0x4: str = "Invalid PTE data"; break;
115 case 0x5: str = "Invalid LocalMemory not present"; break;
116 case 0x6: str = "Invalid Tiling"; break;
117 case 0x7: str = "Host to CAM"; break;
118 }
119 printf (" error = %s\n", str);
120}
121
122static void
Chris Wilson2d1ad952010-07-15 19:18:39 +0100123print_i915_pgtbl_err(unsigned int reg)
124{
125 if (reg & (1 << 29))
126 printf (" Cursor A: Invalid GTT PTE\n");
127 if (reg & (1 << 28))
128 printf (" Cursor B: Invalid GTT PTE\n");
129 if (reg & (1 << 27))
130 printf (" MT: Invalid tiling\n");
131 if (reg & (1 << 26))
132 printf (" MT: Invalid GTT PTE\n");
133 if (reg & (1 << 25))
134 printf (" LC: Invalid tiling\n");
135 if (reg & (1 << 24))
136 printf (" LC: Invalid GTT PTE\n");
137 if (reg & (1 << 23))
138 printf (" BIN VertexData: Invalid GTT PTE\n");
139 if (reg & (1 << 22))
140 printf (" BIN Instruction: Invalid GTT PTE\n");
141 if (reg & (1 << 21))
142 printf (" CS VertexData: Invalid GTT PTE\n");
143 if (reg & (1 << 20))
144 printf (" CS Instruction: Invalid GTT PTE\n");
145 if (reg & (1 << 19))
146 printf (" CS: Invalid GTT\n");
147 if (reg & (1 << 18))
148 printf (" Overlay: Invalid tiling\n");
149 if (reg & (1 << 16))
150 printf (" Overlay: Invalid GTT PTE\n");
151 if (reg & (1 << 14))
152 printf (" Display C: Invalid tiling\n");
153 if (reg & (1 << 12))
154 printf (" Display C: Invalid GTT PTE\n");
155 if (reg & (1 << 10))
156 printf (" Display B: Invalid tiling\n");
157 if (reg & (1 << 8))
158 printf (" Display B: Invalid GTT PTE\n");
159 if (reg & (1 << 6))
160 printf (" Display A: Invalid tiling\n");
161 if (reg & (1 << 4))
162 printf (" Display A: Invalid GTT PTE\n");
163 if (reg & (1 << 1))
164 printf (" Host Invalid PTE data\n");
165 if (reg & (1 << 0))
166 printf (" Host Invalid GTT PTE\n");
167}
168
169static void
Chris Wilson89343952010-10-22 11:33:08 +0100170print_i965_pgtbl_err(unsigned int reg)
171{
172 if (reg & (1 << 26))
173 printf (" Invalid Sampler Cache GTT entry\n");
174 if (reg & (1 << 24))
175 printf (" Invalid Render Cache GTT entry\n");
176 if (reg & (1 << 23))
177 printf (" Invalid Instruction/State Cache GTT entry\n");
178 if (reg & (1 << 22))
179 printf (" There is no ROC, this cannot occur!\n");
180 if (reg & (1 << 21))
181 printf (" Invalid GTT entry during Vertex Fetch\n");
182 if (reg & (1 << 20))
183 printf (" Invalid GTT entry during Command Fetch\n");
184 if (reg & (1 << 19))
185 printf (" Invalid GTT entry during CS\n");
186 if (reg & (1 << 18))
187 printf (" Invalid GTT entry during Cursor Fetch\n");
188 if (reg & (1 << 17))
189 printf (" Invalid GTT entry during Overlay Fetch\n");
190 if (reg & (1 << 8))
191 printf (" Invalid GTT entry during Display B Fetch\n");
192 if (reg & (1 << 4))
193 printf (" Invalid GTT entry during Display A Fetch\n");
194 if (reg & (1 << 1))
195 printf (" Valid PTE references illegal memory\n");
196 if (reg & (1 << 0))
197 printf (" Invalid GTT entry during fetch for host\n");
198}
199
200static void
Chris Wilsonbfc2b532010-03-04 21:56:04 +0000201print_pgtbl_err(unsigned int reg, unsigned int devid)
202{
203 if (IS_965(devid)) {
Chris Wilson89343952010-10-22 11:33:08 +0100204 return print_i965_pgtbl_err(reg);
Chris Wilson41570d92011-02-14 15:56:14 +0000205 } else if (IS_GEN3(devid)) {
Chris Wilson2d1ad952010-07-15 19:18:39 +0100206 return print_i915_pgtbl_err(reg);
Chris Wilsonbfc2b532010-03-04 21:56:04 +0000207 } else {
208 return print_i830_pgtbl_err(reg);
209 }
210}
211
212static void
Daniel Vetterd5109532011-10-21 19:06:08 +0200213print_snb_fence(unsigned int devid, uint64_t fence)
214{
215 printf(" %svalid, %c-tiled, pitch: %i, start: 0x%08x, size: %u\n",
216 fence & 1 ? "" : "in",
217 fence & (1<<1) ? 'y' : 'x',
218 (int)(((fence>>32)&0xfff)+1)*128,
219 (uint32_t)fence & 0xfffff000,
220 (uint32_t)(((fence>>32)&0xfffff000) - (fence&0xfffff000) + 4096));
221}
222
223static void
224print_i965_fence(unsigned int devid, uint64_t fence)
225{
226 printf(" %svalid, %c-tiled, pitch: %i, start: 0x%08x, size: %u\n",
227 fence & 1 ? "" : "in",
228 fence & (1<<1) ? 'y' : 'x',
229 (int)(((fence>>2)&0x1ff)+1)*128,
230 (uint32_t)fence & 0xfffff000,
231 (uint32_t)(((fence>>32)&0xfffff000) - (fence&0xfffff000) + 4096));
232}
233
234static void
Daniel Vettercf5db112011-03-14 11:20:17 +0100235print_i915_fence(unsigned int devid, uint64_t fence)
236{
237 unsigned tile_width;
238 if ((fence & 12) && !IS_915(devid))
239 tile_width = 128;
240 else
241 tile_width = 512;
242
243 printf(" %svalid, %c-tiled, pitch: %i, start: 0x%08x, size: %i\n",
244 fence & 1 ? "" : "in",
245 fence & 12 ? 'y' : 'x',
246 (1<<((fence>>4)&0xf))*tile_width,
247 (uint32_t)fence & 0x7f80000,
248 1<<(20 + ((fence>>8)&0xf)));
249}
250
251static void
252print_i830_fence(unsigned int devid, uint64_t fence)
253{
254 printf(" %svalid, %c-tiled, pitch: %i, start: 0x%08x, size: %i\n",
255 fence & 1 ? "" : "in",
256 fence & 12 ? 'y' : 'x',
257 (1<<((fence>>4)&0xf))*128,
258 (uint32_t)fence & 0x7f80000,
259 1<<(19 + ((fence>>8)&0xf)));
260}
261
262static void
263print_fence(unsigned int devid, uint64_t fence)
264{
Daniel Vetterd5109532011-10-21 19:06:08 +0200265 if (IS_GEN6(devid) || IS_GEN7(devid)) {
266 return print_snb_fence(devid, fence);
267 } else if (IS_GEN4(devid) || IS_GEN5(devid)) {
268 return print_i965_fence(devid, fence);
Daniel Vettercf5db112011-03-14 11:20:17 +0100269 } else if (IS_GEN3(devid)) {
270 return print_i915_fence(devid, fence);
271 } else {
272 return print_i830_fence(devid, fence);
273 }
274}
275
276static void
Chris Wilsona3a78632010-12-01 21:51:59 +0000277read_data_file (FILE *file)
Chris Wilson9eb4de12010-02-12 13:28:40 +0000278{
Daniel Vetter7ee9f162012-01-09 23:38:17 +0100279 struct drm_intel_decode *decode_ctx = NULL;
280 uint32_t devid = PCI_CHIP_I855_GM;
Chris Wilson9eb4de12010-02-12 13:28:40 +0000281 uint32_t *data = NULL;
Daniel Vettercf5db112011-03-14 11:20:17 +0100282 long long unsigned fence;
Chris Wilson9eb4de12010-02-12 13:28:40 +0000283 int data_size = 0, count = 0, line_number = 0, matched;
284 char *line = NULL;
285 size_t line_size;
286 uint32_t offset, value;
287 uint32_t gtt_offset = 0, new_gtt_offset;
288 char *buffer_type[2] = { "ringbuffer", "batchbuffer" };
Daniel Vetter73c21042011-10-11 13:14:02 +0200289 char *ring_name = NULL;
Chris Wilson9eb4de12010-02-12 13:28:40 +0000290 int is_batch = 1;
291
Chris Wilson9eb4de12010-02-12 13:28:40 +0000292 while (getline (&line, &line_size, file) > 0) {
Chris Wilson98eb5a52011-01-09 13:26:50 +0000293 char *dashes;
Chris Wilson9eb4de12010-02-12 13:28:40 +0000294 line_number++;
295
Chris Wilson98eb5a52011-01-09 13:26:50 +0000296 dashes = strstr(line, "---");
297 if (dashes) {
Daniel Vetter73c21042011-10-11 13:14:02 +0200298 char *new_ring_name = malloc(dashes - line);
299 strncpy(new_ring_name, line, dashes - line);
300 new_ring_name[dashes - line - 1] = '\0';
301
Chris Wilson98eb5a52011-01-09 13:26:50 +0000302 matched = sscanf (dashes, "--- gtt_offset = 0x%08x\n",
303 &new_gtt_offset);
304 if (matched == 1) {
305 if (count) {
Daniel Vetter73c21042011-10-11 13:14:02 +0200306 printf("%s (%s) at 0x%08x:\n",
307 buffer_type[is_batch],
308 ring_name,
309 gtt_offset);
Daniel Vetter7ee9f162012-01-09 23:38:17 +0100310 drm_intel_decode_set_batch_pointer(decode_ctx,
311 data, gtt_offset,
312 count);
313 drm_intel_decode(decode_ctx);
Chris Wilson98eb5a52011-01-09 13:26:50 +0000314 count = 0;
315 }
316 gtt_offset = new_gtt_offset;
317 is_batch = 1;
Daniel Vetter73c21042011-10-11 13:14:02 +0200318 free(ring_name);
319 ring_name = new_ring_name;
Chris Wilson98eb5a52011-01-09 13:26:50 +0000320 continue;
321 }
Chris Wilson9eb4de12010-02-12 13:28:40 +0000322
Chris Wilson98eb5a52011-01-09 13:26:50 +0000323 matched = sscanf (dashes, "--- ringbuffer = 0x%08x\n",
324 &new_gtt_offset);
325 if (matched == 1) {
326 if (count) {
Daniel Vetter73c21042011-10-11 13:14:02 +0200327 printf("%s (%s) at 0x%08x:\n",
328 buffer_type[is_batch],
329 ring_name,
330 gtt_offset);
Daniel Vetter7ee9f162012-01-09 23:38:17 +0100331 drm_intel_decode_set_batch_pointer(decode_ctx,
332 data, gtt_offset,
333 count);
334 drm_intel_decode(decode_ctx);
Chris Wilson98eb5a52011-01-09 13:26:50 +0000335 count = 0;
336 }
337 gtt_offset = new_gtt_offset;
338 is_batch = 0;
Daniel Vetter73c21042011-10-11 13:14:02 +0200339 free(ring_name);
340 ring_name = new_ring_name;
Chris Wilson98eb5a52011-01-09 13:26:50 +0000341 continue;
342 }
Chris Wilson9eb4de12010-02-12 13:28:40 +0000343 }
344
345 matched = sscanf (line, "%08x : %08x", &offset, &value);
346 if (matched != 2) {
347 unsigned int reg;
348
Daniel Vetter92b1f2c2011-10-18 15:54:31 +0200349 /* display reg section is after the ringbuffers, don't mix them */
350 if (count) {
351 printf("%s (%s) at 0x%08x:\n",
352 buffer_type[is_batch],
353 ring_name,
354 gtt_offset);
Daniel Vetter7ee9f162012-01-09 23:38:17 +0100355 drm_intel_decode_set_batch_pointer(decode_ctx,
356 data, gtt_offset,
357 count);
358 drm_intel_decode(decode_ctx);
Daniel Vetter92b1f2c2011-10-18 15:54:31 +0200359 count = 0;
360 }
361
Chris Wilson9eb4de12010-02-12 13:28:40 +0000362 printf("%s", line);
363
364 matched = sscanf (line, "PCI ID: 0x%04x\n", &reg);
Chris Wilson4f208442010-12-23 19:44:14 +0000365 if (matched == 1) {
Chris Wilson9eb4de12010-02-12 13:28:40 +0000366 devid = reg;
Daniel Vetter5801e6b2011-10-18 16:30:56 +0200367 printf("Detected GEN%i chipset\n",
368 intel_gen(devid));
Daniel Vetter7ee9f162012-01-09 23:38:17 +0100369
370 decode_ctx = drm_intel_decode_context_alloc(devid);
Chris Wilson4f208442010-12-23 19:44:14 +0000371 }
Chris Wilson9eb4de12010-02-12 13:28:40 +0000372
373 matched = sscanf (line, " ACTHD: 0x%08x\n", &reg);
Chris Wilson14618622010-08-25 11:55:25 +0100374 if (matched == 1)
Daniel Vetter7ee9f162012-01-09 23:38:17 +0100375 drm_intel_decode_set_head_tail(decode_ctx, reg, 0xffffffff);
Chris Wilson9eb4de12010-02-12 13:28:40 +0000376
Chris Wilsonbfc2b532010-03-04 21:56:04 +0000377 matched = sscanf (line, " PGTBL_ER: 0x%08x\n", &reg);
Chris Wilson14618622010-08-25 11:55:25 +0100378 if (matched == 1 && reg)
Chris Wilsonbfc2b532010-03-04 21:56:04 +0000379 print_pgtbl_err(reg, devid);
380
Chris Wilson9eb4de12010-02-12 13:28:40 +0000381 matched = sscanf (line, " INSTDONE: 0x%08x\n", &reg);
Chris Wilson14618622010-08-25 11:55:25 +0100382 if (matched == 1)
Chris Wilson95374222010-04-08 11:56:57 +0100383 print_instdone (devid, reg, -1);
Chris Wilson9eb4de12010-02-12 13:28:40 +0000384
385 matched = sscanf (line, " INSTDONE1: 0x%08x\n", &reg);
Chris Wilson14618622010-08-25 11:55:25 +0100386 if (matched == 1)
Chris Wilson95374222010-04-08 11:56:57 +0100387 print_instdone (devid, -1, reg);
Chris Wilson9eb4de12010-02-12 13:28:40 +0000388
Daniel Vetterd5109532011-10-21 19:06:08 +0200389 matched = sscanf (line, " fence[%i] = %Lx\n", &reg, &fence);
Daniel Vettercf5db112011-03-14 11:20:17 +0100390 if (matched == 2)
391 print_fence (devid, fence);
392
Chris Wilson9eb4de12010-02-12 13:28:40 +0000393 continue;
394 }
395
396 count++;
397
398 if (count > data_size) {
399 data_size = data_size ? data_size * 2 : 1024;
400 data = realloc (data, data_size * sizeof (uint32_t));
401 if (data == NULL) {
402 fprintf (stderr, "Out of memory.\n");
403 exit (1);
404 }
405 }
406
407 data[count-1] = value;
408 }
409
410 if (count) {
Daniel Vetter6ed89f42011-10-18 15:49:41 +0200411 printf("%s (%s) at 0x%08x:\n",
412 buffer_type[is_batch],
413 ring_name,
414 gtt_offset);
Daniel Vetter7ee9f162012-01-09 23:38:17 +0100415 drm_intel_decode_set_batch_pointer(decode_ctx,
416 data, gtt_offset,
417 count);
418 drm_intel_decode(decode_ctx);
Chris Wilson9eb4de12010-02-12 13:28:40 +0000419 }
420
421 free (data);
422 free (line);
Daniel Vetter73c21042011-10-11 13:14:02 +0200423 free (ring_name);
Chris Wilson9eb4de12010-02-12 13:28:40 +0000424}
425
426int
427main (int argc, char *argv[])
428{
Chris Wilsona3a78632010-12-01 21:51:59 +0000429 FILE *file;
Chris Wilson9eb4de12010-02-12 13:28:40 +0000430 const char *path;
Chris Wilsona3a78632010-12-01 21:51:59 +0000431 char *filename;
Chris Wilson9eb4de12010-02-12 13:28:40 +0000432 struct stat st;
433 int err;
434
435 if (argc > 2) {
436 fprintf (stderr,
437 "intel_gpu_decode: Parse an Intel GPU i915_error_state\n"
438 "Usage:\n"
439 "\t%s [<file>]\n"
440 "\n"
441 "With no arguments, debugfs-dri-directory is probed for in "
442 "/debug and \n"
443 "/sys/kernel/debug. Otherwise, it may be "
444 "specified. If a file is given,\n"
445 "it is parsed as an GPU dump in the format of "
446 "/debug/dri/0/i915_error_state.\n",
447 argv[0]);
448 return 1;
449 }
450
Chris Wilson9eb4de12010-02-12 13:28:40 +0000451 if (argc == 1) {
Chris Wilson292ae452010-12-10 15:31:59 +0000452 if (isatty(0)) {
Chris Wilson68a95f02011-01-25 16:34:08 +0000453 path = "/debug/dri";
Chris Wilson9eb4de12010-02-12 13:28:40 +0000454 err = stat (path, &st);
455 if (err != 0) {
Chris Wilson68a95f02011-01-25 16:34:08 +0000456 path = "/sys/kernel/debug/dri";
Chris Wilsona3a78632010-12-01 21:51:59 +0000457 err = stat (path, &st);
458 if (err != 0) {
459 errx(1,
460 "Couldn't find i915 debugfs directory.\n\n"
461 "Is debugfs mounted? You might try mounting it with a command such as:\n\n"
462 "\tsudo mount -t debugfs debugfs /sys/kernel/debug\n");
463 }
Chris Wilson9eb4de12010-02-12 13:28:40 +0000464 }
Chris Wilsona3a78632010-12-01 21:51:59 +0000465 } else {
466 read_data_file(stdin);
467 exit(0);
Chris Wilson9eb4de12010-02-12 13:28:40 +0000468 }
469 } else {
470 path = argv[1];
471 err = stat (path, &st);
472 if (err != 0) {
473 fprintf (stderr, "Error opening %s: %s\n",
474 path, strerror (errno));
475 exit (1);
476 }
477 }
478
Chris Wilson68a95f02011-01-25 16:34:08 +0000479 if (S_ISDIR (st.st_mode)) {
Chris Wilson9eb4de12010-02-12 13:28:40 +0000480 asprintf (&filename, "%s/i915_error_state", path);
Chris Wilson68a95f02011-01-25 16:34:08 +0000481 file = fopen(filename, "r");
482 if (!file) {
483 int minor;
484 for (minor = 0; minor < 64; minor++) {
485 free(filename);
486 asprintf(&filename, "%s/%d/i915_error_state", path, minor);
487 file = fopen(filename, "r");
488 if (file)
489 break;
490 }
491 }
492 if (!file) {
493 fprintf (stderr, "Failed to find i915_error_state beneath %s\n",
494 path);
495 exit (1);
496 }
Chris Wilson9eb4de12010-02-12 13:28:40 +0000497 } else {
Chris Wilson68a95f02011-01-25 16:34:08 +0000498 filename = (char *) path;
499 file = fopen(filename, "r");
500 if (!file) {
501 fprintf (stderr, "Failed to open %s: %s\n",
502 filename, strerror (errno));
503 exit (1);
504 }
Chris Wilson9eb4de12010-02-12 13:28:40 +0000505 }
506
Chris Wilson68a95f02011-01-25 16:34:08 +0000507 read_data_file (file);
508 fclose (file);
509
Chris Wilsona3a78632010-12-01 21:51:59 +0000510 if (filename != path)
511 free (filename);
512
Chris Wilson9eb4de12010-02-12 13:28:40 +0000513 return 0;
514}