Commit Graph

113 Commits

Author SHA1 Message Date
Daniel Martin
d5379b350f Use ARRAY_SIZE all over the tree
Roundhouse kick replacing the various (sizeof(foo)/sizeof(foo[0])) with
the ARRAY_SIZE macro from dix.h when possible. A semantic patch for
coccinelle has been used first. Additionally, a few macros have been
inlined as they had only one or two users.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-10-30 13:45:20 -04:00
Adam Jackson
3050d27761 xfree86: Fix X -configure driver sort yet again
There were two bugs here: The comparison function was not stable when
one or more of the drivers being compared is a fallback, and the last
driver in the list would never be moved.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-07-31 10:57:22 -04:00
Julien Cristau
c394f6b273 Replace all checks for 'linux' macro with '__linux__'
gcc -std=c99 does not define the former, and it's a horrible namespace
confusion anyway.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-05-11 15:24:05 -04:00
Adam Jackson
0b6f280602 xfree86: Remove Option "BiosBase" (v2)
Just no.

The ddxDesign chunk removes the whole para about xf86FixPciResource,
since it turns out that function doesn't exist at all anymore.

The only drivers that reference this at all are i128 and mga, and even
then only in the non-pciaccess path.

v2:
- Update commentary about i128/mga
- Don't remove the BiosBase keyword from the config parser since that
  would turn a no-op into a fatal error (Aaron Plattner)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Acked-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-02-16 11:34:46 -05:00
Adam Jackson
ba726ba6a7 loader: Turn LoaderListDirs into LoaderListDir
Callers only ever use this for a single directory anyway.

While we're at it, also move xf86DriverListFromCompile near its only
user in the X -configure code (and inline it out of existence), and
remove LoaderFreeDirList as it's unused (since X -configure is just
going to exit anyway, none of that code cares about cleanup).

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-25 14:22:06 -05:00
Adam Jackson
c54a9ca152 loader: Move loader list details to internal header
There's no reason a driver should ever care about this.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-25 14:22:06 -05:00
Adam Jackson
d55284e863 xfree86: Remove a stray reference to font modules
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-25 14:22:06 -05:00
Adam Jackson
d7879c4672 xfree86: Fix up some bad indentation
indent(1) gets confused by function-like macros with no trailing
semicolon, which is fair enough really.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-25 14:22:05 -05:00
Adam Jackson
a5dd7b890f dix: Squash some new gcc6 warnings
-Wlogical-op now tells us:

    devices.c:1685:23: warning: logical ‘and’ of equal expressions

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-04-29 11:19:58 -04:00
Alan Coopersmith
4cb1034906 Convert hw/xfree86 to new *allocarray functions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:58:08 -07:00
Alan Coopersmith
f3ba909753 Let calloc handle multiplication
It's going to multiply anyway, so if we have non-constant values, might
as well let it do the multiplication instead of adding another multiply,
and good versions of calloc will check for & avoid overflow in the process.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:57:07 -07:00
Peter Hutterer
732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Adam Jackson
35f0257360 xfree86: Remove Option "TextClockFreq"
No modern driver pays attention to this.  Presumably there existed
hardware once where you couldn't just read the right values out of the
CRTC.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-09-26 15:27:18 -04:00
Peter Hutterer
0b193b3ac9 xfree86: use xnfstrdup in the Xorg -configure code
Just for consistency, I'm pretty sure the code is generally not happy for
malloc failures anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-10 07:02:38 +10:00
Peter Hutterer
f14d6647c0 xfree86: unconstify another string
Only Xorg -configure uses a hardcoded value here, so let's not change the rest
of the server for that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-05 14:30:50 +10:00
Peter Hutterer
46ae9d67e4 xfree86: un-constify inp_driver/inp_identifier
The only place this isn't allocated is during Xorg -configure where we just
statically assing "mouse"/"kbd" and the identifiers for it. Everywhere else
it's strdup'd and then free'd already.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-05 14:24:54 +10:00
Keith Packard
07b03e721e xfree86: Fix -Wshadow warnings
Just rename variables to eliminate -Wshadow warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-22 19:56:31 -08:00
Keith Packard
e1e01d2e33 xfree86/common: Warning fixes. Mostly const string handling.
Also removes DPMS functiosn from Xext/dpmsproc.h

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:48 -08:00
Keith Packard
27b44949a3 hw/xfree86: Lots of constant string support
Make lots of string pointers 'const char' so that we can use constant
strings with them without eliciting warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:48 -08:00
Søren Sandmann Pedersen
55246b67b7 xf86AddBusDeviceToConfigure(): Store device in DevToConfig[i].pVideo
After fc3ab84d the pVideo field in DevToConfig[i] is no longer
initialized, so it's always NULL. This causes the duplicate finding
algorithm in the beginning of the function to not work anymore as it
is based on this field.

The symptom of this bug is that X -configure reports

    Number of created screens does not match number of detected devices.
      Configuration failed.
    Server terminated with error (2). Closing log file.

rather than producing a working config file.

This patch fixes that bug by initializing the field before calling
xf86PciConfigureNewDev().

Cc: tvignatti@gmail.com
Signed-off-by: Soren Sandmann <ssp@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-31 18:23:03 -07:00
Adam Jackson
245e7e0361 xfree86: Change the semantics of driverFunc(GET_REQUIRED_HW_INTERFACES)
This is a really awkward interface, since we're calling it well before
the driver knows what device it's going to drive.  Drivers with both KMS
and UMS support therefore don't know whether to say they need I/O port
access or not, and have to assume they do.

With this change we now call it only to query whether port access might
be needed; we don't use that to determine whether to call a driver's
probe function or not, instead we call them unconditionally.  If the
driver doesn't check whether port access was enabled, they might crash
ungracefully.  To accomodate this, we move xorgHWAccess to be explicitly
intentionally exported (sigh xf86Priv.h) so that drivers can check that
before they attempt port access.

v2: Move initial xf86EnableIO() nearer the logic that determines whether
to call it, suggested by Simon Farnsworth.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-09-20 11:07:27 -04:00
Keith Packard
9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Alan Coopersmith
5bc590bde2 DoShowOptions: preserve constness of options list as we walk it
Since all we do with the option list is walk down the list printing
the names, there's no need to cast away its constness.

Clears gcc warning:
xf86Configure.c: In function 'DoShowOptions':
xf86Configure.c:781:4: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:11 -08:00
Alan Coopersmith
09e4b78f79 Fix gcc -Wwrite-strings warnings in xf86 ddx
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:07 -08:00
Alan Coopersmith
6450f6ca7e Move DoShowOptions to xf86Configure.c, delete xf86ShowOpts.c
Gets rid of duplicate static copy of optionTypeToString by putting
both callers of that helper function in the same source file.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:06 -08:00
Tiago Vignatti
6817050f31 configure: wrap PCI code with macro and set it at build time
--disable-pciaccess, used together with --disable-module-int10, can be used to
disable all pci code inside the server.

Note that XSERVER_LIBPCIACCESS was previously used only in the driver side and
now it defines also whether the library is used inside the server. Also,
XORG_BUS_PCI automake variable is introduced to track PCI code needs.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-15 21:18:47 -07:00
Peter Hutterer
f51e42f583 Terminate the log with one last message.
Instead of just closing the log when everything is done, put one more
message in stating that we're actually terminating. Users or scripts that
look at the Xorg.log will then know that a) the server has terminated
properly and b) why the server terminated (to some degree, given that most
real-world errors will be caused by AbortServer()).

Acked-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-27 09:31:02 +10:00
Alexandr Shadchin
7762de65e1 Simplify auto-detect mouse for WSCONS_SUPPORT
Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com>
Reviewed-by: Matthieu Herrbb <matthieu.herrb@laas.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-18 13:04:19 +10:00
Christopher James Halse Rogers
d17a9fb841 Consolidate all the PATH_MAX handling into misc.h
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2011-03-14 13:42:55 -04:00
Adam Jackson
f28e48834e Remove SCO support
This has never been buildable in any modular server release.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2010-12-20 12:11:11 -05:00
Alan Coopersmith
3a9bb93dd1 Convert alloc+sprintf pairs into asprintf() & XNFasprintf() calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-12-07 11:10:35 -08:00
Tiago Vignatti
fc3ab84de7 xfree86: configure: move buses references to their own location
This patch makes xf86Configure.c free of PCI and SBUS code, moving to a more
meaningful location.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2010-09-14 18:51:59 +03:00
Tiago Vignatti
5ea497fc32 xfree86: configure: remove vendor and card name matching rules
Although vendor and board naming are used to create the configure file, the
server doesn't actually use it when fetching such file and probing devices.

Reported-by: Richard Barnette <jrbarnette@chromium.org>
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-07-01 08:04:15 -04:00
Mikhail Gusarov
e4570f5db5 xfree86: Get rid of xstrdup when argument is definitely non-NULL
ditto for XFree86

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-06-11 19:05:46 +07:00
Tiago Vignatti
95889a569f xfree86: bus: delete useless xf86FindPrimaryDevice
This function had a wrong name and was just logging the primary device. No one
cares about it honestly.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
2010-05-24 19:16:02 +03:00
Keith Packard
103507af0c Merge remote branch 'vignatti/bus-cleanup' 2010-05-19 22:27:53 -07:00
Peter Hutterer
c620a1c0a4 xfree86: fix typo in optionTypeToSting.
Because we don't want anyone to get hurt.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-19 22:22:54 -07:00
Tiago Vignatti
0dd299864a xfree86: remove xf86EnableAccess
It's RAC remnant. This was substituted by xf86VGAarbiter{Lock, Unlock}
mechanism.

It's an API break, but the few drivers using it were covered already with
macros to avoid problems.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 18:34:35 +03:00
Tiago Vignatti
2464eb7d56 xfree86: bus: simplify entity related hooks
Remove some out dated commentaries either.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 18:34:15 +03:00
Peter Hutterer
d88ba7721d xfree86: Add option parsing for percent options.
In some cases, an option of "50%" would be preferable over fixed value
configuration - especially if the actual values are autoprobed.
Add a new set of functions to parse percent values from configurations.

The percent value parsing differs slightly - if the option is not to marked
as used (e.g. xf86CheckPercentOption()), no warning is emitted to the log
file if the value is not a percent value. This allows double-options (either
as % or as absolute number) without warnings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-18 15:43:51 -07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Oliver McFadden
e7ff956638 common: xf86Configure: alloc_strlen: Allocated memory does not have space for the terminating NUL of the string
buffer_alloc: Called allocating function "realloc" which allocated memory dictated by parameter "len + strlen(displaySize_string)"
alloc_strlen: Allocated memory does not have space for the terminating NUL of the string
var_assign: Assigned "ptr->mon_comment" to storage allocated by "realloc(ptr->mon_comment, len + strlen(displaySize_string))"

Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-21 15:20:53 -07:00
Peter Hutterer
9ac6a048ef xfree86: remove unused variable in configureDDMonitorSection.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2009-12-11 11:37:37 +10:00
Ma Ling
fc2ec95664 EDID: CEA extension support
Reviewed-by: Adam Jackson <ajax@redhat.com>
2009-10-29 14:04:55 -04:00
Martin Ettl
4df3e8c805 Resource leakage: 0 is a valid file descriptor
When testing if an fd is valid, the required construct is >= 0, not > 0.

[Daniel: Fixed up the Linux MTRR case as well.]

Signed-off-by: Martin Ettl <ettl.martin@gmx.de>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-10-08 13:27:30 +11:00
Tiago Vignatti
41884b8f4d xfree86: remove unused code (xf86Configure.c)
The xorg.conf generator was not assigning correctly the primary device
("bootable") as screen zero. So just skip this kind of routines for now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2009-08-18 15:50:55 +03:00
Tiago Vignatti
097376266f xfree86: remove unaffected code (xf86Configure.c)
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2009-08-18 13:13:57 +03:00
Tiago Vignatti
dd8960a9f3 xfree86: remove stupid macro (xf86Configure.c)
It was confusing more instead helping.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2009-08-18 12:53:47 +03:00
Tiago Vignatti
4ec7667bb1 xfree86: remove wrong commentary
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2009-08-18 12:33:35 +03:00
Tiago Vignatti
2e8c2b8ae6 xfree86: header clean up (xf86Configure.c)
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2009-08-18 12:28:15 +03:00