theosib

xi2 multiple cursors

Jul 3rd, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.81 KB | None | 0 0
  1. [10:55:44] <millerti> Hi, everyone. I'm trying to figure out how a graphics DDX module (a GC-level one that uses the xf86 layer) can advertise multiple hardware cursors attach to Xi2 master pointer input devices. I've been digging through the code, and so far I haven't figure out how the core cursor is somehow installed as a sort of general resource that the core pointer input gets attached to. Can anyone give me some pointers in the right
  2. [10:55:44] <millerti> direction? Thanks!
  3. [10:56:51] <ajax> multiple hardware cursors eh
  4. [10:58:58] <millerti> Yeah. I would expect there to be some way to add them as resources that can be discovered by clients and then attached to master devices. No? :)
  5. [11:00:01] <ajax> X clients don't have any way to know if a cursor is drawn in hardware or software
  6. [11:00:21] <millerti> In my imagination, we have slave devices that are installed by plugins. Then somehow using Xi2 client calls, we can create master devices and attach slaves to them. And also cursor "devices".
  7. [11:01:17] <ajax> no. pointer devices may have a cursor or not, but a cursor is a normal X resource with an XID, not an XInput device (which has its own namespace)
  8. [11:01:27] <millerti> That's true. What I mean is, how can a graphics DDX advertise a "cursor resource" that can then (whatever it really is) get attached to a master cursor input device?
  9. [11:01:43] <ajax> what do you mean, cursor resource.
  10. [11:01:54] <ajax> or rather, what do you mean, advertise. clients make cursors.
  11. [11:02:24] <ajax> you bind one to a device with XIChangeCursor
  12. [11:02:25] <millerti> Clients make cursor in a virtual way. But then we have this hardware that can be programmed with the image of that cursor.
  13. [11:03:04] <millerti> Inside X, how can the graphics module indicate that there exists multiple hardware cursors?
  14. [11:03:18] <millerti> I see how it's done for core....
  15. [11:03:33] <millerti> Although I haven't followed the bunny trail all the way down.
  16. [11:04:09] <millerti> There's pScreenPriv->spriteFuncs->RealizeCursor and all that.
  17. [11:04:13] <millerti> For core cursors.
  18. [11:04:54] <millerti> Ooh, or not. return (*pScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCursor);
  19. [11:05:11] <ajax> XIChangeCursor requests eventually get to dix/events.c:ChangeCursor(), which calls pScreen->DisplayCursor()
  20. [11:05:12] <millerti> I gotta figure out what that pDev is.
  21. [11:05:18] <ajax> that pDev is the input device
  22. [11:05:30] <millerti> Master input?
  23. [11:05:39] <ajax> any pointer, master or not.
  24. [11:05:46] <ajax> actually, i might be lying
  25. [11:06:04] <ajax> i think it's always a master, just you may have multiple, and that's what cursors bind to
  26. [11:06:16] <ajax> (forgive me, the docs on this never really got updated for mpx support)
  27. [11:06:26] <millerti> Hmmm... so what if the graphics module creates master cursor devices.... in that case, we'd know which hardware cursor to use.
  28. [11:06:43] <millerti> Am I getting this right?
  29. [11:06:53] <ajax> i think you'd be better off thinking of it as:
  30. [11:07:15] <ajax> dix has no idea how ddx represents cursors. ->DisplayCursor and friends in the pScreen are the only interface.
  31. [11:07:38] <ajax> the mi and xfree86 routines for that make some assumptions, among them that you only have one hardware sprite
  32. [11:08:14] <ajax> you would want to wrap your own code in there instead, that knows how many hardware sprites you have, and allocates among them on demand and otherwise falls down to the mi software stuff
  33. [11:08:32] <millerti> Xi2 has multiple cursor support. What does it *normally* do to display an extension master's cursor?
  34. [11:08:58] <ajax> xi2 calls ->DisplayCursor(pDev, pScreen, pCursor), and the ddx does something.
  35. [11:09:30] <ajax> in the xfree86 case, if that (or no) device already has the hardware cursor, then it is used
  36. [11:09:53] <millerti> Is there some way I can know how many simultaneously active cursors there are?
  37. [11:10:09] <ajax> otherwise it calls down to mi which draws it in software with the usual backing-tile trick
  38. [11:10:32] <millerti> And would I distinguish among them on the basis of pCursor?
  39. [11:11:22] <millerti> But you said that pDev is the input device, so I could look at the ID of the input device and distinguish on the basis of which master, right?
  40. [11:11:23] <ajax> inputInfo.all_master_devices is the list
  41. [11:11:45] <millerti> Ok, I think I'm getting the picture. Thanks!
  42. [11:11:51] <ajax> well, it's the list of all masters. some subset of that is master pointers, and some subset of that is pointers with cursors.
  43. [11:12:30] <millerti> the latter being pointers with cursors that are not necessarily masters?
  44. [11:13:07] <millerti> From the docs I've read, I inferred that you could only have a sprite for a master.
  45. [11:13:35] <ajax> no, strict inclusion. having paged some of this back in, i'm pretty sure only masters can have cursors. but a pointer need not have a cursor, even the core one.
  46. [11:13:59] <ajax> ProcXIChangeCursor():
  47. [11:14:01] <ajax> if (!IsMaster(pDev) || !IsPointerDevice(pDev))
  48. [11:14:01] <ajax> return BadDevice;
  49. [11:18:47] <millerti> Ok, so a client would use ProcXIChangeHierarchy to add a master. I suppose we could rely on the client to do that. I'm not seeing any other way to get at "add_master" in xichangehierarchy.c.
  50. [11:19:14] newbthenewbd (~newbthene@77-255-118-254.adsl.inetia.pl) left IRC (Client Quit)
  51. [11:19:36] <millerti> Ok, so the client creates multiple masters, and when DisplayCursor is called, we can tell which master it is, and then dynamically allocate to hardware cursors. Right?
  52. [11:24:50] <ajax> millerti: right
  53. [11:25:28] <ajax> i suppose there's no intrinsic reason the server couldn't create multiple masters up front, if it knows how to map them
  54. [11:26:36] <ajax> just, neither dix nor the xfree86 ddx nor any of the open drivers does so
Add Comment
Please, Sign In to add comment