summaryrefslogtreecommitdiff
path: root/src/radeon.h
AgeCommit message (Collapse)Author
2020-07-13ati: cleanup terminology to use primary/secondaryDave Airlie
The X server changed some API/ABIs here. Based on amdgpu patch by Michel
2020-02-10Don't crash X server if GPU acceleration is not availableAlexey Sheplyakov
Commit d1d8e3c8d0a0a0394d395eba171460501745209b causes X server to fail on startup when GPU acceleration is not working (or is disabled). The reason is that `radeon_get_pixmap_bo` function gets called too early (before EXA has been initialized) and fails with an assert: #0 __GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x76ab1c6c in __GI_abort () at abort.c:79 #2 0x76ac0b64 in __assert_fail_base (fmt=0x76bfbce4 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7658c80c "key->initialized", file=<optimized out>, line=121, function=0x7658d040 <__PRETTY_FUNCTION__.10607> "dixGetPrivateAddr") at assert.c:92 #3 0x76ac0c0c in __GI___assert_fail (assertion=0x7658c80c "key->initialized", file=0x7658c9d0 "../include/privates.h", line=121, function=0x7658d040 <__PRETTY_FUNCTION__.10607> "dixGetPrivateAddr") at assert.c:101 #4 0x76579e6c in dixGetPrivateAddr (key=<optimized out>, key=<optimized out>, privates=<optimized out>) at ../include/privates.h:121 #5 0x7657a954 in dixGetPrivateAddr (key=<optimized out>, key=<optimized out>, privates=<optimized out>) at exa.c:70 #6 dixGetPrivate (key=<optimized out>, privates=<optimized out>) at ../include/privates.h:136 #7 exaGetPixmapDriverPrivate (pPix=<optimized out>) at exa.c:68 #8 0x7623d460 in radeon_get_pixmap_bo (pPix=0x71c1b8) at radeon.h:804 #9 radeon_get_pixmap_handle (pixmap=0x71c1b8, handle=0x7fa22328) at radeon_bo_helper.c:357 #10 0x76244458 in radeon_pixmap_get_fb (pix=0x71c1b8) at radeon.h:886 #11 drmmode_set_mode_major (crtc=0x691860, mode=0x69191c, rotation=<optimized out>, x=<optimized out>, y=<optimized out>) at drmmode_display.c:918 #12 0x762467e8 in drmmode_set_desired_modes (pScrn=0x67c678, drmmode=<optimized out>, set_hw=1) at drmmode_display.c:3128 #13 0x0047bfa4 in MapWindow (client=0x669ec8, pWin=0x7206c0) at window.c:2722 #14 MapWindow (pWin=0x7206c0, client=0x669ec8) at window.c:2665 #15 0x00449650 in dix_main (argc=3, argv=0x7fa22604, envp=<optimized out>) at main.c:247 #16 0x76ab2198 in __libc_start_main (main=0x42db10 <main>, argc=3, argv=0x7fa22604, init=<optimized out>, fini=0x606434 <__libc_csu_fini>, rtld_fini=0x77229930 <_dl_fini>, stack_end=0x7fa225e0) at libc-start.c:308 #17 0x0042db80 in __start () at ../sysdeps/mips/start.S:110 Don't call `exaGetPixmapDriverPrivate` if the acceleration (EXA) is not enabled [yet] to avoid the problem. Closes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/issues/188 Closes: https://bugzilla.altlinux.org/show_bug.cgi?id=37539
2020-02-10Handle NULL fb_ptr in pixmap_get_fbMichel Dänzer
This can happen when HW acceleration is disabled. Fixes https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/issues/188
2019-06-25present: Check that we can get a KMS FB for flippingMichel Dänzer
This can legitimately fail if the pixmap's storage is shared from another device, e.g. when using PRIME render offloading. (Ported from amdgpu commit 7d3fef72e0c871e1677e9e544f4cae5e238b5c52)
2019-04-24Retry get_fb_ptr in get_fbMichel Dänzer
If get_fb_ptr returns NULL, try again after pixmap_get_handle, it should work then. Fixes spurious Present page flipping failures using "normal" pixmaps which aren't shared with direct rendering clients, e.g. with a compositor using the RENDER extension. Bugzilla: https://bugs.freedesktop.org/110417 (Ported from amdgpu commit bf61e6d7ac1a5754b1026d7f80acf25ef622c491) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-12-28Drop RADEONInfoRec::cursor_bo arrayMichel Dänzer
Not needed or even useful for anything. (Ported from amdgpu commit e95044e45350870fa7e237860e89ade91ac03550)
2018-10-24Allow up to six instances in Zaphod modeMichel Dänzer
Corresponding to up to six CRTCs being available in the hardware. (Ported from amdgpu commit c9d43c1deb9a9cfc41a8d6439caf46d12d220853)
2018-08-29EXA: Handle NULL BO pointer in radeon_set_pixmap_boMichel Dänzer
2018-07-17glamor: Invalidate cached GEM handle in radeon_set_pixmap_boMichel Dänzer
We continued using the stale cached handle, causing issues e.g. when resizing the screen via RandR. Reported-by: iive on IRC Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Replace 'foo == NULL' with '!foo'Michel Dänzer
Shorter and sweeter. :) (Ported from amdgpu commit e8e688f3852fb06b0c34ed5bce47c9493bcd1613) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09glamor: Use GBM for BO allocation when possibleMichel Dänzer
Inspired by amdgpu. This avoids various issues due to a GEM handle lifetime conflict between us and Mesa with current glamor. Bugzilla: https://bugs.freedesktop.org/105381 Tested-by: Konstantin Kharlamov <hi-angel@yandex.ru> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09Add struct radeon_bufferMichel Dänzer
Inspired by amdgpu, preparation for the following change. For now, this is mostly a wrapper around struct radeon_bo, no functional change intended. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09Refactor radeon_finish helperMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09Factor out radeon_surface_initialize helperMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09glamor: Don't store radeon_surfaces in pixmapsMichel Dänzer
Only EXA needs them. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-03-14Pass extents to radeon_scanout_do_update by valueMichel Dänzer
radeon_scanout_extents_intersect could leave the scanout damage region in an invalid state, triggering debugging checks in pixman: *** BUG *** In pixman_region_append_non_o: The expression r->x1 < r->x2 was false Set a breakpoint on '_pixman_log_error' to debug (Ported from amdgpu commit 8af989546907ad9fb491d940e1936d3bfc89276b)
2018-03-07Wrap the whole miPointerScreenFuncRec, instead of only Set/MoveCursorMichel Dänzer
We were clobbering entries in mi's global miSpritePointerFuncs struct, which cannot work correctly with multiple primary screens. Instead, assign a pointer to our own wrapper struct to PointPriv->spriteFuncs. Fixes crashes with multiple primary screens. Fixes: 1fe8ca75974c ("Keep track of how many SW cursors are visible on each screen") Reported-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2018-01-25Always use screen depth/bpp for KMS framebuffersMichel Dänzer
DRI clients can use depth 32 pixmaps while the screen is depth 24, in which case page flipping would fail. Reported-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-and-Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2018-01-22Define per x-screen individual drmmode_crtc_funcsMario Kleiner
This allows to en-/disable some functions depending on individual screen settings. Prep work for more efficient depth 30 support. Suggested-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-12-28Keep track of how many SW cursors are visible on each screenMichel Dänzer
And use this to determine when we cannot use page flipping for DRI clients. We previously did this based on whether the HW cursor cannot be used on at least one CRTC, which had at least two issues: * Even while the HW cursor cannot be used, no SW cursor may actually be visible (e.g. because all cursors are disabled), in which case we can use page flipping for DRI clients anyway * Even while the HW cursor can be used, there may be SW cursors visible from non-core pointer devices, in which case we cannot use page flipping for DRI clients anyway (Ported from amdgpu commit 69e20839bfeb3ee0b0a732d72de0a32d6c5435fc) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-12-01Add radeon_dirty_src_drawable helperMichel Dänzer
Allows tidying up radeon_dirty_src_equals and redisplay_dirty slightly. (Cherry picked from amdgpu commit 1d65ac395971571094df21ca0408d5972c6b56ec) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2017-11-27Fix non GLAMOR buildJoakim Tjernlund
Non GLAMOR builds needs pRADEONEnt so move the USE_GLAMOR define down to make pRADEONEnt defined in this case. Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-10-20Unreference pixmap's FB with EXA as well in radeon_set_pixmap_boMichel Dänzer
Not doing so resulted in DRI2 page flips not actually changing the FB being scanned out, showing intermittent flicker of the "back" buffer rendering. Bugzilla: https://bugs.freedesktop.org/102643 Fixes: 55e513b978b2 "Use reference counting for tracking KMS framebuffer lifetimes" Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-30Require xserver >= 1.13Michel Dänzer
xserver 1.13.0 was released on September 6th, 2012, almost 5 years ago. This allows cleaning up a bunch of backwards compatibility code. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-08-29Create radeon_master_screen helperMichel Dänzer
Preparatory, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29Create radeon_pixmap_get_fb_ptr helperMichel Dänzer
Preparatory, no functional change intended yet. Also inline radeon_pixmap_create_fb into radeon_pixmap_get_fb, since there's only one call-site anymore. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Make radeon_scanout_do_update take a PixmapPtr instead of a DrawablePtrMichel Dänzer
All callers were already passing in a pixmap. This allows simplifying the rotated scanout case slightly. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Pass extents to radeon_scanout_do_updateMichel Dänzer
Preparation for following change, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Add source drawable parameter to radeon_scanout_do_updateMichel Dänzer
Preparation for following changes, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Create drmmode_wait_vblank helperMichel Dänzer
Allows cleaning up the code considerably. v2: * Fix "drmWaiVBlank" typo, add blank line for readability (Slava Abramov) * Rename in/out sequence parameters to "target_seq" and "result_seq", hopefully that will be clearer. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> # v1
2017-08-15Adapt to PixmapDirtyUpdateRec::src being a DrawablePtrMichel Dänzer
2017-06-30Use pRADEONEnt->fd exclusively for the DRM file descriptorMichel Dänzer
This brings us closer to amdgpu. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-05-11Use reference counting for tracking KMS framebuffer lifetimesMichel Dänzer
References are held by the pixmaps corresponding to the FBs (so the same KMS FB can be reused as long as the pixmap exists) and by the CRTCs scanning out from them (so a KMS FB is only destroyed once it's not being scanned out anymore, preventing intermittent black screens and worse issues due to a CRTC turning off when it should be on). v2: * Only increase reference count in drmmode_fb_reference if it was sane before * Make drmmode_fb_reference's indentation match the rest of drmmode_display.h Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-04-17Don't set modes before RADEONWindowExposures_oneshot is calledMichel Dänzer
The root window contents may be undefined before that, so we don't want to show anything yet. Fixes a crash on startup with rotation and virtual resolution set in xorg.conf. Bugzilla: https://bugs.freedesktop.org/100276 Fixes: cc9d6b7db9c2 ("Move DPMS check from radeon_scanout_do_update to radeon_scanout_flip") (Ported from amdgpu commit 981bac185cfd74ae50dffc28f57cf34623a9595f) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-08Skip some initialization steps for GPU screensMichel Dänzer
Xorg doesn't use the following functionality of GPU screens, so don't bother initializing it: * DRI page flipping * DRI3 / Present / SYNC fences * XVideo / XvMC * Root window with background None Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-02Call drmmode_set_desired_modes from a WindowExposures hookMichel Dänzer
This is the earliest opportunity where the root window contents are guaranteed to be initialized, and prevents drmmode_set_mode_major from getting called before drmmode_set_desired_modes via RADEONUnblank -> drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is called when running Xorg with -pogo. Fixes intermittently showing garbage on server startup or after server reset. As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc Xorg module) calling RADEONBlockHandler_oneshot repeatedly even after we set pScreen->BlockHandler = RADEONBlockHandler_KMS. v2: * Drop spaces between XORG_VERSION_NUMERIC arguments * Call radeon_bo_wait after radeon_cs_flush_indirect Bugzilla: https://bugs.freedesktop.org/99457 Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
2017-02-22Allow toggling TearFree at runtime via output propertyMichel Dänzer
Option "TearFree" now sets the default value of the output property. See the manpage update for details. TearFree is now enabled by default for outputs using rotation or other RandR transforms, and for RandR 1.4 slave outputs. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-12-05Calculate log base 2 in radeon.h based on clz for all platformsJochen Rollwagen
This commit replaces the inline assembler code (for x86 platforms) and loop (for non-x86 platforms) in RADEONLog2 with a one-liner version based on clz (count leading zeroes). Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-11-29Take current scanout_id into account everywhere involved with TearFreeMichel Dänzer
Fixes various potential issues with TearFree enabled, e.g. outputs freezing after display configuration changes. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-25Add radeon_is_gpu_screen helperMichel Dänzer
This will hopefully decrease the chance of accidentally breaking the build against xserver < 1.13 in the future. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-27Require xserver 1.10 or newerMichel Dänzer
1.10.0 was released in February 2011. We've been accidentally requiring 1.10 or newer since 121a6de72da5 ("Keep track of damage event related flushes per-client v2"). Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-21Free priv in amdgpu_set_pixmap_bo also if priv->bo == NULLMichel Dänzer
Fixes memory leak when destroying pixmaps with priv->bo == NULL. Reported-by: Qiang Yu <qiang.yu@amd.com> (Ported from amdgpu commit 7f7f9825caf3983902491da27c16d14cd8bf9b7d)
2016-09-21Propagate failure from radeon_set_pixmap_boMichel Dänzer
(Ported from amdgpu commits c315c00e44afc91a7c8e2eab5af836d9643ebb88 and 0d42082108c264568e2aadd15ace70e72388bc65)
2016-09-20Use local implementation of RegionDuplicate for older xserverMichel Dänzer
It was only added in xserver 1.15. Fixes build against older xserver. Reported-by: Pali Rohár <pali.rohar@gmail.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-17Keep track of damage event related flushes per-client v2Michel Dänzer
This further reduces the compositing slowdown due to flushing overhead, by only flushing when the X server actually sends XDamageNotify events to a client, and there hasn't been a flush yet in the meantime. v2: Use ScreenPrivateKey, fixes invalid memory access with GPU screens Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-01Use EventCallback to avoid flushing every time in the FlushCallbackMichel Dänzer
We only need to flush for XDamageNotify events. Significantly reduces compositing slowdown due to flushing overhead, in particular with glamor. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-12Explicitly set the fbcon pixmap pitch againMichel Dänzer
The kernel driver returns 0 as the pitch of the fbcon BO via the DRM_RADEON_GEM_GET_TILING ioctl, so we ended up using an incorrect pitch in some cases. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94901 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-31Update pixmap pitch in radeon_set_pixmap_boMichel Dänzer
Stop second guessing it in drmmode_crtc_scanout_create. Fixes display corruption in some cases with TearFree enabled. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94751 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-24Require xserver 1.9 or newerMichel Dänzer
1.9.0 was released in August 2010. We were already unintentionally relying on things not available in 1.8 for at least a year, and nobody has complained. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-23Don't try DRI2/Present flipping while the HW cursor can't be usedMichel Dänzer
Flipping doesn't interact correctly with SW cursor: A flip makes the SW cursor disappear. It will only appear again when the cursor is moved, but it will be surrounded by corruption, because the SW cursor code will restore stale screen contents at the old cursor location before drawing the cursor at the new location. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>