Commit Graph

14619 Commits

Author SHA1 Message Date
Keith Packard 23a11fd85e doc: Create a script to filter xmlto output
This reduces the build log spam while still preserving the xmlto
status to catch build failures correctly.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-05 14:24:06 -08:00
Keith Packard 1c01633877 Merge remote-tracking branch 'ajax/xserver-next' 2015-01-04 17:02:25 -08:00
Olivier Fourdan 3573855514 Remove explicit dependency on $(WAYLAND_LIBS)
Xwayland Makefile explicitely set its dependencies on
WAYLAND_LIBS. If the ibrairies are installed in a non-standard
path, WAYLAND_LIBS contains '-L/path/to/the/lib' which will fail
at build time with:

"No rule to make target '-L/path/to/the/lib', needed by 'Xwayland'.
 Stop"

Remove that explicit dependency to avoid the problem (LDADD ought
to be enough to get the right libraries linked).

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-01-04 16:51:19 -08:00
Peter Hutterer de89c6b8c6 xfree86: rename Xorg.bin to Xorg
If the suid wrapper is enabled, /usr/bin/Xorg is just a shell script that
execs either /usr/libexec/Xorg.bin directly or the Xorg.wrap binary which then
execve's /usr/libexec/Xorg.bin.

Either way, we end up with Xorg.bin, which is problematic for two reasons:
* ps shows the command as Xorg.bin
* _COMM and _EXE in systemd's journal will both show Xorg.bin as well

There's not much we can do about the path, but having the actual command stay
as Xorg means better compatibility to existing scripts. And, the reason for
this path: the command
   journalctl _COMM=Xorg
works universally, regardless of whether the wrapper is used or not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
2015-01-05 09:53:58 +10:00
Peter Hutterer ee21be1324 dix: offset touch root coordinates by ScreenRec origins (#86655)
For two ScreenRecs abs pointer positioning was working fine, but touch events
stuck to the lower/right edge on any screen but the one with a 0/0 origin.
Cause is a missing offset by the screen coordinates, causing the root
coordinates in the event to desktop-wide, not screen-wide.

Offset properly, just like we do for pointer events.

X.Org Bug 86655 <http://bugs.freedesktop.org/show_bug.cgi?id=86655>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-05 09:53:47 +10:00
Keith Packard dc777c346d dix: Allow zero-height PutImage requests
The length checking code validates PutImage height and byte width by
making sure that byte-width >= INT32_MAX / height. If height is zero,
this generates a divide by zero exception. Allow zero height requests
explicitly, bypassing the INT32_MAX check.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-01-03 21:57:28 -08:00
Michele Baldessari 924996c41c ephyr: Implement per-screen colormaps
Xephyr's pseudocolor emulation added in:

    commit 81a3b6fe27
    Author: Matthew Allum <breakfast@10.am>
    Date:   Mon Nov 8 22:39:47 2004 +0000

        Add support to Xephyr for lower depths than hosts

only tracks one global colormap for the whole (Xephyr) display.  Move
this to per-screen state so each screen's colormap can be correct.

[ajax: rebased to 1.17, cleaned up commit message]
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michele Baldessari <michele@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-01-02 13:55:14 -08:00
Carl Worth 7b076fdfc0 os/xsha1.c: Add license and copyright attribution.
I'm interested in copying this code to the mesa project, but before
doing that it seems prudent to have the license and copyright
attributions in place before copying that. To get this list of names I
went through:

	git log -- os/xsha1.c
and:
	git log -- render/glyph.c

Signed-off-by: Keith Packard <keithp@keithp.com>
2015-01-02 13:39:52 -08:00
Kenneth Graunke 6672606420 modesetting: Fix build with --disable-glamor.
present.c: In function 'ms_present_flush':
present.c:204:9: error: implicit declaration of function
'glamor_block_handler'

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87858
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-01-01 10:52:30 -08:00
Keith Packard d723928870 glamor: Fix nlines in glamor_xv_put_image when src_y is odd
The number of lines of video to update in the texture needs to be
computed from the height of the updated source, not the full height of
the source.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-12-28 15:12:33 -08:00
Kenneth Graunke 09230a2d43 modesetting: Add vblank synchronization support when using Present.
modesetting hooked up vblank support for DRI2, but was missing support
for vblanks in Present.

This is mostly copy and pasted from Keith's code in the intel driver.

v2: Use ms_crtc_msc_to_kernel_msc in ms_present_queue_vblank to hook
    up the vblank_offset workaround for bogus MSC values (which the
    DRI2 code already did).

    Also simplify the ms_present_get_crtc function.  vblank.c already
    implements the functionality; we just need to convert types.

v3: Fix ms_flush_drm_events return code.  I'd copied code where 0 meant
    success into a function that returned a boolean, so the return code
    was always backwards.

    Also add DebugPresent calls in ms_present_vblank_{handler,abort}.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:39:19 -08:00
Kenneth Graunke 3b5be33fc5 modesetting: Include glamor.h from driver.h.
We basically want it throughout the driver.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:39:17 -08:00
Kenneth Graunke 7d1fc04d27 modesetting: Check DPMS mode in ms_covering_crtc().
crtc->enabled is insufficient; we should also make sure DPMS is on.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:39:14 -08:00
Kenneth Graunke 8affaade2c modesetting: Track the CRTC's DPMS mode.
We don't want to try to vblank synchronize to monitors which are off.

In order to handle that properly, we need to know the CRTC's DPMS mode.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:39:12 -08:00
Kenneth Graunke b51f804b1c present: If present_queue_vblank() fails, do present_execute().
Previously, if present_queue_vblank() failed, we simply dropped the
present request on the floor, and returned an error.  This was rather
mean to clients - after presenting, they wait for a PresentComplete
event to come back.  But since the present never happens, they end up
waiting forever, and lock up in poll().

This patch falls back to present_execute if present_queue_vblank fails.
We still print a debugging message to warn when queueing fails, which
allows us to continue debugging problems, but makes Present robust
enough to not lock up people's compositing manager when vblank bugs
happen.

v2: Don't do present_queue_vblank() /and/ present_execute() (a bug that
    snuck in during last minute tidying).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:39:04 -08:00
Dima Ryazanov f9e22cefcb Fix "Back", "Forward", and other special mouse buttons in XWayland.
Currently, the indexes are off by 4 because of the scroll buttons.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:31:38 -08:00
Michel Dänzer 70a6f65f9e glamor: Make sure Xvideo source image data is properly aligned
_glamor_upload_bits_to_pixmap_texture currently ignores the stride
parameter, but __glamor_upload_pixmap_to_texture uses 4-byte alignment
via glPixelStorei(GL_UNPACK_ALIGNMENT, 4).

Also fix up the stride argument passed in though, in case it starts
being used properly in the future.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87455
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:30:16 -08:00
Michel Dänzer 11b85ab2fc glamor: Make glamor_purge_fbo static
Only called from glamor_fbo.c now.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:03:10 -08:00
Michel Dänzer 8323d2e901 glamor: Call glamor_pixmap_destroy_fbo from glamor_set_pixmap_private
Calling glamor_purge_fbo directly was incorrect for large pixmaps.

Fixes use-after free with large pixmaps:

==2029== Invalid write of size 8                                                                                                                                      ~
==2029==    at 0x85F93AD: __xorg_list_del (list.h:184)
==2029==    by 0x85F93AD: xorg_list_del (list.h:204)
==2029==    by 0x85F93AD: glamor_fbo_expire (glamor_fbo.c:280)
==2029==    by 0x85F95CA: glamor_pixmap_fbo_cache_put (glamor_fbo.c:159)
==2029==    by 0x85D7AB5: glamor_destroy_textured_pixmap (glamor.c:228)
==2029==    by 0xC1BDDC4: radeon_glamor_destroy_pixmap (radeon_glamor.c:272)
==2029==    by 0x519D00: damageDestroyPixmap (damage.c:1473)
==2029==    by 0x4DD307: XvDestroyPixmap (xvmain.c:370)
==2029==    by 0x4DB975: ShmDestroyPixmap (shm.c:258)
==2029==    by 0x5098F6: FreePicture (picture.c:1425)
==2029==    by 0x85E678E: glamor_composite_clipped_region (glamor_render.c:1558)
==2029==    by 0x85F763A: glamor_composite_largepixmap_region (glamor_largepixmap.c:1347)
==2029==    by 0x85E7964: _glamor_composite (glamor_render.c:1679)
==2029==    by 0x85E7A38: glamor_composite (glamor_render.c:1758)
==2029==  Address 0x1141d3c0 is 0 bytes inside a block of size 64 free'd
==2029==    at 0x4C29E90: free (vg_replace_malloc.c:473)
==2029==    by 0x85D7167: glamor_set_pixmap_private (glamor.c:570)
==2029==    by 0xC1BDDC4: radeon_glamor_destroy_pixmap (radeon_glamor.c:272)
==2029==    by 0x519D00: damageDestroyPixmap (damage.c:1473)
==2029==    by 0x4DD307: XvDestroyPixmap (xvmain.c:370)
==2029==    by 0x4DB975: ShmDestroyPixmap (shm.c:258)
==2029==    by 0x45B246: doFreeResource (resource.c:875)
==2029==    by 0x45BD5E: FreeResource (resource.c:905)
==2029==    by 0x43444B: ProcFreePixmap (dispatch.c:1422)
==2029==    by 0x43856E: Dispatch (dispatch.c:432)
==2029==    by 0x43C96F: dix_main (main.c:298)
==2029==    by 0x6CFAB44: (below main) (libc-start.c:287)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:02:49 -08:00
Keith Packard 0d37c7e4b5 modesetting: Detect whether damage tracking is needed
Call drmModeDirtyFB and check the return value to detect whether the
driver support for damage tracking is present, only initialize it in
that case.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-12-25 12:59:56 -08:00
Keith Packard 7804305673 modesetting: Fix damage tracking auto-disable code
dispatch_dirty_region was only returning -EINVAL error codes,
otherwise it would return 0. The kernel returns -ENOSYS when the
driver doesn't support damage tracking, so dispatch_dirty would never
see the error and never disable damage tracking.

Pass all errors back from dispatch_dirty_region and let dispatch_dirty
deal with them.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-12-25 12:59:46 -08:00
Alan Coopersmith 826e7c2b36 Solaris: Move shared declarations to xf86_OSlib.h
Gets rid of gcc 4.8 warnings:
 xf86AutoConfig.c:211:9: warning: nested extern declaration of
  'xf86SolarisFbDev' [-Wnested-externs]
 sun_VTsw.c:44:1: warning: no previous prototype for 'xf86VTRelease'
  [-Wmissing-prototypes]
 sun_VTsw.c:59:1: warning: no previous prototype for 'xf86VTAcquire'
  [-Wmissing-prototypes]

and ensures caller & definition stay in sync.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-19 18:16:19 -08:00
Alan Coopersmith bebcac0cf7 Move RTLD_DI_SETSIGNAL code into a separate block to quiet warning
Gets rid of gcc 4.8 warning:
 osinit.c:211:9: warning: ISO C90 forbids mixed declarations and code
  [-Wdeclaration-after-statement]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-19 18:16:15 -08:00
Keith Packard 2c7111235c modesetting: Enable Xv when using glamor
This just calls the existing function to create the relevant Xv
adaptor and hook it up.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2014-12-19 18:09:15 -08:00
Keith Packard 5a541bd5e7 modesetting: [v2] Don't re-enable the cursor when loading the image
Hidden cursors also have their image updated; re-enabling the cursor
each time the image is set will cause it to re-appear.

 * Unifies the code that was in  drmmode_load_cursor_argb and
  drm_mode_show_cursor and moves it to a new drmmode_set_cursor

 * Add a new boolean, 'cursor_up', to the per-crtc
   private data to track whether the cursor should be displayed.

 * Call drmmode_set_cursor from drm_mode_show_cursor and, if
   the cursor should be displayed, from drm_mode_load_cursor_argb.

v2: Call drmModeSetCursor2 when loading a new cursor image if the
    cursor should be displayed.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2014-12-18 10:04:48 -08:00
Michel Dänzer 0f5fdaf600 glamor: Make sure glamor_egl_close_screen wraps glamor_close_screen
The other way around fails to destroy the screen pixmap EGL image:

==1782== 80 (32 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 981 of 2,171
==1782==    at 0x4C28C20: malloc (vg_replace_malloc.c:296)
==1782==    by 0xF9D4BD2: dri2_create_image_from_dri (egl_dri2.c:1264)
==1782==    by 0xF9D4BD2: dri2_create_image_dma_buf (egl_dri2.c:1764)
==1782==    by 0xF9D4BD2: dri2_create_image_khr (egl_dri2.c:1798)
==1782==    by 0xF9C7937: eglCreateImageKHR (eglapi.c:1494)
==1782==    by 0x85D5655: _glamor_egl_create_image (glamor_egl.c:134)
==1782==    by 0x85D5655: glamor_egl_create_textured_pixmap (glamor_egl.c:302)
==1782==    by 0x85D579B: glamor_egl_create_textured_screen (glamor_egl.c:225)
==1782==    by 0xC1BE05D: radeon_glamor_create_screen_resources (radeon_glamor.c:67)
==1782==    by 0xC1B6153: RADEONCreateScreenResources_KMS (radeon_kms.c:258)
==1782==    by 0x4B2105: xf86CrtcCreateScreenResources (xf86Crtc.c:709)
==1782==    by 0x43C823: dix_main (main.c:223)
==1782==    by 0x6CFAB44: (below main) (libc-start.c:287)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-11 19:36:47 -08:00
Michel Dänzer c8d4c0a25d glamor: Make glamor_destroy_textured_pixmap idempotent
For robustness against drivers which may call both
glamor_(egl_)destroy_textured_pixmap and glamor_destroy_pixmap.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-11 19:36:31 -08:00
Michel Dänzer 0355e280a3 glamor: Make glamor_set_pixmap_private not crash if the pixmap has no fbo
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-11 19:36:19 -08:00
Michel Dänzer 45b333525e glamor: Fix use-after-free in glamor_destroy_textured_pixmap
==25551== Invalid read of size 8
==25551==    at 0x85D5F2C: glamor_egl_destroy_pixmap_image (glamor_egl.c:527)
==25551==    by 0x85D7750: glamor_destroy_pixmap (glamor.c:235)
==25551==    by 0xC1BDD9B: radeon_glamor_destroy_pixmap (radeon_glamor.c:278)
==25551==    by 0x5098F6: FreePicture (picture.c:1425)
==25551==    by 0x85DD7A9: glamor_unrealize_glyph_caches (glamor_glyphs.c:257)
==25551==    by 0x85D7B50: glamor_close_screen (glamor.c:586)
==25551==    by 0x4B1A82: xf86CrtcCloseScreen (xf86Crtc.c:734)
==25551==    by 0x4CFFC7: CursorCloseScreen (cursor.c:187)
==25551==    by 0x513A44: AnimCurCloseScreen (animcur.c:106)
==25551==    by 0x51529B: present_close_screen (present_screen.c:64)
==25551==    by 0x43CA83: dix_main (main.c:351)
==25551==    by 0x6CFAB44: (below main) (libc-start.c:287)
==25551==  Address 0x83dafa0 is 96 bytes inside a block of size 152 free'd
==25551==    at 0x4C29E90: free (vg_replace_malloc.c:473)
==25551==    by 0x85D76B4: glamor_destroy_textured_pixmap (glamor.c:225)
==25551==    by 0x85D7750: glamor_destroy_pixmap (glamor.c:235)
==25551==    by 0xC1BDD9B: radeon_glamor_destroy_pixmap (radeon_glamor.c:278)
==25551==    by 0x5098F6: FreePicture (picture.c:1425)
==25551==    by 0x85DD7A9: glamor_unrealize_glyph_caches (glamor_glyphs.c:257)
==25551==    by 0x85D7B50: glamor_close_screen (glamor.c:586)
==25551==    by 0x4B1A82: xf86CrtcCloseScreen (xf86Crtc.c:734)
==25551==    by 0x4CFFC7: CursorCloseScreen (cursor.c:187)
==25551==    by 0x513A44: AnimCurCloseScreen (animcur.c:106)
==25551==    by 0x51529B: present_close_screen (present_screen.c:64)
==25551==    by 0x43CA83: dix_main (main.c:351)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-11 19:35:59 -08:00
Alan Coopersmith 913416b718 Solaris: delete undocumented, unuseful -protect0 flag
Solaris already makes the page at address 0 inaccessible by default to
catch NULL pointer bugs, we don't need a double secret undocumented flag
to try to make our own hacky attempt at it.

As a bonus, deleting this code removes gcc warning of:

sun_init.c: In function 'xf86OpenConsole':
sun_init.c:103:17: warning: declaration of 'fd' shadows a previous local [-Wshadow]
             int fd = -1;
                 ^
sun_init.c:89:9: warning: shadowed declaration is here [-Wshadow]
     int fd;
         ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:44:14 -08:00
Kenneth Graunke 7b784df51b modesetting: Use GBM for buffer allocations if Glamor supports it.
For performance, Glamor wants to render to tiled buffers, not linear
ones.  Using GBM allows us to pick the 3D driver's preferred tiling
modes.

v2: Declare drmmode->gbm as void * if !GLAMOR_HAS_GBM.
v3: Just use a forward declaration of struct gbm_device.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Dave Airlie cfef64b0ca glamor: Add an accessor for the GBM device.
(Originally written by Dave Airlie; split into a separate patch by
Kenneth Graunke.)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Kenneth Graunke 980535757d modesetting: Create a drmmode_bo wrapper; use it for front_bo.
This code is going to be extended to support GBM BOs soon.  This small
abstraction removes a lot of direct dumb_bo access, so we can add that
support in one place, rather than putting conditionals at every
pitch/handle/etc access.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Kenneth Graunke c6388964b0 modesetting: Drop dumb_bo::map_count field and dead unmap code.
The drm kernel API for dumb BOs apparently doesn't include an unmap
ioctl, so we can't do much here.  It looks like this code was copied
from libkms, which was also unfinished.

We may as well delete the dead variable that simply gets incremented
and never read.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Kenneth Graunke 87cc0c0d31 modesetting: Move dumb_bo into its own source files.
Eventually, drmmode_display will be able to use GBM for handling
buffers, and won't need dumb_bo.  Keeping the display related logic
and buffer object abstraction in separate files seems a bit tidier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Kenneth Graunke af4f94b08e modesetting: Create helper for glamor_egl_create_textured_screen call.
This will need to change when we add GBM support; by pulling it into a
helper function, we should only have to edit one place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Kenneth Graunke b4324c6a23 modesetting: Move ModifyPixmapHeader calls out of if/else branches.
Both branches called ModifyPixmapHeader with essentially the same
parameters.  By using new_pixels in the shadowfb case, we can make
them completely the same, and move them out a level, for simplicity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Kenneth Graunke 35e9924484 modesetting: Stop using glamor_egl_create_textured_screen_ext().
The _ext variant takes an additional pointer argument, which it now
ignores, thanks to Keith's recent patches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-11 11:26:19 -08:00
Michel Dänzer 91651e7c15 glamor: Reinstate glamor_(egl_)destroy_textured_pixmap
They are part of the ABI.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-10 19:29:08 -08:00
Michele Baldessari e774663fa5 ephyr: Implement per-screen colormaps
Xephyr's pseudocolor emulation added in:

    commit 81a3b6fe27
    Author: Matthew Allum <breakfast@10.am>
    Date:   Mon Nov 8 22:39:47 2004 +0000

        Add support to Xephyr for lower depths than hosts

only tracks one global colormap for the whole (Xephyr) display.  Move
this to per-screen state so each screen's colormap can be correct.

[ajax: rebased to 1.17, cleaned up commit message]
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Michele Baldessari <michele@redhat.com>
2014-12-10 11:04:09 -05:00
Adam Jackson cadd70c809 glx: Add hack for GLX-1.2-style naked windows to GetDrawableAttributes
Some people like to call this on bare Window XIDs and expect reasonable
results.  I sure wish they wouldn't, but since they do, if we're given
a window without any glx decoration just fill in as much as we can. This
means you won't actually get an answer for GLX_FBCONFIG_ID and friends,
but there's not much to be done about that, and it matches what NVIDIA's
driver seems to do.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54080
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-12-10 11:01:43 -05:00
Adam Jackson f452b4a47b glx: Dynamically compute attribute slot in GetDrawableAttributes
No functional change.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-12-10 11:01:30 -05:00
Neil Roberts c1455f76c6 glx: Add implementation of __GLXContext->loseCurrent for direct ctxts
This adds a dummy implementation for the loseCurrent function in
__GLXContext for direct contexts which just returns GL_TRUE. Without
this then the X server can crash if receives a MakeCurrent message for
a direct context because it will attempt to call loseCurrent when
cleaning up the client in the callback for ClientStateGone.

[ajax: added assumed s-o-b line]

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86531
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-09 14:15:55 -08:00
Keith Packard 6704bb0ed7 Merge remote-tracking branch 'alanc/master' 2014-12-09 11:47:11 -08:00
Keith Packard 1559a94395 dix: GetHosts bounds check using wrong pointer value [CVE-2014-8092 pt. 6]
GetHosts saves the pointer to allocated memory in *data, and then
wants to bounds-check writes to that region, but was mistakenly using
a bare 'data' instead of '*data'. Also, data is declared as void **,
so we need a cast to turn it into a byte pointer so we can actually do
pointer comparisons.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-09 11:30:52 -08:00
Keith Packard 9802a0162f Missing parens in REQUEST_FIXED_SIZE macro [CVE-2014-8092 pt. 5]
The 'n' parameter must be surrounded by parens in both places to
prevent precedence from mis-computing things.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-09 11:28:07 -08:00
Keith Packard 61b17c0f10 glx: Can't mix declarations and code in X.org sources [CVE-2014-8098 pt. 9]
We're using compiler compatibility settings which generate warnings
when a variable is declared after the first statement.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-09 11:27:26 -08:00
Keith Packard b20912c3d4 dbe: Call to DDX SwapBuffers requires address of int, not unsigned int [CVE-2014-8097 pt. 2]
When the local types used to walk the DBE request were changed, this
changed the type of the parameter passed to the DDX SwapBuffers API,
but there wasn't a matching change in the API definition.

At this point, with the API frozen, I just stuck a new variable in
with the correct type. Because we've already bounds-checked nStuff to
be smaller than UINT32_MAX / sizeof(DbeSwapInfoRec), we know it will
fit in a signed int without overflow.

Signed-off-by: Keith Packard <keithp@keithp.com
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-09 11:26:58 -08:00
Keith Packard 8aa23f27c7 glamor: Free existing EGL image when assigning new one
When reallocating the framebuffer on screen resize, the old EGL image
was getting leaked. Check for an existing EGL image and free it in
this case.

Signed-off-by: Keith Packard <keithp@keithp.com>
Revewied-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2014-12-09 08:48:46 -08:00
Keith Packard c22433d55e glamor: Remove redundant reference to screen pixmap EGL image
There's no reason to store this in the egl screen private as the
screen pixmap will always hold a reference to it anyways.

Signed-off-by: Keith Packard <keithp@keithp.com>
Revewied-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2014-12-09 08:48:28 -08:00