Commit Graph

329 Commits

Author SHA1 Message Date
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
Kirill Elagin
5361121339 Fix server crash due to invalid images
See https://bugs.freedesktop.org/show_bug.cgi?id=39383

Signed-off-by: Kirill Elagin <kirelagin@gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-04 20:18:17 -07:00
Aaron Plattner
03d032991d fb: Rename wfbTriangles and wfbTrapezoids
These symbols were not renamed when they were added to libfb:

 # nm -D libwfb.so | grep ' fb'
 0000000000028d00 T fbTrapezoids
 0000000000028d60 T fbTriangles

This causes corruption and/or crashes on wfb-ful drivers like nvidia:

 Program received signal SIGABRT, Aborted.
 0x00007fd67f3a0405 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
 64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
     in ../nptl/sysdeps/unix/sysv/linux/raise.c
 (gdb) bt
 #0  0x00007fd67f3a0405 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
 #1  0x00007fd67f3a3680 in *__GI_abort () at abort.c:92
 #2  0x00007fd67f3995b1 in *__GI___assert_fail (assertion=0x7fd679ecb804 "key->initialized", file=<optimized out>, line=116, function=0x7fd679ecbbc0 "dixGetPrivateAddr")
     at assert.c:81
 #3  0x00007fd679ec55b6 in ?? () from /usr/lib/xorg/modules/libfb.so
 #4  0x00007fd679eca9ef in ?? () from /usr/lib/xorg/modules/libfb.so
 #5  0x00007fd679ecae20 in fbTriangles () from /usr/lib/xorg/modules/libfb.so
 #6  0x00007fd67a58fc55 in ?? () from /usr/lib/xorg/modules/drivers/nvidia_drv.so
 #7  0x00000000004f38d1 in ?? ()
 #8  0x0000000000437ae9 in ?? ()
 #9  0x0000000000426eaa in ?? ()
 #10 0x00007fd67f38cead in __libc_start_main (main=<optimized out>, argc=<optimized out>, ubp_av=<optimized out>, init=<optimized out>, fini=<optimized out>,
     rtld_fini=<optimized out>, stack_end=0x7fff99860d78) at libc-start.c:228
 #11 0x000000000042719d in _start ()

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-09-21 14:14:05 -07:00
Adam Jackson
e32cc0b4c8 fb: Fix memcpy abuse
The memcpy fast path implicitly assumes that the copy walks
left-to-right.  That's not something memcpy guarantees, and newer glibc
on some processors will indeed break that assumption.  Since we walk a
line at a time, check the source and destination against the width of
the blit to determine whether we can be sloppy enough to allow memcpy.
(Having done this, we can remove the check for !reverse as well.)

On an Intel Core i7-2630QM with an NVIDIA GeForce GTX 460M running in
NoAccel, the broken code and various fixes for -copywinwin{10,100,500}
gives (edited to fit in 80 columns):

1: Disable the fastpath entirely
2: Replace memcpy with memmove
3: This fix
4: The code before this fix

  1            2                 3                 4           Operation
------   ---------------   ---------------   ---------------   ------------
258000   269000 (  1.04)   544000 (  2.11)   552000 (  2.14)   Copy 10x10
 21300    23000 (  1.08)    43700 (  2.05)    47100 (  2.21)   Copy 100x100
   960      962 (  1.00)     1990 (  2.09)     1990 (  2.07)   Copy 500x500

So it's a modest performance hit, but correctness demands it, and it's
probably worth keeping the 2x speedup from having the fast path in the
first place.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-08-15 15:38:16 -07:00
Cyril Brulebois
fe6f489d21 fb: Mark some variables as unused.
There's no use for the values set through the various macro calls
(fbGetDrawable and fbGetDrawablePixmap), so mark those variables as unused.

The following warnings go away accordingly:
|   CC     libfb_la-fb24_32.lo
| fb24_32.c: In function 'fb24_32ReformatTile':
| fb24_32.c:544:19: warning: variable 'newYoff' set but not used [-Wunused-but-set-variable]
| fb24_32.c:544:10: warning: variable 'newXoff' set but not used [-Wunused-but-set-variable]
| fb24_32.c:543:19: warning: variable 'oldYoff' set but not used [-Wunused-but-set-variable]
| fb24_32.c:543:10: warning: variable 'oldXoff' set but not used [-Wunused-but-set-variable]
|   CC     libfb_la-fbfill.lo
| fbfill.c: In function 'fbFill':
| fbfill.c:72:21: warning: variable 'stipYoff' set but not used [-Wunused-but-set-variable]
| fbfill.c:72:11: warning: variable 'stipXoff' set but not used [-Wunused-but-set-variable]
| fbfill.c💯21: warning: variable 'stipYoff' set but not used [-Wunused-but-set-variable]
| fbfill.c💯11: warning: variable 'stipXoff' set but not used [-Wunused-but-set-variable]
| fbfill.c:142:20: warning: variable 'tileYoff' set but not used [-Wunused-but-set-variable]
| fbfill.c:142:10: warning: variable 'tileXoff' set but not used [-Wunused-but-set-variable]
|   CC     libfb_la-fbgc.lo
| fbgc.c: In function 'fbPadPixmap':
| fbgc.c:92:19: warning: variable 'yOff' set but not used [-Wunused-but-set-variable]
| fbgc.c:92:13: warning: variable 'xOff' set but not used [-Wunused-but-set-variable]
| fbgc.c: In function 'fbCanEvenStipple':
| fbgc.c:166:23: warning: variable 'stipYoff' set but not used [-Wunused-but-set-variable]
| fbgc.c:166:13: warning: variable 'stipXoff' set but not used [-Wunused-but-set-variable]
|   CC     libfb_la-fbpush.lo
| fbpush.c: In function 'fbPushPixels':
| fbpush.c:238:20: warning: variable 'stipYoff' set but not used [-Wunused-but-set-variable]
| fbpush.c:238:10: warning: variable 'stipXoff' set but not used [-Wunused-but-set-variable]

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-06-16 00:43:50 +02:00
Cyril Brulebois
8da16898d9 fb: Simplify logic, get rid of set but unused variable.
wrapped is only useful is FB_ACCESS_WRAPPER is set; simplify the logic
accordingly, and only set it when that's defined.

The following warning goes away accordingly:
|   CC     libfb_la-fbarc.lo
| fbarc.c: In function 'fbPolyArc':
| fbarc.c:71:11: warning: variable 'wrapped' set but not used [-Wunused-but-set-variable]

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-06-16 00:43:49 +02:00
Alan Coopersmith
1b2d17748f fbbltone.c: Mark bitmasks as unsigned ints
Clears many Sun compiler warnings:
"fbbltone.c", line 491: warning: integer overflow detected: op "<<"
"fbbltone.c", line 491: warning: integer overflow detected: op "<<"
"fbbltone.c", line 491: warning: integer overflow detected: op "<<"
"fbbltone.c", line 491: warning: initializer will be sign-extended: -16777216
"fbbltone.c", line 491: warning: integer overflow detected: op "<<"
"fbbltone.c", line 491: warning: initializer will be sign-extended: -1
"fbbltone.c", line 495: warning: integer overflow detected: op "<<"
"fbbltone.c", line 495: warning: integer overflow detected: op "<<"
"fbbltone.c", line 495: warning: integer overflow detected: op "<<"
"fbbltone.c", line 495: warning: initializer will be sign-extended: -256
"fbbltone.c", line 495: warning: integer overflow detected: op "<<"
"fbbltone.c", line 495: warning: initializer will be sign-extended: -1
"fbbltone.c", line 499: warning: integer overflow detected: op "<<"
"fbbltone.c", line 499: warning: integer overflow detected: op "<<"
"fbbltone.c", line 499: warning: integer overflow detected: op "<<"
"fbbltone.c", line 499: warning: initializer will be sign-extended: -65536
"fbbltone.c", line 499: warning: integer overflow detected: op "<<"
"fbbltone.c", line 499: warning: initializer will be sign-extended: -1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-05-25 09:35:39 -06:00
Keith Packard
ec9ea40178 Merge remote-tracking branch 'jeremyhu/master' 2011-04-27 12:01:56 -07:00
Jeremy Huddleston
fd086f87cd fb: Silence warnings when building with clang
fbpict.c:163:8: warning: implicit conversion from enumeration type 'PictFormatShort' (aka 'enum _PictFormatShort') to different enumeration
      type 'pixman_format_code_t' [-Wconversion]
        pict->format,
        ~~~~~~^~~~~~

fbbltone.c:486:2: warning: shift result (281474959933440) requires 49 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
        C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0),
        ^~~~~~~~~~~~
fbbltone.c:474:6: note: instantiated from:
     SelMask24(b,1,r))
     ^
fbbltone.c:429:46: note: instantiated from:
                                                    ^
fbbltone.c:427:18: note: instantiated from:
                      0xffffff << Mask24Check(x,r)) : 0)
                      ~~~~~~~~ ^

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-04-25 10:45:34 -07:00
Søren Sandmann Pedersen
c6cb70be1e Fix trapezoid and triangle rendering to windows
For fbAdd{Traps,Triangles}() and fbRasterizeTrapezoid() this is just a
matter of adding the image offsets to the trap offsets.

For fbShapes, the story is more complicated:

The recently added pixman API did not allow offsetting
trapezoids. Instead, it would use x_dst and y_dst in such a way that
the effect was to only offset the source image.

In pixman 0.21.8, this API has changed such that all the traps are
conceptually rendered to an infinitely big image, and the source and
destination coordinates are then aligned with (0, 0) of that
image. This means offsetting dst_x and dst_y will now offset the
entire drawing, which is similar to how other composite functions
work.

This patch then changes fbComposite{Triangles,Traps} such that the
source image is aligned with the shapes, and the destination
coordinates offset according to drawable->{x, y}.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-04-22 22:11:20 -04:00
Søren Sandmann Pedersen
1b96a99d8e fb: Call miCompositeSourceValidate() on the source in fbShapes()
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-04-22 22:11:11 -04:00
Søren Sandmann Pedersen
c7bce22b58 Track damage for fbTrapezoids() and fbTriangles().
These calls no longer go through the CompositePicture() hook, so
damage was no longer generated for them. This patch simply damages the
entire destination clip region.

It would be possible to generate tighter damage for certain operators
such as Over and Add, where blank source pixels have no effect on the
destination, but given that virtually all trapezoid rendering takes
place on pixmaps, it's unlikely that anybody would actually benefit
from this optimization, and the miTrapezoidBounds function did
sometimes show up on profiles, probably because it does several
divisions per trapezoid.

V2: Call DamageRegionProcessPending() - pointed out by Michel Dänzer.
V3: Call DamageRegionProcessPending() *after* rendering -
        pointed out by Maarten Maathuis

Reviewed-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2011-04-22 21:37:58 -04:00
Tiago Vignatti
2aa935bc5c fb: fix memory leak in fbOverlayFinishScreenInit
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 15:41:13 +03:00
Tiago Vignatti
dce2f10cf7 mi: fix memory leak in miInitVisuals
Free the pointers inside miInitVisuals, so the callers of this function
(fboverlay.c and fbscreen.c) don't need to worry with deallocation in the case
of failure.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 15:41:13 +03:00
Dave Airlie
f9834d312e fb: cleanup fbChangeWindowAttributes
This cleans up the duplication in fbChangeWindowAttributes,
and fixes a bug if the fb24_32ReformatTile ever failed,
since the old code would happily dereference it in the fbEvenTile
call a few lines later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2011-04-01 11:02:17 +10:00
Dave Airlie
36c7158133 fb: drop comments around 24-bit support.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-04-01 10:32:27 +10:00
Dave Airlie
ac2ae2ed37 fb: add back fb defines for driver compat.
we could drop these really and just fixup the drivers, but
since they'll build fine but fail to work this seems safer.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-04-01 10:31:07 +10:00
Dave Airlie
be9cfb249d fb: drop defines that aren't used/necessary anymore.
This was generated by:
cd fb
coan source --replace -DFB_SCREEN_PRIVATE -DFB_24BIT -DFB_24_32BIT -DFB_SCREEN_PRIVATE -UFBNOPIXADDR -UFBNO24BIT -UFBNO24_32 *.[ch]

A follow up patch readds the FB_24_32BIT define for Intel UXA.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-04-01 10:28:06 +10:00
Keith Packard
d5b16b037b Revert "dix: Remove usage_hint from pixmaps, store it in ->drawable.class"
This reverts commit 1564c82417.

The drivers used the top bits of the usage_hint to store driver
private flags (intel, radeon, nouveau).

With EXA we need to get at this data so if we migrate the pixmap we
can create the correct type of pixmap in the driver, however this
commit truncates the usage_hint into 8-bit class and loses all the
good stuff.

Signed-off-by: Dave Airlie <airlied@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-03-17 23:48:52 -07:00
Søren Sandmann Pedersen
57b35adaed Remove geometry arguments from miSourceValidate()
The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.

Additionally, the miSourceValidate() function was buggy in at least
three respects:

(a) It added drawable->{x,y} before calling down, which is wrong since
    the misprite code already adds them in its check. (Alternatively,
    the misprite code is wrong, but there are actual users who would
    notice if that code was broken).

(b) It didn't account for the width of the interpolation filter, so if
    the Picture had a bilinear or convolution filter, the edges
    surrounding the source area would not be validated.

(c) It didn't validate alpha maps.

Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.

This patch changes miSourceValidate() to simply validate all of the
underlying drawable.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-03-14 13:57:42 -04:00
Adam Jackson
1564c82417 dix: Remove usage_hint from pixmaps, store it in ->drawable.class
The class field was unused for pixmaps, and we don't have enough classes
to justify a whole uint32 anyway.

Reviewed-by: Soren Sandmann <ssp@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:16:50 -05:00
Søren Sandmann Pedersen
7dff79e395 Implement fbAddTriangles() in terms of pixman_add_triangles()
This allows the remaining triangle-to-trap conversion code to be
deleted.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2011-02-26 13:58:54 -05:00
Søren Sandmann Pedersen
566f1931ee Move miTriangles to fb as fbTriangles()
The fb version simply calls the new pixman_composite_triangles(). This
allows us to get rid of miCreateAlphaPicture().

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2011-02-26 13:58:54 -05:00
Søren Sandmann Pedersen
788ccb9a8b Move miTrapezoids() into fb as fbTrapezoids()
The main consumer of trapezoids, cairo, is using the Trapezoids
request, which is currently implemented in the miTrapezoids()
function. That function splits the request into smaller bits and calls
lower level functions such as AddTrap.

By moving the implementation of the whole request into fb, we can
instead call pixman_composite_trapezoids() to do the whole request in
one step.

There are no callers of miTrapezoids in any of the open source
drivers, although exa and uxa have their own copies of the function.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2011-02-26 13:58:53 -05:00
Adam Jackson
59d8e3cbdb fb: Remove hw/xfree86/ from includes
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-02-08 12:41:13 -05:00
Alan Coopersmith
2db6951763 Sun's copyrights now belong to Oracle
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-12-07 11:10:35 -08:00
Jesse Adkins
84e8de1271 fb: Remove fbcmap.c (bug 5436)
This is obsolete since a240c039c4.
Updated fb.h to mention that the functions come from fbcmap_mi.c now.
Dropped fbcmap.c from the makefile.

Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-10 21:37:24 -08:00
Søren Sandmann Pedersen
3dc3aefb88 fb: Delete a bunch more left-overs
All of these definitions were unused since compositing moved to pixman.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2010-11-02 03:36:45 -04:00
Søren Sandmann Pedersen
565b5e2b02 wfb: Delete unused renamings
These functions haven't existed in a while.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2010-11-02 03:36:45 -04:00
Søren Sandmann Pedersen
0dae479e16 fb: Delete fbCompositeGeneral()
This function was an unused and trivial wrapper around fbComposite().

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2010-11-02 03:36:45 -04:00
Søren Sandmann Pedersen
74bc2d8c6b render: Delete renderedge.[ch]
The functions in these files have not been used since trap
rasterization was moved to pixman. They survived until now to preserve
the server abi.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2010-11-01 22:54:18 -04:00
Søren Sandmann Pedersen
6118346d64 Delete unused fbWalkCompositeRegion()
This function has not been used since most of the compositing was
moved to pixman. The only reason it has survived until now is that it
was part of the server ABI.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2010-11-01 22:04:49 -04:00
Alan Coopersmith
1333e101b4 Remove leftover fbSaveAreas & fbRestoreAreas defines from wfbrename.h
The fb functions they try to rename were deleted in 2007 by
commit ae7f71a8b3

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-10-13 09:16:51 -07:00
Jamey Sharp
bbbf795e6b Delete redundant GC initializations.
When a GC is allocated, it is zeroed, including all storage requested
with dixRegisterPrivateKey. So CreateGC hooks don't need to initialize
anything to zero.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
2010-09-13 15:55:17 -07:00
Jamey Sharp
f856dcdc3a Delete unused lastWinOrg field from GCs.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-09-13 15:55:17 -07:00
Jamey Sharp
5ff9e58bef fb: Delete unused oneRect private field.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-09-13 15:55:16 -07:00
Keith Packard
3e56efcfb6 fb: make isClipped always reject negative coordinates (bug 11503)
A window with either dimension > 32767 can be positioned such that
coordinates > 32767 are visible on the screen. Attempts to draw to
those pixels will generate coordinates wrapped around to negative
values.

The optimized clipping macro, 'isClipped', in fbbits.h, computes
clipping in window space rather than screen space using int16 values,
and so it too has coordinates wrapped around to negative values and
hence ends up accepting the wrapped drawing coordinates.

Two possible fixes for this problem

 1) Detect wrapped region coordinates and clip those to 32767.
 2) Detect negative incoming coordinates and reject those

This patch takes the second approach as it is much shorter, simply
detecting when either X or Y incoming coordinate is negative, which
can never be 'within' any drawable.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-08-20 10:01:48 -07:00
Keith Packard
ff70848e62 Don't let alpha maps recurse in fb. Bug 23581.
Recursive alpha maps (where one picture's alpha map is set to a
picture with an external alpha map) would be all fine and dandy,
except for the case where the client constructs a loop. Detecting this
case when setting the alpha map values would be difficult as any time
an alpha map is set, the server would have to check for the looping
case.

Instead, a far simpler fix is to simply disallow recursive alpha maps
in the rendering code, the Render spec is ambiguous in this area and
allows us to to ignore the recursive case.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-08-10 09:18:22 -07:00
Alan Coopersmith
c5eb5d69e5 Record some additional library dependencies in xf86 modules
Helps with symbol resolution when building with -z defs

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-06-10 19:01:22 -07:00
Mikhail Gusarov
7287ef9e6c Remove unnecessary parentheses around return values in functions
This patch was generated by the following Perl code:

perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:42:42 -07:00
Jamey Sharp
a0fe6987b5 Clean up after removal of screen parameters from region macros.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-06-05 22:07:21 -07:00
Keith Packard
faeebead7b Change the devPrivates API to require dixRegisterPrivateKey
This patch only changes the API, not the implementation of the
devPrivates infrastructure. This will permit a new devPrivates
implementation to be layed into the server without requiring
simultaneous changes in every devPrivates user.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-06-05 19:23:03 -07:00
Keith Packard
2dc138922b Rename region macros to eliminate screen argument
This is a combination of a huge mechanical patch and a few small
fixups required to finish the job. They were reviewed separately, but
because the server does not build without both pieces, I've merged
them together at this time.

The mechanical changes were performed by running the included
'fix-region' script over the whole tree:

$ git ls-files | grep -v '^fix-' | xargs ./fix-region

And then, the white space errors in the resulting patch were fixed
using the provided fix-patch-whitespace script.

$ sh ./fix-patch-whitespace

Thanks to Jamey Sharp for the mighty fine sed-generating sed script.

The hand-done changes involve removing functions from dix/region.c
that duplicate inline functions in include/regionstr.h, along with
their declarations in regionstr.h, mi.h and mispans.h.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05 18:59:00 -07:00
Keith Packard
9b6f5f549d Change region implementation names to eliminate the 'mi' prefix
This prepares the file to be moved from mi to dix. This patch
was done mechanically with the included scripts 'fix-miregion' run over
the entire X server and 'fix-miregion-private' run over
include/regionstr.h and mi/miregion.c.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05 17:47:32 -07:00
Jamey Sharp
e7fae9ecc4 Move each screen's root-window pointer into ScreenRec.
Many references to the WindowTable array already had the corresponding
screen pointer handy, which meant they usually looked like
"WindowTable[pScreen->myNum]". Adding a field to ScreenRec instead of
keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

Since dix uses this data, a screen private entry isn't appropriate.

xf86-video-dummy currently uses WindowTable, so it needs to be updated
to reflect this change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Jamey Sharp
6a84cd9434 Replace dixChangeGC with calls directly to the right variant.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13 17:14:07 -07:00
Jamey Sharp
e2929db7b7 dixChangeGC callers: Use ChangeGCVal instead of XID almost everywhere.
The exceptions are ProcChangeGC and CreateGC.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13 17:13:48 -07:00
Jamey Sharp
65cedf3905 Kill DoChangeGC in favor of dixChangeGC.
This doesn't change any behavior, but it isn't clear whether NullClient
is correct in all cases. As ajax says,

> For most of these changes, I think it's correct to use NullClient,
> since they are server-initiated changes and should not fail for (eg)
> xace reasons. ... At any rate, you're certainly not changing any
> semantics by leaving them all as NullClient, so this patch can't be
> more wrong than before.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-12 18:09:55 -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
Jamey Sharp
a2c716eaf6 fb: track screens' installed colormaps as screen privates.
Several DDXes allow each screen to have at most one (or in some cases,
exactly one) installed colormap. These all use the same pattern: Declare
a global-lifetime array of MAXSCREENS ColormapPtrs, and index it by
screen number. This patch converts most of those to use screen privates
instead.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-04-23 15:32:19 +03:00