Posting tablet tilt and pressure events to Xwindows

2019-12-16 Thread Vincent Stemen


Hi.

I am working on an xinput driver for my older serial tablet under FreeBSD.  My
main question is, how do you post tilt and pressure events to Xwindows and is
there any complete up to date API documentation anywhere for it?

I originally wrote the driver a number of years ago and have finally gotten it
updated to compile and work with Xorg-7.7.  I have cursor motion and buttons
working by calling xf86PostMotionEvent() and xf86PostButtonEvent() so that it
can be used as a core pointer, but I can find no API documentation on posting
tilt and pressure events.

The only documentation I have found with examples is
https://www.x.org/wiki/Development/Documentation/XorgInputHOWTO/
which apparently was mostly written around 10 years ago and is very out of
date.  It says right at the top of the page,

"Warning: This tutorial is outdated and refers to APIs that have since
been changed."

No links or mention of any docs for the updated APIs.

I have been pulling my hair out for days dealing with changes that seem to be
completely undocumented.
For example:  I had this call from the example in my driver.

xf86InitValuatorAxisStruct(device, i, *pIdev->labels, -1, -1, 1, 1, 1);

which produced this compilation error:

error: too few arguments to function call, expected 9, have 8
xf86InitValuatorAxisStruct(device, i, *pIdev->labels, -1, -1, 1, 1, 1);

Not only can I find no API docs mentioning this but nowhere in the ChangeLog
for xorg-server-1.18.4 does it even mention adding a 9th argument or what it
is.  They are making significant compatibility changes and staying completely
quiet about it.

I found a prototype for it in the Xorg source tree that showed that it now had
a mode parameter but, like most of the rest of the sources, it was completely
uncommented.  So what the hell is mode?

After much digging, I finally found an uncommented call to it in the mouse.c
file from the xf86-input-mouse-1.7.2 sources where I discovered an extra
argument of Relative being added under 

#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12

So, after digging through all the headers, I came to the conclusion that it
now accepts either Absolute or Relative value as the parameter. 

This is just one example of many issues that I had.

The Xorg developers are making all kinds of changes without putting out updated
API reference documentation or howtos, commenting their code, or in cases like
above, even mentioning it in the change logs.

I have searched with google and various other major search engines for days
and have found no up to date or complete xinput API documentation.  It has
been frustrating.  Am I overlooking something obvious or have the Xwindows
developers lost the ability to communicate in recent years?

I have always griped and complained about hardware vendors, such as Wacom,
ignoring open source platforms like Linux and FreeBSD and only putting out
drivers for Microshaft.  Now I may be beginning to understand one of the
reasons why.  It's hard to write drivers or debug code for a poorly documented
platform, where most of the documentation either does not exist or is wrong or
incomplete or hasn't been updated in 10 years.

BTW, before anybody points out that there are existing Xwindows drivers for
Wacom and other tablets, I do realize that.  1, I have never had much luck
getting them to work on FreeBSD.  This is getting too long to go into those
issues.  And 2, I am taking a very different approach than the existing
drivers to provide features and capabilities, that we wanted for in-house use,
that the existing drivers do not have. I will document it if I get it working
well enough to release to the public.

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xf86-video-sis 0/6] Minor clean up patches for SiS DDX Version 0.12.1

2019-12-16 Thread Kevin Brace
From: Kevin Brace 

Nothing really changes the functionality of the code.

--

Kevin Brace (6):
  Use unsigned long when performing PCI read / write
  Fix type mismatch compilation warnings when TWDEBUG macro is defined
  Remove unnecessary SiS PCI Device IDs
  Remove a reference to _XF86_PCIINFO_H
  Clean up SiS PCI Device IDs
  Clean up XGI Technology PCI Device IDs

 src/sis.h| 77 ++--
 src/sis_driver.c | 10 
 src/sis_setup.c  | 10 
 3 files changed, 34 insertions(+), 63 deletions(-)

--
2.7.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xf86-video-sis 5/6] Clean up SiS PCI Device IDs

2019-12-16 Thread Kevin Brace
From: Kevin Brace 

Define newer (?) SiS PCI Device IDs without the use of #ifndef.

Signed-off-by: Kevin Brace 
---
 src/sis.h | 32 +---
 1 file changed, 5 insertions(+), 27 deletions(-)

diff --git a/src/sis.h b/src/sis.h
index 321a2bd..2d691a5 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -322,38 +322,16 @@
 #define PCI_CHIP_SIS6326   0x6326
 #define PCI_CHIP_SIS3000x0300
 #define PCI_CHIP_SIS315H   0x0310
+#define PCI_CHIP_SIS3150x0315
 #define PCI_CHIP_SIS315PRO 0x0325
 #define PCI_CHIP_SIS3300x0330
-#define PCI_CHIP_SIS6300x6300
 #define PCI_CHIP_SIS5400x5300
+#define PCI_CHIP_SIS6300x6300
 #define PCI_CHIP_SIS5500x5315
 #define PCI_CHIP_SIS6500x6325
-
-/* For SiS315/550/650/740/330/660 - these should be moved elsewhere! */
-#ifndef PCI_CHIP_SIS315H
-#define PCI_CHIP_SIS315H   0x0310
-#endif
-#ifndef PCI_CHIP_SIS315
-#define PCI_CHIP_SIS3150x0315
-#endif
-#ifndef PCI_CHIP_SIS315PRO
-#define PCI_CHIP_SIS315PRO 0x0325
-#endif
-#ifndef PCI_CHIP_SIS550
-#define PCI_CHIP_SIS5500x5315  /* 550_VGA */
-#endif
-#ifndef PCI_CHIP_SIS650
-#define PCI_CHIP_SIS6500x6325  /* 650_VGA and 740_VGA */
-#endif
-#ifndef PCI_CHIP_SIS330
-#define PCI_CHIP_SIS3300x0330
-#endif
-#ifndef PCI_CHIP_SIS660
-#define PCI_CHIP_SIS6600x6330  /* 661_VGA, 741_VGA, 760_VGA, 
761_VGA */
-#endif
-#ifndef PCI_CHIP_SIS340
-#define PCI_CHIP_SIS3400x0340
-#endif
+#define PCI_CHIP_SIS3300x0330
+#define PCI_CHIP_SIS6600x6330
+#define PCI_CHIP_SIS3400x0340

 #ifndef PCI_VENDOR_XGI
 #define PCI_VENDOR_XGI 0x18ca
--
2.7.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xf86-video-sis 2/6] Fix type mismatch compilation warnings when TWDEBUG macro is defined

2019-12-16 Thread Kevin Brace
From: Kevin Brace 

Signed-off-by: Kevin Brace 
---
 src/sis_driver.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/sis_driver.c b/src/sis_driver.c
index 51c9660..390f887 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -7722,7 +7722,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 SiSPostSetMode(pScrn, >ModeReg);

 #ifdef TWDEBUG
-xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBFlags %lx\n", 
pSiS->VBFlags);
+xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBFlags %x\n", 
pSiS->VBFlags);
 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"REAL REGISTER CONTENTS AFTER SETMODE:\n");
  (*pSiS->ModeInit)(pScrn, mode);
@@ -9752,7 +9752,7 @@ SISAdjustFrame(ADJUST_FRAME_ARGS_DECL)
 base += (pSiS->dhmOffset/4);

 #ifdef TWDEBUG
-xf86DrvMsg(0, 0, "AdjustFrame: x %d y %d bpp %d dw %d base %d, dhmOffset 
%d\n",
+xf86DrvMsg(0, 0, "AdjustFrame: x %d y %d bpp %d dw %d base %lx, dhmOffset 
%d\n",
x, y, pSiS->CurrentLayout.bitsPerPixel, 
pSiS->CurrentLayout.displayWidth, base, pSiS->dhmOffset);
 #endif

@@ -10291,7 +10291,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
  pSiS->cmdQueueBase = (unsigned int *)temp;
  outSISIDXREG(SISCR, 0x55, tempCR55);
 #ifdef TWDEBUG
- xf86DrvMsg(0, 0, "CmdQueueOffs 0x%x, CmdQueueAdd %p, shwrp 0x%x, 
status %x, base %p\n",
+ xf86DrvMsg(0, 0, "CmdQueueOffs 0x%x, CmdQueueAdd %p, shwrp 0x%x, 
status %lx, base %p\n",
pSiS->cmdQueueOffset, pSiS->cmdQueueBase, 
*(pSiS->cmdQ_SharedWritePort),
SIS_MMIO_IN32(pSiS->IOBase, 0x85cc), (ULong *)temp);
 #endif
@@ -12999,7 +12999,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
NoOverlay ? "no" : ((pSiS->MiscFlags & 
MISC_SIS760ONEOVERLAY) ? "one" : "two"));

 #ifdef TWDEBUG
-  xf86DrvMsg(0, 0, "SiS760: Memclock %d, c1 %d/%d c2 %d/%d, sum %d 
/ %x\n",
+  xf86DrvMsg(0, 0, "SiS760: Memclock %d, c1 %d/%d c2 %d/%d, sum %d 
/ %lx\n",
pSiS->MemClock, myclock1, mycoldepth1,
myclock2, mycoldepth2, dotclocksum, 
pSiS->SiS_SD2_Flags);
 #endif
@@ -13733,7 +13733,7 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr 
mode, unsigned int VBFlags,
intj;

 #ifdef TWDEBUG
-   xf86DrvMsg(0, X_INFO, "Inside CheckCalcModeIndex (VBFlags %lx, mode 
%dx%d)\n",
+   xf86DrvMsg(0, X_INFO, "Inside CheckCalcModeIndex (VBFlags %x, mode 
%dx%d)\n",
VBFlags,mode->HDisplay, mode->VDisplay);
 #endif

--
2.7.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xf86-video-sis 1/6] Use unsigned long when performing PCI read / write

2019-12-16 Thread Kevin Brace
From: Kevin Brace 

When thinking about 64-bit ISA environment, 32-bit PCI read / write
should be performed as a unsigned long type.

Signed-off-by: Kevin Brace 
---
 src/sis.h   |  8 
 src/sis_setup.c | 10 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/sis.h b/src/sis.h
index 789b1d6..6861e8e 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -807,7 +807,7 @@ typedef struct {
 UShort ch70xx[64];
 unsigned int sisMMIO85C0;
 UChar  sis6326tv[0x46];
-unsigned int sisRegsPCI50, sisRegsPCIA0;
+unsigned long sisRegsPCI50, sisRegsPCIA0;
 UChar  BIOSModeSave;
 } SISRegRec, *SISRegPtr;

@@ -1621,12 +1621,12 @@ extern int   SiS_GetTVyscale(ScrnInfoPtr pScrn);
 extern int   SiS_GetSISCRT1SaturationGain(ScrnInfoPtr pScrn);
 extern void  SiS_SetSISCRT1SaturationGain(ScrnInfoPtr pScrn, int val);

-extern unsigned int sis_pci_read_device_u32(int device, int offset);
+extern unsigned long sis_pci_read_device_u32(int device, int offset);
 extern unsigned char sis_pci_read_device_u8(int device, int offset);
-extern unsigned int sis_pci_read_host_bridge_u32(int offset);
+extern unsigned long sis_pci_read_host_bridge_u32(int offset);
 extern unsigned char sis_pci_read_host_bridge_u8(int offset);
 extern void sis_pci_write_host_bridge_u8(int offset, unsigned char value);
-extern void sis_pci_write_host_bridge_u32(int offset, unsigned int value);
+extern void sis_pci_write_host_bridge_u32(int offset, unsigned long value);
 #endif  /* _SIS_H_ */


diff --git a/src/sis_setup.c b/src/sis_setup.c
index 355c5ac..562f28d 100644
--- a/src/sis_setup.c
+++ b/src/sis_setup.c
@@ -113,7 +113,7 @@ sis_get_device (int device)
 return bridge;
 }

-unsigned int
+unsigned long
 sis_pci_read_device_u32(int device, int offset)
 {
 struct pci_device *host_bridge = sis_get_device(device);
@@ -134,7 +134,7 @@ sis_pci_read_device_u8(int device, int offset)
 }

 void
-sis_pci_write_host_bridge_u32(int offset, unsigned int value)
+sis_pci_write_host_bridge_u32(int offset, unsigned long value)
 {
 struct pci_device *host_bridge = sis_get_device(0);
 pci_device_cfg_write_u32(host_bridge, value, offset);
@@ -148,7 +148,7 @@ sis_pci_write_host_bridge_u8(int offset, unsigned char 
value)
 }

 #else
-unsigned int
+unsigned long
 sis_pci_read_device_u32(int device, int offset)
 {
 PCITAG tag = pciTag(0, device, 0);
@@ -163,7 +163,7 @@ sis_pci_read_device_u8(int device, int offset)
 }

 void
-sis_pci_write_host_bridge_u32(int offset, unsigned int value)
+sis_pci_write_host_bridge_u32(int offset, unsigned long value)
 {
 pciWriteLong(0x, offset, value);
 }
@@ -177,7 +177,7 @@ sis_pci_write_host_bridge_u8(int offset, unsigned char 
value)

 #endif

-unsigned int
+unsigned long
 sis_pci_read_host_bridge_u32(int offset)
 {
 return sis_pci_read_device_u32(0, offset);
--
2.7.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xf86-video-sis 6/6] Clean up XGI Technology PCI Device IDs

2019-12-16 Thread Kevin Brace
From: Kevin Brace 

Signed-off-by: Kevin Brace 
---
 src/sis.h | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/sis.h b/src/sis.h
index 2d691a5..70a961b 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -333,17 +333,18 @@
 #define PCI_CHIP_SIS6600x6330
 #define PCI_CHIP_SIS3400x0340

-#ifndef PCI_VENDOR_XGI
-#define PCI_VENDOR_XGI 0x18ca
-#endif

-#ifndef PCI_CHIP_XGIXG20
-#define PCI_CHIP_XGIXG20   0x0020
-#endif
+/*
+ * XGI Technology PCI Vendor ID
+ */
+#define PCI_VENDOR_XGI 0x18CA

-#ifndef PCI_CHIP_XGIXG40
+/*
+ * XGI Technology PCI Device ID
+ */
+#define PCI_CHIP_XGIXG20   0x0020
 #define PCI_CHIP_XGIXG40   0x0040
-#endif
+

 /* pSiS->Flags (old series only) */
 #define SYNCDRAM   0x0001
--
2.7.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xf86-video-sis 4/6] Remove a reference to _XF86_PCIINFO_H

2019-12-16 Thread Kevin Brace
From: Kevin Brace 

xf86PciInfo.h was removed long time ago by commit
f6d49466ca538c65fa8c66352e421c2624e204f1.

Signed-off-by: Kevin Brace 
---
 src/sis.h | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/sis.h b/src/sis.h
index c7edfd3..321a2bd 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -302,9 +302,14 @@
 #define SISVERBLEVEL 4
 #endif

-#ifndef _XF86_PCIINFO_H
+/*
+ * SiS PCI Vendor ID
+ */
 #define PCI_VENDOR_SIS 0x1039
-/* SiS */
+
+/*
+ * SiS PCI Device ID
+ */
 #define PCI_CHIP_SG86C201  0x0001
 #define PCI_CHIP_SG86C202  0x0002
 #define PCI_CHIP_SIS5597   0x0200
@@ -324,8 +329,6 @@
 #define PCI_CHIP_SIS5500x5315
 #define PCI_CHIP_SIS6500x6325

-#endif
-
 /* For SiS315/550/650/740/330/660 - these should be moved elsewhere! */
 #ifndef PCI_CHIP_SIS315H
 #define PCI_CHIP_SIS315H   0x0310
--
2.7.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel