Commit Graph

367 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Jose Maria Casanova Crespo 73480f172a modesetting: Fix front_bo leak at drmmode_xf86crtc_resize on XRandR rotation
Since the introduction of "modesetting: Remove unnecessary fb addition from
drmmode_xf86crtc_resize" the fb_id isn't initialited at
drmmode_xf86crtc_resize.

Rotate operation of XRandR uses rotate_bo. So in this case the fb_id
associated to the front_bo is not initialized at drmmode_set_mode_major.
So fd_id remains 0.

As every call to drmmode_xf86crtc_resize allocates a new front_bo we should
destroy unconditionally the old_front_bo if operation success. So we free
the allocated GBM handles.

This avoids crashing xserver with a OOM in the RPI4 1Gb at 4k resolution
after 3 series xrandr rotations from normal to left and vice versa reported at
https://github.com/raspberrypi/firmware/issues/1345

Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1024
Fixes: 8774532121 "modesetting: Remove unnecessary fb addition from
       drmmode_xf86crtc_resize"
2020-06-27 08:29:45 +00:00
Aaron Ma 6a79a737e2 xfree86: add drm modes on non-GTF panels
EDID1.4 replaced GTF Bit with Continuous or Non-Continuous Frequency Display.

Check the "Display Range Limits Descriptor" for GTF support.
If panel doesn't support GTF, then add gtf modes.

Otherwise X will only show the modes in "Detailed Timing Descriptor".

V2: Coding style changes.
V3: Coding style changes, remove unused variate.
V4: remove unused variate.

BugLink: https://gitlab.freedesktop.org/drm/intel/issues/313
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2020-06-23 13:09:20 +08:00
Yuriy Vasilev 5b9010fa6b modesetting: add support for GBM_FORMAT_ARGB1555
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Yuriy Vasilev <uuvasiliev@yandex.ru>
2020-03-13 16:42:30 -04:00
Yuriy Vasilev 8315fc4ea2 modesetting: add support for GBM_FORMAT_RGB565
This allow x-server to run with -depth 16.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Yuriy Vasilev <uuvasiliev@yandex.ru>
2020-03-13 16:42:06 -04:00
Michel Dänzer 49553049e8 modesetting: Remove local variable only used with glamor enabled
Resulted in a build failure with -Werror:

../hw/xfree86/drivers/modesetting/drmmode_display.c: In function ‘drmmode_crtc_set_mode’:
../hw/xfree86/drivers/modesetting/drmmode_display.c:759:15: error: unused variable ‘screen’ [-Werror=unused-variable]
  759 |     ScreenPtr screen = crtc->scrn->pScreen;
      |               ^~~~~~

Fixes: c66c548eab "modesetting: Call glamor_finish from
                     drmmode_crtc_set_mode"
Reviewed-by: Adam Jackson <ajax@redhat.com>
2020-02-11 15:58:26 +01:00
Michel Dänzer 0cb9fa7949 modesetting: Fix build with glamor disabled
Fixes: cb1b1e1847 "modesetting: Indirect the glamor API through
                     LoaderSymbol"
Reviewed-by: Adam Jackson <ajax@redhat.com>
2020-02-10 18:41:44 +01:00
Dave Airlie 1cfdd1a965 modesetting: remove unnecessary error message, fix zaphod leases
I introduced this error with the MST hotplug code, but it can trigger
on zaphod setups, and is perfectly fine. There is no support for
MST/hotplug on zaphod setups currently, so we can just skip over
the dynamic connector handling here. However we shouldn't skip
over the lease handling so move it into the codepath.

Fixes: 9257b1252d ("modesetting: add dynamic connector hotplug support (MST) (v3)")
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2020-02-06 09:45:07 +10:00
Michel Dänzer a24a786fc8 modesetting: Explicitly #include "mi.h"
For the miClearDrawable prototype. Apparently it doesn't get pulled in
for some build configurations, breaking the build.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2020-01-14 15:15:28 -08:00
Aaron Plattner 4226c6d032 modesetting: Check whether RandR was initialized before calling rrGetScrPriv
Calling rrGetScrPriv when RandR isn't initialized causes an assertion
failure that aborts the server:

 Xorg: ../include/privates.h:121: dixGetPrivateAddr: Assertion `key->initialized' failed.

 Thread 1 "Xorg" received signal SIGABRT, Aborted.
 0x00007ffff78a8f25 in raise () from /usr/lib/libc.so.6
 (gdb) bt
 #0  0x00007ffff78a8f25 in raise () from /usr/lib/libc.so.6
 #1  0x00007ffff7892897 in abort () from /usr/lib/libc.so.6
 #2  0x00007ffff7892767 in __assert_fail_base.cold () from /usr/lib/libc.so.6
 #3  0x00007ffff78a1526 in __assert_fail () from /usr/lib/libc.so.6
 #4  0x00007ffff7fb57c1 in dixGetPrivateAddr (privates=0x555555ab1b60, key=0x555555855720 <rrPrivKeyRec>) at ../include/privates.h:121
 #5  0x00007ffff7fb5822 in dixGetPrivate (privates=0x555555ab1b60, key=0x555555855720 <rrPrivKeyRec>) at ../include/privates.h:136
 #6  0x00007ffff7fb586a in dixLookupPrivate (privates=0x555555ab1b60, key=0x555555855720 <rrPrivKeyRec>) at ../include/privates.h:166
 #7  0x00007ffff7fb8445 in CreateScreenResources (pScreen=0x555555ab1790) at ../hw/xfree86/drivers/modesetting/driver.c:1335
 #8  0x000055555576c5e4 in xf86CrtcCreateScreenResources (screen=0x555555ab1790) at ../hw/xfree86/modes/xf86Crtc.c:744
 #9  0x00005555555d8bb6 in dix_main (argc=4, argv=0x7fffffffead8, envp=0x7fffffffeb00) at ../dix/main.c:214
 #10 0x00005555557a4f0b in main (argc=4, argv=0x7fffffffead8, envp=0x7fffffffeb00) at ../dix/stubmain.c:34

This can happen, for example, if the server is configured with Xinerama
and there is more than one X screen:

 Section "ServerLayout"
   Identifier "crash"
   Screen 0 "modesetting"
   Screen 1 "dummy" RightOf "modesetting"
   Option "Xinerama"
 EndSection

 Section "Device"
   Identifier "modesetting"
   Driver "modesetting"
 EndSection

 Section "Screen"
   Identifier "modesetting"
   Device "modesetting"
 EndSection

 Section "Device"
   Identifier "dummy"
   Driver "dummy"
 EndSection

 Section "Screen"
   Identifier "dummy"
   Device "dummy"
 EndSection

The problem does not reproduce if there is only one X screen because of
this code in xf86RandR12Init:

 #ifdef PANORAMIX
     /* XXX disable RandR when using Xinerama */
     if (!noPanoramiXExtension) {
         if (xf86NumScreens == 1)
             noPanoramiXExtension = TRUE;
         else
             return TRUE;
     }
 #endif

Fix the problem by checking dixPrivateKeyRegistered(rrPrivKey) before
calling rrGetScrPriv. This is similar to what the xf86-video-amdgpu
driver does:
fd66f5c0be/src/amdgpu_kms.c (L388)

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-01-03 08:39:21 -08:00
Alex Goins 456dff1bf8 modesetting: Fix msSharePixmapBacking Segfault Regression
Commit cb1b1e184 modified msSharePixmapBacking() to derive modesettingPtr from
the 'screen' argument. Unfortunately, the name of the argument is misleading --
the screen is the slave screen. If the master is modesetting,
and the slave is not modesetting, it will segfault.

To fix the problem, this change derives modesettingPtr from
ppix->drawable.pScreen. This method is already used when calling
ms->glamor.shareable_fd_from_pixmap() later in the function.

To avoid future issues, this change also renames the 'screen' argument to
'slave'.

Signed-off-by: Alex Goins <agoins@nvidia.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-12-23 08:56:22 -08:00
Kenneth Graunke 8d4be7f6c4 modesetting: Use EGL_MESA_query_driver to select DRI driver if possible
New now ask Glamor to use EGL_MESA_query_driver to obtain the DRI driver
name; if successful, we use that as the DRI driver name.  Following the
existing dri2.c logic, we also use the same name for the VDPAU driver,
except for i965 (and now iris), where we switch to the "va_gl" fallback.

This allows us to bypass the PCI ID lists in xserver and centralize the
driver selection mechanism inside Mesa.  The hope is that we no longer
have to update these lists for any future hardware.
2019-11-26 01:36:10 -08:00
Michel Dänzer 60003023fa modesetting: Use glamor_clear_pixmap in drmmode_clear_pixmap
Should be slightly more efficient.

Reviewed-by: Adam Jackson <ajax@redhat.com>
2019-11-25 18:47:37 +01:00
Michel Dänzer 9ba13bac9d modesetting: Clear new screen pixmap storage on RandR resize
Fixes random garbage being visible intermittently.

Reviewed-by: Adam Jackson <ajax@redhat.com>
2019-11-25 18:46:56 +01:00
Michel Dänzer c66c548eab modesetting: Call glamor_finish from drmmode_crtc_set_mode
This makes sure any pending drawing to a new scanout buffer will be
visible from the start.

This makes the finish call in drmmode_copy_fb superfluous, so remove it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
2019-11-25 18:46:04 +01:00
Michel Dänzer 06ef320e9b modesetting: Add glamor_finish() convenience macro
This will simplify backporting the following fix to the 1.20 branch.

Reviewed-by: Adam Jackson <ajax@redhat.com>
2019-11-25 18:44:57 +01:00
Adam Jackson cb1b1e1847 Revert "Revert "modesetting: Indirect the glamor API through LoaderSymbol""
Now that we've fixed LoaderSymbolFromModule this should work properly.

This reverts commit 5c7c6d5cff.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-11-21 14:20:57 -05:00
Michel Dänzer 5c7c6d5cff Revert "modesetting: Indirect the glamor API through LoaderSymbol"
This reverts commit dd63f717fe.

Caused a crash at least on some systems.

Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/934
2019-11-15 11:32:38 +01:00
Adam Jackson dd63f717fe modesetting: Indirect the glamor API through LoaderSymbol
Prerequisite for building all of xserver with -z now.

Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692
2019-11-13 19:49:18 +00:00
Adam Jackson 45f35a0c66 modesetting: Indirect the shadow API through LoaderSymbol
Prerequisite for building all of xserver with -z now.

Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692
2019-11-13 19:49:18 +00:00
Alex Goins 562c7888be modesetting: Implement ms_covering_randr_crtc() for ms_present_get_crtc()
ms_present_get_crtc() returns an RRCrtcPtr, but derives it from a xf86CrtcPtr
found via ms_dri2_crtc_covering_drawable()=>ms_covering_crtc(). As a result, it
depends on all associated DIX ScreenRecs having an xf86CrtcConfigPtr DDX
private.

Some DIX ScreenRecs don't have an xf86CrtcConfigPtr DDX private, but do have an
rrScrPrivPtr DDX private. Given that we can derive all of the information we
need from RandR, we can support these screens by avoiding the use of xf86Crtc.
This change implements an RandR-based path for ms_present_get_crtc(), allowing
drawables to successfully fall back to syncing to the primary output, even if
the slave doesn't have an xf86CrtcConfigPtr DDX private.

Without this change, if a slave doesn't have an xf86CrtcConfigPtr DDX private,
drawables will fall back to 1 FPS if they overlap an output on that slave.

Signed-off-by: Alex Goins <agoins@nvidia.com>
2019-11-11 14:35:57 -08:00
Alex Goins 797e7a0ceb modesetting: Fix ms_covering_crtc() segfault with non-xf86Crtc slave
DIX ScreenRecs don't necessarily have an xf86CrtcConfigPtr DDX private.
ms_covering_crtc() assumes that they do, which can result in a segfault.

Update ms_covering_crtc() to check the XF86_CRTC_CONFIG_PTR() returned pointer
before dereferencing it. This will still mean that ms_covering_crtc() can't fall
back to the primary output when a drawable overlaps a slave output (going to the
1 FPS default instead), but it won't segfault.

Signed-off-by: Alex Goins <agoins@nvidia.com>
2019-11-11 14:35:57 -08:00
Alex Goins 3ef9029ace modesetting: Fix ms_covering_crtc() segfault with non-modesetting slave primary
ms_covering_crtc() uses RRFirstOutput() to determine a primary output to fall
back to if a drawable is overlapping a slave output.

If the primary output is a slave output, RRFirstOutput() will return a slave
output even if passed a master ScreenPtr. ms_covering_crtc() dereferences the
output's devPrivate, which is invalid for non-modesetting outputs, and can
crash.

Changing RRFirstOutput() could have unintended side effects for other callers,
so this change replaces the call to RRFirstOutput() with ms_first_output().
ms_first_output() ignores the primary output if it doesn't match the given
ScreenPtr, choosing the first connected output instead.

Signed-off-by: Alex Goins <agoins@nvidia.com>
2019-11-11 14:35:57 -08:00
Ville Syrjälä 0e4bd71d02 modesetting: Fix possible_crtcs
Populate outout possible_crtcs as the union of possible_crtcs from
the encoders rather than the intersection. Otherwise we're easily left
with possible_crtcs==0 when all the possible encoders have
non-overlapping possible_crtcs.

No idea what the magic 0x7f is about, but keep it around in case
it matters.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-10-29 22:14:06 +00:00
Keith Packard 0cf15714e1 modesetting: typo in drmmode_display.c -- ',' instead of ';' at end of line
This seems like a simple typo to me; thanks to C it isn't caught by
the compiler.

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-10-23 14:16:30 -07:00
Michel Dänzer 535f14656a Revert https://gitlab.freedesktop.org/xorg/xserver/merge_requests/235
Caused assertion failures / crashes with Xorg.

Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/916
2019-10-14 12:48:24 +02:00
Emil Velikov f3ab3d0c61 glamor_egl: disable modifiers via glamor_init()
Currently we parse through xf86Info.debug to check if we the modifiers
should be disabled. Handle that within DDX and pass GLAMOR_NO_MODIFIERS
into the glamor_init() flags.

This allows individual DDX control over the setting - say when modifiers
are woking OK with one implementation and not the other.

Most importantly, this removes the final xf86 piece from the codebase.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2019-10-11 12:03:42 +00:00
Emil Velikov 4018811838 glamor_egl: don't use ScrnInfoRec::privates
Move from the xf86 specific ScrnInfoRec::privates, to the dix private
handling. Since there's no FreeScreen function in ScreenPtr, fold the
former within the existing CloseScreen.

Users, such as modesetting are updated, and out of tree drivers will
need equivalent, yet trivial, patch.

Note: we need to ensure that the screen private is unset and the screen
callbacks are restored in our CloseScreen function.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2019-10-11 12:03:42 +00:00
Sven Joachim de0d39f825 modesetting: Fix broken manpage in autoconf build
The autoconf build for the modesetting driver still relied on
xorg-macros.m4 for string replacements and did not include the
top-level manpages.am.  As a result, no substitutions took place after
commit 2e497bf887.

This should be a candidate for the 1.20 branch.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-10-04 10:29:23 +02:00
Sven Joachim 47387916fb Fix various spelling errors 2019-10-01 17:05:28 +00:00
Adam Jackson cbdde938cb modesetting: Reduce "glamor initialization failed" message to X_INFO
This might be an error or not, for example refusing to work on llvmpipe
is normal and expected. glamor_egl_init() will print X_ERROR messages if
appropriate, so we don't need to here.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-09-30 11:24:06 -04:00
Maarten Lankhorst f0d78b47ac modesetting: Disable atomic support by default
The atomic driver has issues with modesetting when stealing
connectors from a different crtc, a black screen when doing rotation
on a different crtc, and in general is just a mapping of the legacy
helpers to atomic. This is already done in the kernel, so just
fallback to legacy by default until this is fixed.

Please backport to 1.20, as we don't want to enable it for everyone
there. It breaks for existing users.

The fixes to make the xserver more atomic have been pending on the
mailing list for ages.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110375
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110030
References: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/36/commits
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2019-09-03 18:52:02 +00:00
Ville Syrjälä 0c5179c280 modesetting: Update props for dynamically added outputs
Dynamically added outputs should have their properties
properly updated as well. Otherwise we're left with an output
with many of its propeties not exposed.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
2019-08-22 12:41:39 +00:00
Hans de Goede c69b37e8da modesetting: Only log 1 error for consecutive flip failures
Only log 1 error for consecutive flip failures, instead of filling the
log and the disk with errors for each attempted flip.

Despite our best efforts we may end up with a BO which gets refused
when we try to import it as a framebuffer, see e.g. :
https://bugs.freedesktop.org/show_bug.cgi?id=111306
This should not happen, but as the above bugs shows sometimes it does
and chances are it will happen again.

Note ideally we should check if the import is possible at
ms_present_check_flip time, like the amdgpu code is doing since:
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/35
but that requires a chunk of refactoring work on the modesetting driver,
so for now this will have to do.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-08-09 10:51:12 +02:00
Hans de Goede 3dc838f77d modesetting: Improve page-flip error reporting
Before this commit ms_do_pageflip logged a single error for both the
drmmode_bo_import failure path as well as for the queue_flip_on_crtc
path. This commit splits this into 2 separate error logs so that it is
clear what the cause of the flip-failure is.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-08-09 10:51:06 +02:00
Hans de Goede 12821852f0 modesetting: Avoid duplicate error messages on present-flip errors
Currently on present-flip failures we log 2 messages for each failure,
1 from ms_do_pageflip and then another one from ms_present_flip which
is the caller of ms_do_pageflip. This commit adds a log_prefix argument
to ms_do_pageflip so that its log messages can show if it is a DRI2 or
a Present flip which fails and removes the redundant error message from
ms_present_flip.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-08-09 10:50:55 +02:00
Hans de Goede 0aaac8d783 modesetting: Disable pageflipping when using a swcursor
The miPointerSpriteFunc swcursor code expects there to only be a single
framebuffer and when the cursor moves it will undo the damage of the
previous draw, potentially overwriting what ever is there in a new
framebuffer installed after a flip.

This leads to all kind of artifacts, so we need to disable pageflipping
when a swcursor is used.

The code for this has shamelessly been copied from the xf86-video-amdgpu
code.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/issues/828

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-08-06 17:22:02 +02:00
Hans de Goede 0331153b22 modesetting: Fix compiler warning
Fix the following compiler warning:

drmmode_display.c: In function ‘drmmode_create_bo’:
drmmode_display.c:1019:9: warning: ISO C90 forbids mixed declarations and code [
 1019 |         uint32_t num_modifiers;
      |         ^~~~~~~~

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-08-06 17:03:55 +02:00
Hans de Goede 13f359fa83 modesetting: Remove obsolete, unused msPixmapPrivate declaration and macro
When the pixmapPrivateKeyRec was moved from a global to being embedded
inside the drmmode_rec these 2 where missed, clean them up.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-08-06 17:03:41 +02:00
Adam Jackson c1703cdf3b xfree86: Link fb statically
There's no real benefit to leaving this loadable, virtually every driver
is going to load it.

Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
2019-07-23 14:24:00 -04:00
Ilia Mirkin 48b1af2718 modesetting: fix conn_id termination and potential overrun by 1 byte
Noticed when porting this logic to xf86-video-nouveau, and valgrind
complained about conditional jump based on uninitialized data.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2018-12-11 13:34:56 -05:00
Lyude Paul 7a44e8d400 modesetting: Actually disable CRTCs in legacy mode
Believe it or not, somehow we've never done this in legacy mode! We
currently simply change the DPMS property on the CRTC's output's
respective DRM connector, but this means that we're just setting the
CRTC as inactive-not disabled. From the perspective of the kernel, this
means that any shared resources used by the CRTC are still in use.

This can cause problems for drivers that are not yet fully atomic,
despite using the atomic helpers internally. For instance: if CRTC-1 and
CRTC-2 are still enabled and use shared resources within the kernel (an
MST topology, for example), and then userspace tries to go enable CRTC-3
on the same topology this might suddenly fail if CRTC-3 needs the shared
resources CRTC-1 and CRTC-2 are using. While I don't know of any
situations in the mainline kernel that actually trigger this, future
plans for reworking the atomic check of MST drivers are absolutely
going to make this into a real issue (they already are in my WIP
branches for the kernel).

So: actually do the right thing here and disable CRTCs when they're not
going to be used anymore, even in legacy mode.

Signed-off-by: Lyude Paul <lyude@redhat.com>
2018-11-29 16:21:26 +00:00
Adam Jackson c901adc327 modesetting: Hush an unimportant log message
Verbosity level 0 is "always print", just make it a normal message.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-10-31 11:43:33 -04:00
Adam Jackson 43a0f9a5db modesetting: Don't free(dst) in drmmode_prop_info_copy
The destination is always either on the stack or in the middle of some
struct.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-10-01 11:42:37 -04:00
Dave Airlie b6c29a881e modesetting: get pEnt after error checks
This saves us having to make sure we clean it up.

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2018-09-12 12:26:48 +10:00
Adam Jackson c4f3e42fe3 modesetting: Document Option "DoubleShadow" in the man page
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-10 14:47:06 -04:00
Adam Jackson 0dc2c419e1 modesetting: Lie less in the man page
We don't support 8bpp, and we do have acceleration.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-10 14:47:06 -04:00
Jim Qu f79e536851 modesetting: code refactor for PRIME sync
The X will be crashed on the system with other DDX driver,
such as amdgpu.

show the log like:

randr: falling back to unsynchronized pixmap sharing
(EE)
(EE) Backtrace:
(EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x4e)
(EE) 1: /usr/lib/xorg/Xorg (0x55cb0151a000+0x1b5ce9)
(EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1587a1d000+0x11390)
(EE)
(EE) Segmentation fault at address 0x0
(EE)

The issue is that modesetting as the master, and amdgpu as the slave.
Thus, when the master attempts to access pSlavePixPriv in ms_dirty_update(),
problems result due to the fact that it's accessing AMD's 'ppriv' using the
modesetting structure definition.

Apart from fixing crash issue, the patch fix other issue in master interface
in which driver should refer to master pixmap.

Signed-off-by: Jim Qu <Jim.Qu@amd.com>
Reviewed-by: Alex Goins <agoins@nvidia.com>
2018-08-29 10:21:51 +02:00
Keith Packard 1ef7aed3e2 During reset/shutdown, clean up leases in DIX instead of each driver
Instead of having every video driver loop over any pending leases to
free them during CloseScreen, do this up in the DIX layer by
terminating leases when a leased CRTC or Output is destroyed and
(just to make sure), also terminating leases in RRCloseScreen. The
latter should "never" get invoked as any lease should be associated
with a resource which was destroyed.

This is required as by the time the driver's CloseScreen function is
invoked, we've already freed all of the DIX randr structures and no
longer have any way to reference the leases

Signed-off-by: Keith Packard <keithp@keithp.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=106960
Cc: Thomas Hellstrom <thellstrom@vmware.com>
2018-08-02 10:15:26 -04:00
Takashi Iwai d625e16918 modesetting: Fix cirrus 24bpp breakage
The recent rewrite of modesetting driver broke the 24bpp support.
As typically found on cirrus KMS, it leads to a blank screen, spewing
the error like:
  failed to add fb -22
  (EE) modeset(0): failed to set mode: Invalid argument

The culript is that the wrong bpp value of the front buffer is passed
to drmModeAddFB().  Fix it by replacing with the back buffer bpp,
drmmode->kbpp.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Dirsch <sndirsch@suse.de>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-07-25 14:30:01 -04:00