Re: gEDA-user: Segfault on startup and garbage drawn outside of pcb board area

2010-06-08 Thread Peter Clifton

> > LIBGL_ALWAYS_SOFTWARE=1 pcb ...
> 
> This one removes the "garbage".
> 
> > and or
> > 
> > LIBGL_ALWAYS_INDIRECT=1 pcb ...
> 
> This one does not...

> You were right - it seems the driver is at fault... It wasn't always
> like that so I'll try to track down what change broke the rendering.

It might not be the driver's fault if I'm doing evil things like making
GL calls out of valid context setup. (Which I was).

The patch I sent should (as far as I know) avoid the offending drawing
calls, but it does not 100% guarantee that nothing else calls a drawing
routine directly when it shouldn't.

I assume from your response that the patch didn't get rid of the rubbish
on screen. I'm not sure what to suggest trying next. Perhaps I could
produce a patch which extends the locking to every drawing call, just in
case something slipping past.

We could look at whether it is possible to trim down various drawing
calls / methods, and see at what point the rubbish goes away.

Is it present for all boards, (including blank), or does it depend on
what you have on the board?


Best wishes,

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Segfault on startup and garbage drawn outside of pcb board area

2010-06-08 Thread Krzysztof Kościuszkiewicz
On Tue, Jun 08, 2010 at 12:30:46AM +0100, Peter Clifton wrote:
> On Tue, 2010-06-08 at 01:05 +0200, Krzysztof Kościuszkiewicz wrote:
> > 1) Garbage is displayed outside of board area.
> 
> What graphics card / driver are you using Radeon R300 + Mesa?
> This bug is almost certainly going to turn out to be driver dependent.

I have ATI Mobility Radeon X700 on PCIe.

> Since you are using a mesa based driver, try with:
> 
> LIBGL_ALWAYS_SOFTWARE=1 pcb ...

This one removes the "garbage".

> and or
> 
> LIBGL_ALWAYS_INDIRECT=1 pcb ...

This one does not...

You were right - it seems the driver is at fault... It wasn't always
like that so I'll try to track down what change broke the rendering.

Thanks!
-- 
Krzysztof Kościuszkiewicz
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Segfault on startup and garbage drawn outside of pcb board area

2010-06-08 Thread Krzysztof Kościuszkiewicz
On Tue, Jun 08, 2010 at 12:41:50AM +0100, Peter Clifton wrote:

> On Tue, 2010-06-08 at 01:05 +0200, Krzysztof Kościuszkiewicz wrote:

> > I have noticed two bugs with recent git versions of gl-enabled pcb
> > (6507083b0401e0).
> > 
> > 1) Garbage is displayed outside of board area.
> 
> Try this patch, and see if it changes the behaviour / helps / breaks
> things further.

Thanks, this does the trick. I haven't been able to get the segfault
with your patch.

Best regards,
-- 
Krzysztof Kościuszkiewicz
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Segfault on startup and garbage drawn outside of pcb board area

2010-06-07 Thread Peter Clifton
On Tue, 2010-06-08 at 01:05 +0200, Krzysztof Kościuszkiewicz wrote:
> All,
> 
> I have noticed two bugs with recent git versions of gl-enabled pcb
> (6507083b0401e0).
> 
> 1) Garbage is displayed outside of board area.

Try this patch, and see if it changes the behaviour / helps / breaks
things further.

NB: Cursory playing suggests that my "master" branch (with pours)
doesn't work quite correctly with user-defined holes in polygons.

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 1fa2640..efce5ec 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -73,6 +73,7 @@ static GLfloat last_modelview_matrix[4][4] = {{1.0, 0.0, 0.0, 0.0},
   {0.0, 0.0, 0.0, 1.0}};
 static int global_view_2d = 1;
 
+static bool check_gl_drawing_ok_hack = false;
 
 /* Set to true if cursor is currently in viewport. This is a hack to prevent
  * Crosshair stack corruption due to unmatching window enter / leave events */
@@ -596,6 +597,9 @@ ghid_show_crosshair (gboolean show)
   static GdkColor cross_color;
   extern float global_depth;
 
+  if (!check_gl_drawing_ok_hack)
+return;
+
   if (gport->x_crosshair < 0 || ghidgui->creating) {// || !gport->has_entered) {
 printf ("Returning\n");
 return;
@@ -1752,6 +1756,8 @@ ghid_port_drawing_area_expose_event_cb (GtkWidget * widget,
 
   hidgl_init ();
 
+  check_gl_drawing_ok_hack = true;
+
   /* If we don't have any stencil bits available,
  we can't use the hidgl polygon drawing routine */
   /* TODO: We could use the GLU tessellator though */
@@ -1974,6 +1980,8 @@ ghid_port_drawing_area_expose_event_cb (GtkWidget * widget,
   else
 glFlush ();
 
+  check_gl_drawing_ok_hack = false;
+
   /* end drawing to current GL-context */
   gdk_gl_drawable_gl_end (pGlDrawable);
 


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Segfault on startup and garbage drawn outside of pcb board area

2010-06-07 Thread Peter Clifton
On Tue, 2010-06-08 at 01:05 +0200, Krzysztof Kościuszkiewicz wrote:
> All,
> 
> I have noticed two bugs with recent git versions of gl-enabled pcb
> (6507083b0401e0).

You're not only using the GL enabled version, but the "poured" region
enabled version. Beware - the behaviour with Polygons on that branch (my
"master" branch is not 100% compatible with stock git HEAD PCB)!

If you're not deliberately using the pour support, you might prefer my
"before_pours" branch, which does not change the semantics for polygon
handling.

(The semantics in the branch you have are that every diced piece of a
polygon is kept, but only those connected to something are retained.
Each diced piece acts separately as far as connectivity is concerned,
and can contribute to different connections.

> 1) Garbage is displayed outside of board area.

I'm not testing the pours branch ("master") as extensively as the
"before_pours" branch, so it is possible there is a bug affecting the
rendering there which I've not corrected. That said, the GL code is
mostly common to both ("master" sits on top of "before_pours").

What graphics card / driver are you using Radeon R300 + Mesa?
This bug is almost certainly going to turn out to be driver dependent.

Since you are using a mesa based driver, try with:

LIBGL_ALWAYS_SOFTWARE=1 pcb ...

and or

LIBGL_ALWAYS_INDIRECT=1 pcb ...

Does this change behaviour?

> 2) pcb sometimes segfaults in glEnable() during startup.

I'd need to see a backtrace of _which_ glEnable() call creates the
problem to be able to start thinking about why that might be..

> I'm using tiling WM and in some cases pcb segfaults during startup.
> I suspect this depends on the order of X events being sent to the
> application. Stack trace is attached. If needed I can do more
> debugging/build with debug libs, but I'm no X expert :)

You need more debug versions of libraries installed to flesh out the
backtrace, but I think I see which glEnable your segfault landed on:

  glEnable (GL_COLOR_LOGIC_OP);

potentially (and perhaps consistent with other symptoms), this code is
being called outside of the correct GL rendering context being set up.
Apparently this doesn't cause problems on my Intel drivers, but is
almost certainly the wrong thing to do...

I'll see if I can hack together together a test patch to stop it doing
that, and perhaps you could report if there is any change in behaviour.

> Should I create items for these in the bug tracker?
> Anybody observed anything similar?

I'm not sure about the tracker - you can do, but if so, please note the
branch and SHA1 as you did above. Let me take a look now to save you the
trouble of filing the bug.. I hate looking through Sourceforge anyway.

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Segfault on startup and garbage drawn outside of pcb board area

2010-06-07 Thread kai-martin knaak
Krzysztof =?utf-8?Q?Ko=C5=9Bciuszkiewicz?= wrote:

> Anybody observed anything similar?

I use Peter C's "before pours" branch of pcb and see none of these artefacts 
and segfaults. My desktop environment is gnome with metacity as a window 
manager. All from debian/testing, i.e. squeeze.

Maybe some weird problem with your graphics driver? 

---<)kaimartin(>---
-- 
Kai-Martin Knaak
Öffentlicher PGP-Schlüssel:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6C0B9F53



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: Segfault on startup and garbage drawn outside of pcb board area

2010-06-07 Thread Krzysztof Kościuszkiewicz
All,

I have noticed two bugs with recent git versions of gl-enabled pcb
(6507083b0401e0).

1) Garbage is displayed outside of board area.

Contents are flashing annoyingly (black/background color) on every mouse
move event within the PCB drawing area.  Contents of the drawing area
not occupied by the board depend on what was displayed in other windows,
ie after switching virtual desktops content from previous application
can be seen in the background.

Output of glxinfo and screenshot after rotating an empty board in 3d
space are attached.

2) pcb sometimes segfaults in glEnable() during startup.

I'm using tiling WM and in some cases pcb segfaults during startup.
I suspect this depends on the order of X events being sent to the
application. Stack trace is attached. If needed I can do more
debugging/build with debug libs, but I'm no X expert :)

Should I create items for these in the bug tracker?
Anybody observed anything similar?

Best regards,
-- 
Krzysztof Kościuszkiewicz
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci
(gdb) run
Starting program: /home/kokr/geda/bin/pcb 
[Thread debugging using libthread_db enabled]
[New Thread 0xb68a2aa0 (LWP 15078)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb68a2aa0 (LWP 15078)]
0xb6dec616 in glEnable () from /usr/lib/libGL.so.1
(gdb) bt
#0  0xb6dec616 in glEnable () from /usr/lib/libGL.so.1
#1  0x081194f7 in ghid_show_crosshair (show=0) at 
hid/gtk/gui-output-events.c:614
#2  0x0811a129 in ghid_port_window_leave_cb (widget=0x829d5e0, ev=0x83fc148, 
out=0x81db6a0)
at hid/gtk/gui-output-events.c:2302
#3  0xb74ee374 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#4  0x0829d5e0 in ?? ()
#5  0x083fc148 in ?? ()
#6  0x081db6a0 in ?? ()
#7  0xb70765ba in ?? () from /usr/lib/libgobject-2.0.so.0
#8  0x0002 in ?? ()
#9  0x0008 in ?? ()
#10 0xb6cf73c0 in ?? () from /lib/i686/cmov/libc.so.6
#11 0xb70925a4 in g_type_check_instance_is_a () from 
/usr/lib/libgobject-2.0.so.0
#12 0xb7077f62 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#13 0xb708c3a8 in ?? () from /usr/lib/libgobject-2.0.so.0
#14 0x08410430 in ?? ()
#15 0xbfd00c24 in ?? ()
#16 0x0002 in ?? ()
#17 0x0843d4f0 in ?? ()
#18 0xbfd00c10 in ?? ()
#19 0x0843d4f0 in ?? ()
#20 0xbfd00bc8 in ?? ()
#21 0xb707a272 in g_object_ref () from /usr/lib/libgobject-2.0.so.0
#22 0xb708d5b8 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#23 0xb708dba6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#24 0xb760aafe in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#25 0x0829d5e0 in ?? ()
#26 0x002d in ?? ()
#27 0x in ?? ()
(gdb) fr 2
#2  0x0811a129 in ghid_port_window_leave_cb (widget=0x829d5e0, ev=0x83fc148, 
out=0x81db6a0)
at hid/gtk/gui-output-events.c:2302
2302  ghid_show_crosshair (FALSE);
(gdb) p widget
$6 = (GtkWidget *) 0x829d5e0
(gdb) p *widget
$7 = {object = {parent_instance = {g_type_instance = {g_class = 0x83f31c8}, 
ref_count = 4, 
  qdata = 0x84129d0}, flags = 73664}, private_flags = 3584, state = 0 '\0', 
  saved_state = 0 '\0', name = 0x0, style = 0x8228458, requisition = {width = 
0, height = 0}, 
  allocation = {x = 0, y = 0, width = 547, height = 806}, window = 0x84110a8, 
parent = 0x8232778}
(gdb) p ev
$8 = (GdkEventCrossing *) 0x83fc148
(gdb) p *ev
$9 = {type = GDK_LEAVE_NOTIFY, window = 0x84110a8, send_event = 0 '\0', 
subwindow = 0x0, 
  time = 248194684, x = 388, y = 328, x_root = 541, y_root = 380, mode = 
GDK_CROSSING_NORMAL, 
  detail = GDK_NOTIFY_ANCESTOR, focus = 0, state = 16}
(gdb) p out
$10 = (GHidPort *) 0x81db6a0
(gdb) p *out
$11 = {top_window = 0x8225850, drawing_area = 0x829d5e0, trackball = 0x8408000, 
pixmap = 0x8403480, 
  mask = 0x0, drawable = 0x8403480, width = 547, height = 806, glconfig = 
0x81fdc78, 
  trans_lines = 0, bg_color = {pixel = 15066597, red = 58853, green = 58853, 
blue = 58853}, 
  offlimits_color = {pixel = 13421772, red = 52428, green = 52428, blue = 
52428}, grid_color = {
pixel = 0, red = 0, green = 0, blue = 0}, colormap = 0x8200818, X_cursor = 
0x8426368, 
  X_cursor_shape = GDK_LEFT_PTR, has_entered = 1, panning = 0, zoom = 
1096.892138939671, 
  view_x0 = 0, view_y0 = 0, view_width = 60, view_height = 50, view_x = 
116400, 
  view_y = 98400, x_crosshair = 116000, y_crosshair = 98000}
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, 
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer, 
GLX_OML_swap_method, GLX_SGI_make_current_read, GLX_SGI_swap_control, 
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, 
GLX_SGIX_visual_select_group
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context, 
GLX_EXT_visual_info, GLX