All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Samuelsson <ulf.samuelsson@atmel.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: xtscal fails + other Xorg init problems.
Date: Sat, 15 Aug 2009 13:51:26 +0200	[thread overview]
Message-ID: <4A86A13E.6020402@atmel.com> (raw)
In-Reply-To: <1250330779.4406.9.camel@utx.utx.cz>

Stanislav Brabec skrev:
> Phil Blundell wrote:
>> On Sat, 2009-08-15 at 11:15 +0200, Ulf Samuelsson wrote:
>>> Looks like xtscal in x11-image fails.
>>>
>>> $ DISPLAY=":0.0" xtscal
>>> XCALIBRATE extension missing
>> That error is fairly self-explanatory: your xserver lacks the XCALIBRATE
>> extension.  Xtscal won't work if this is missing.
> 
> Well, there may be a problem in recipes. There is xcalibrate and
> libxcalibrate. Both provide the same library. Some recipes use
> xcalibrate in DEPENDS, some use libxcalibrate. libxcalibrate does not
> compile on images with xserver-kdrive.
> 
> I think that the fix will require complete removal of xcalibrate:
> - xcalibrate_20060312.bb and xcalibrate_cvs.bb seems to be no more used.
> - xcalibrate_git.bb needs to be moved to libxcalibrate_git.bb using its
> version.
> - libxcalibrate probably needs to be moved to model specific directories
> (kdrive images need different version than xorg versions).
> - Update preferred versions for particular image.
> - and finally libxcalibrate should use standard git PV/PR allowing
> future upgrade.
> 
> Alternative solution: Fix the latest libxcalibrate to work with bothe
> Xorg and kdrive.


I have looked through the code.
x11-image uses Xorg and libxcalibrate.

There can be several reasons for this error message:

1) Xmalloc fails
2) There is no extension XCALIBRATE
3) There is an extension, but with different casing
   XCALIBRATE is used by libxcalibrate.
   if another name is used when it is added,
   then there is a problem when queried.
   The library is called libXcalibrate.so.

   How does it get its name?




xtscal contains:

  screen = DefaultScreen (dpy);

  if (XCalibrateQueryExtension (dpy, &event_base, &error_base))
    {
      int r;

      if (flag_debug)
	fprintf (stderr, "Using XCALIBRATE\n");

      r = XCalibrateSetRawMode (dpy, True);
      if (r)
	{
	  fprintf (stderr, "failed to set raw mode: error %d\n", r);
	  exit (1);
	}
    }
  else
    {
      perror ("XCALIBRATE extension missing");
      exit (1);
    }

The error message is printed, if XCalibrateQueryExtension returns false.
-----------------------------------------------------------------

I have found the XCalibrateQueryExtension in libxcalibrate/xcalibrate.c

Bool
XCalibrateQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
    XExtDisplayInfo *info = XCalibrateFindDisplay (dpy);

    if (XextHasExtension(info))
    {
	*event_basep = info->codes->first_event;
	*error_basep = info->codes->first_error;
	return True;
    }
    else
	return False;
}


XCalibrateQueryExtension returns false
	if XextHasExtension(info) is false
-----------------------------------------------------------------
From extutil.h:
#define XextHasExtension(i) ((i) && ((i)->codes))

=> ((info) && ((info)->codes)) is false

Problem occurs if
	info = XCalibrateFindDisplay (dpy)
results in
	info = NULL
	info->codes = NULL

-----------------------------------------------------------------
XCalibrateFindDisplay

XExtDisplayInfo *
XCalibrateFindDisplay (Display *dpy)
{
    XExtDisplayInfo *dpyinfo;
    XCalibrateInfo	    *xci;

    dpyinfo = XextFindDisplay (&XCalibrateExtensionInfo, dpy);
    if (!dpyinfo)
    {
	dpyinfo = XextAddDisplay (&XCalibrateExtensionInfo, dpy,
				  XCalibrateExtensionName,
				  &xcalibrate_extension_hooks,
				  XCalibrateNumberEvents, 0);
	xci = Xmalloc (sizeof (XCalibrateInfo));
	if (!xci)
	    return 0;
	xci->major_version = -1;
	dpyinfo->data = (char *) xci;
    }
    return dpyinfo;
}


if XextFindDisplay returns a non-NULL result, then this is returned.
	- not a problem

If it returns a NULL result, then
	XextAddDisplay is called.
	If the Xmalloc fails, we return 0	: Possible problem!
	if XextAddDisplay returns 0;		: Possible problem


-----------------------------------------------------------------
XextAddDisplay


If Xmalloc fails, we return 0.
If it does not fail, we set
	dpyinfo->codes = XInitExtension (dpy, ext_name);
	
if dpyinfo->codes == NULL we test
	if(hooks->close_display) ==
	if(&xcalibrate_extension_hooks->close_display) ==
	if(XCalibrateCloseDisplay) which I assume is true

	We then do
		codes = XAddExtension(dpy);
		if codes == non-NULL
			we return NULL 		-- Possible problem

	"XInitExtension()determines if the named extension exists. Then it
allocates storage for maintaining the information about the extension on
the connection, chains this onto the extension list for the connection,
and returns the information the stub implementor will need to access the
extension. If the extension does not exist, XInitExtension() returns 	NULL.
	
	If the extension name is not in the Host Portable Character Encoding
the result is implementation dependent. Case matters; the strings
thing, 	Thing, and thinG are all considered different names. "

	Do we have the right CASE for this name?
	If not we have a problem...

	char XCalibrateExtensionName[] = XCALIBRATE_NAME;

xcalibratewire.h
	#define XCALIBRATE_NAME "XCALIBRATE"

if dpyinfo->codes == non-NULL we return dpyinfo
	-- No problem

-------------------------------------------------------------
static /* const */ XExtensionHooks xcalibrate_extension_hooks = {
    NULL,				/* create_gc */
    NULL,				/* copy_gc */
    NULL,				/* flush_gc */
    NULL,				/* free_gc */
    NULL,				/* create_font */
    NULL,				/* free_font */
    XCalibrateCloseDisplay,		/* close_display */
    XCalibrateWireToEvent,		/* wire_to_event */
    XCalibrateEventToWire,		/* event_to_wire */
    NULL,				/* error */
    NULL,				/* error_string */
};
-------------------------------------------------------------


/*
 * XextAddDisplay - add a display to this extension
 */
XExtDisplayInfo *
XextAddDisplay(XExtensionInfo *extinfo, Display *dpy,
	       char *ext_name, XExtensionHooks *hooks, int nevents,
	       XPointer data)
{
    XExtDisplayInfo *dpyinfo;

    dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo));
    if (!dpyinfo) return NULL;
    dpyinfo->display = dpy;
    dpyinfo->data = data;
    dpyinfo->codes = XInitExtension (dpy, ext_name);

    /*
     * if the server has the extension, then we can initialize the
     * appropriate function vectors
     */
    if (dpyinfo->codes) {
	int i, j;

	for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++) {
	    XESetWireToEvent (dpy, j, hooks->wire_to_event);
	    XESetEventToWire (dpy, j, hooks->event_to_wire);
	}
	if (hooks->create_gc)
	  XESetCreateGC (dpy, dpyinfo->codes->extension, hooks->create_gc);
	if (hooks->copy_gc)
	  XESetCopyGC (dpy, dpyinfo->codes->extension, hooks->copy_gc);
	if (hooks->flush_gc)
	  XESetFlushGC (dpy, dpyinfo->codes->extension, hooks->flush_gc);
	if (hooks->free_gc)
	  XESetFreeGC (dpy, dpyinfo->codes->extension, hooks->free_gc);
	if (hooks->create_font)
	  XESetCreateFont (dpy, dpyinfo->codes->extension, hooks->create_font);
	if (hooks->free_font)
	  XESetFreeFont (dpy, dpyinfo->codes->extension, hooks->free_font);
	if (hooks->close_display)
	  XESetCloseDisplay (dpy, dpyinfo->codes->extension,
			     hooks->close_display);
	if (hooks->error)
	  XESetError (dpy, dpyinfo->codes->extension, hooks->error);
	if (hooks->error_string)
	  XESetErrorString (dpy, dpyinfo->codes->extension,
			    hooks->error_string);
    } else if (hooks->close_display) {
	/* The server doesn't have this extension.
	 * Use a private Xlib-internal extension to hang the close_display
	 * hook on so that the "cache" (extinfo->cur) is properly cleaned.
	 * (XBUG 7955)
	 */
	XExtCodes *codes = XAddExtension(dpy);
	if (!codes) {
	    XFree(dpyinfo);
	    return NULL;
	}
	XESetCloseDisplay (dpy, codes->extension, hooks->close_display);
    }

    /*
     * now, chain it onto the list
     */
    _XLockMutex(_Xglobal_lock);
    dpyinfo->next = extinfo->head;
    extinfo->head = dpyinfo;
    extinfo->cur = dpyinfo;
    extinfo->ndisplays++;
    _XUnlockMutex(_Xglobal_lock);
    return dpyinfo;
}

-------------------------------------------------------------
XAddExtension

> 
> 
> ________________________________________________________________________
> Stanislav Brabec
> http://www.penguin.cz/~utx/zaurus
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel


-- 
Best Regards
Ulf Samuelsson




  reply	other threads:[~2009-08-15 12:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-16 20:16 [PATCH] xserver-kdrive-common: fixed xTs_Calibrate script name Ihar Hrachyshka
2009-05-16 20:39 ` Koen Kooi
2009-05-16 20:59 ` Phil Blundell
2009-05-18 12:45   ` Florian Boor
2009-08-15  9:15   ` xtscal fails + other Xorg init problems Ulf Samuelsson
2009-08-15  9:37     ` Phil Blundell
2009-08-15 10:06       ` Stanislav Brabec
2009-08-15 11:51         ` Ulf Samuelsson [this message]
2009-08-15 22:23           ` Stanislav Brabec
2009-08-16 19:38             ` Ulf Samuelsson
2009-08-17  8:51           ` Phil Blundell
2009-08-16 21:33         ` Phil Blundell
2009-08-17 10:20           ` Ulf Samuelsson
2009-08-17 16:30           ` Stanislav Brabec
2009-08-17 23:22             ` Stanislav Brabec
2009-08-18 10:26               ` Stanislav Brabec
2009-08-18 10:34                 ` Koen Kooi
2009-08-18 11:45                 ` Phil Blundell
2009-08-18 15:22                 ` Ulf Samuelsson
2009-08-18 18:35                   ` Stanislav Brabec
2009-08-19 15:40                     ` Ulf Samuelsson
2009-08-15  9:39     ` Phil Blundell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A86A13E.6020402@atmel.com \
    --to=ulf.samuelsson@atmel.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.