Re: [Xmame] xf86_dga2.c and deprecated DGA function

2002-01-26 Thread Shyouzou Sugitani


Fernand Albarr wrote:
 Here is a small patch that replace a call to a DGA1 function with the
 matching DGA2 version.

Thanks.

 - we are in an initialization routine, I suppose we don't care when the
   location adjustement will be done, am I missing something here ?

But there is no other routine which cares it.
I think xf86_dga2_update_display() is the place.

My idea:
 - In xf86_dga2_create_display() replace XDGASetViewport(); with
   xf86_dga_fix_viewport = 1;.
 - In xf86_dga2_update_display() check xf86ctx.modes-viewportFlags and use
   XDGAFlipImmediate or XDGAFlipRetrace with XDGAGetViewportStatus().


Shyouzou Sugitani [EMAIL PROTECTED]
  [EMAIL PROTECTED]

___
Xmame mailing list
[EMAIL PROTECTED]
http://toybox.twisted.org.uk/mailman/listinfo/xmame



Re: [Xmame] xf86_dga2.c and deprecated DGA function

2002-01-26 Thread Shyouzou Sugitani


 My idea:
  - In xf86_dga2_create_display() replace XDGASetViewport(); with
xf86_dga_fix_viewport = 1;.
  - In xf86_dga2_update_display() check xf86ctx.modes-viewportFlags and use
XDGAFlipImmediate or XDGAFlipRetrace with XDGAGetViewportStatus().

Attached patch is an implementation of my idea, but not tested.
I'm busy with my thesis. :-(


Shyouzou Sugitani [EMAIL PROTECTED]
  [EMAIL PROTECTED]


--- src/unix/video-drivers/xf86_dga2.c.dist Sat Jan 26 19:18:01 2002
+++ src/unix/video-drivers/xf86_dga2.c  Sat Jan 26 19:19:12 2002
@@ -402,7 +402,7 @@
xf86ctx.grabbed_mouse = 1;
}
 
-   XDGASetViewport(display,xf86ctx.screen,0,0,XDGAFlipImmediate);
+   xf86_dga_fix_viewport = 1;
 
memset(xf86ctx.base_addr, 0,
   xf86ctx.device-mode.bytesPerScanline
@@ -524,7 +524,12 @@

if(xf86_dga_fix_viewport)
{
-   XF86DGASetViewPort(display,xf86ctx.screen,0,0);
+   if (xf86ctx.modes-viewportFlags  XDGAFlipImmediate)
+   XDGASetViewport(display,xf86ctx.screen,0,0,XDGAFlipImmediate);
+   else {
+   XDGASetViewport(display,xf86ctx.screen,0,0,XDGAFlipRetrace);
+   while(XDGAGetViewportStatus(display, xf86ctx.screen));
+   }
xf86_dga_fix_viewport = 0;
}
 



Re: [Xmame] xf86_dga2.c and deprecated DGA function

2002-01-26 Thread Shyouzou Sugitani


 Attached patch is an implementation of my idea, but not tested.

Attached is a correct(tested) patch.


Shyouzou Sugitani [EMAIL PROTECTED]
  [EMAIL PROTECTED]


--- src/unix/video-drivers/xf86_dga2.c.dist Sun Jan 27 01:08:30 2002
+++ src/unix/video-drivers/xf86_dga2.c  Sun Jan 27 01:09:46 2002
@@ -402,7 +402,7 @@
xf86ctx.grabbed_mouse = 1;
}
 
-   XDGASetViewport(display,xf86ctx.screen,0,0,XDGAFlipImmediate);
+   xf86_dga_fix_viewport = 1;
 
memset(xf86ctx.base_addr, 0,
   xf86ctx.device-mode.bytesPerScanline
@@ -524,7 +524,12 @@

if(xf86_dga_fix_viewport)
{
-   XF86DGASetViewPort(display,xf86ctx.screen,0,0);
+   if (xf86ctx.device-mode.viewportFlags  XDGAFlipImmediate)
+   XDGASetViewport(display,xf86ctx.screen,0,0,XDGAFlipImmediate);
+   else {
+   XDGASetViewport(display,xf86ctx.screen,0,0,XDGAFlipRetrace);
+   while(XDGAGetViewportStatus(display, xf86ctx.screen));
+   }
xf86_dga_fix_viewport = 0;
}
 



Re: [Xmame] xf86_dga2.c and deprecated DGA function

2002-01-26 Thread Fernand Albarracin

On Sat 26 Jan 2002 at 17:49:36 +0900, Shyouzou Sugitani wrote:

  - we are in an initialization routine, I suppose we don't care when the
location adjustement will be done, am I missing something here ?

Hmmm, what I didn't know at that point is that the code didn't perform
any location adjustement in the normal case ...

 But there is no other routine which cares it.
 I think xf86_dga2_update_display() is the place.

Ok, I looked more deeply into the code (what I should have done in the
first place) and I think I finally understood why this code was added.
Looking at sysdep_update_keyboard() in xinput.c :

#ifdef USE_DGA
/* Some buggy combination of XFree and virge screwup the viewport
   on the first mouseclick */
if(xf86_dga_first_click) { xf86_dga_first_click = 0; xf86_dga_fix_viewport = 
1; }
#endif  

Unfortunately, the comment doesn't help much. It does not say which
particular XFree server version was buggy. Now, from
xf86_dga1_update_display() in xf86_dga1.c :

if(xf86_dga_fix_viewport)
{
XF86DGASetViewPort(display,xf86ctx.screen,0,0);
xf86_dga_fix_viewport = 0;
}

So I'm pretty sure that it only relates to a problem with some XFree 3.3
DGA1 implementation problems. And yes, this is the same code that my
patch changed in xf86_dga2.c. It was probably copied when people created
the DGA2 target.

Here is a new patch for 0.57.1 (without my initial patch or Shyouzou's
one applied), it removes what I think is no more necessary for DGA2 S3
Virge users :

--- xmame-0.57.1/src/unix/video-drivers/xf86_dga2.c Wed Jan  2 03:45:56 2002
+++ xmame-0.57.1-f/src/unix/video-drivers/xf86_dga2.c   Sat Jan 26 22:33:48 2002
@@ -315,8 +315,7 @@
   who do a lott of dga - window switching will get a lott of
   children */
static int first_time  = 1;
-   xf86_dga_fix_viewport  = 0;
-   xf86_dga_first_click   = 1;
+   xf86_dga_first_click   = 0;
xf86ctx.palette_dirty  = FALSE;
xf86ctx.old_grab_mouse = x11_grab_mouse;
x11_grab_mouse = FALSE;
@@ -402,8 +401,6 @@
xf86ctx.grabbed_mouse = 1;
}
 
-   XDGASetViewport(display,xf86ctx.screen,0,0,XDGAFlipImmediate);
-
memset(xf86ctx.base_addr, 0,
   xf86ctx.device-mode.bytesPerScanline
   * xf86ctx.device-mode.imageHeight);
@@ -521,12 +518,6 @@
 void xf86_dga2_update_display(struct mame_bitmap *bitmap)
 {
int old_use_dirty = use_dirty;
-   
-   if(xf86_dga_fix_viewport)
-   {
-   XF86DGASetViewPort(display,xf86ctx.screen,0,0);
-   xf86_dga_fix_viewport = 0;
-   }
 
if (current_palette-lookup_dirty)
use_dirty = 0;

Comments ? Am I still missing something ? :-) This SetViewPort() hack
should have retained my attention, because there is no point to call
that function unless you do some sort of page-switching or panning, and
with (0,0) as parameters, it really wasn't you intention.

Shyouzou, I've read your patch, do you really think that this code is
still necessary ?

Fernand

___
Xmame mailing list
[EMAIL PROTECTED]
http://toybox.twisted.org.uk/mailman/listinfo/xmame