Timo Aaltonen pushed to branch upstream-unstable at X Strike Force / driver / xserver-xorg-video-amdgpu
Commits:
-
69365526
by Dor Askayo at 2021-08-27T14:36:03+03:00
-
65c12736
by Mario Kleiner at 2022-01-25T03:59:15+01:00
-
8bc148f0
by Alan Coopersmith at 2022-02-14T19:23:49+00:00
-
c21bcdd1
by Jesse Zhang at 2022-02-16T16:21:21+01:00
-
402bfdea
by Alan Coopersmith at 2022-02-16T15:36:58+00:00
-
533bd30c
by Shashank Sharma at 2022-02-22T16:26:37+01:00
9 changed files:
- configure.ac
- man/amdgpu.man
- src/amdgpu_drv.h
- src/amdgpu_glamor.c
- src/amdgpu_kms.c
- src/amdgpu_pixmap.c
- src/amdgpu_present.c
- src/drmmode_display.c
- src/simple_list.h
Changes:
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 |
# Initialize Autoconf
|
24 | 24 |
AC_PREREQ([2.60])
|
25 | 25 |
AC_INIT([xf86-video-amdgpu],
|
26 |
- [21.0.0],
|
|
26 |
+ [22.0.0],
|
|
27 | 27 |
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu],
|
28 | 28 |
[xf86-video-amdgpu])
|
29 | 29 |
|
... | ... | @@ -34,7 +34,7 @@ AC_CONFIG_MACRO_DIR([m4]) |
34 | 34 |
AC_CONFIG_AUX_DIR(.)
|
35 | 35 |
|
36 | 36 |
# Initialize Automake
|
37 |
-AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
|
37 |
+AM_INIT_AUTOMAKE([foreign dist-xz])
|
|
38 | 38 |
AC_SYS_LARGEFILE
|
39 | 39 |
|
40 | 40 |
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
|
... | ... | @@ -90,6 +90,21 @@ when an suitable application is flipping via the Present extension. |
90 | 90 |
The default is
|
91 | 91 |
.B off.
|
92 | 92 |
.TP
|
93 |
+.BI "Option \*qAsyncFlipSecondaries\*q \*q" boolean \*q
|
|
94 |
+Use async flips for secondary video outputs on multi-display setups. If a screen
|
|
95 |
+has multiple displays attached and DRI3 page flipping is used, then only one of
|
|
96 |
+the displays will have its page flip synchronized to vblank for tear-free
|
|
97 |
+presentation. This is the display that is used for presentation timing and
|
|
98 |
+timestamping, usually the one covering the biggest pixel area of the screen.
|
|
99 |
+All other displays ("Secondaries") will not synchronize their flips. This may
|
|
100 |
+cause some tearing on these displays, but it prevents a permanent or periodic
|
|
101 |
+slowdown or irritating judder of animations if not all video outputs are running
|
|
102 |
+synchronized with each other and with the same refresh rate. There is no perfect
|
|
103 |
+solution apart from perfectly synchronized outputs, but this option may give
|
|
104 |
+preferrable results if the displays in a multi-display setup mirror or clone
|
|
105 |
+each other. The default is
|
|
106 |
+.B off.
|
|
107 |
+.TP
|
|
93 | 108 |
.BI "Option \*qAccelMethod\*q \*q" string \*q
|
94 | 109 |
Setting this option to
|
95 | 110 |
.B none
|
... | ... | @@ -165,6 +165,7 @@ typedef enum { |
165 | 165 |
OPTION_TEAR_FREE,
|
166 | 166 |
OPTION_DELETE_DP12,
|
167 | 167 |
OPTION_VARIABLE_REFRESH,
|
168 |
+ OPTION_ASYNC_FLIP_SECONDARIES,
|
|
168 | 169 |
} AMDGPUOpts;
|
169 | 170 |
|
170 | 171 |
static inline ScreenPtr
|
... | ... | @@ -306,6 +307,8 @@ typedef struct { |
306 | 307 |
/* kms pageflipping */
|
307 | 308 |
WindowPtr flip_window;
|
308 | 309 |
Bool allowPageFlip;
|
310 |
+ Bool can_async_flip;
|
|
311 |
+ Bool async_flip_secondaries;
|
|
309 | 312 |
|
310 | 313 |
/* cursor size */
|
311 | 314 |
int cursor_w;
|
... | ... | @@ -209,6 +209,15 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, |
209 | 209 |
if (!format)
|
210 | 210 |
return NULL;
|
211 | 211 |
|
212 |
+ if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP &&
|
|
213 |
+ usage != CREATE_PIXMAP_USAGE_SHARED &&
|
|
214 |
+ !info->shadow_primary &&
|
|
215 |
+ w >= scrn->virtualX &&
|
|
216 |
+ w <= scrn->displayWidth &&
|
|
217 |
+ h == scrn->virtualY &&
|
|
218 |
+ format->bitsPerPixel == scrn->bitsPerPixel)
|
|
219 |
+ usage |= AMDGPU_CREATE_PIXMAP_SCANOUT;
|
|
220 |
+ |
|
212 | 221 |
if (!(usage & AMDGPU_CREATE_PIXMAP_SCANOUT) &&
|
213 | 222 |
!AMDGPU_CREATE_PIXMAP_SHARED(usage)) {
|
214 | 223 |
if (info->shadow_primary) {
|
... | ... | @@ -218,15 +227,9 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, |
218 | 227 |
usage |= AMDGPU_CREATE_PIXMAP_LINEAR |
|
219 | 228 |
AMDGPU_CREATE_PIXMAP_GTT;
|
220 | 229 |
} else if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) {
|
221 |
- if (w < scrn->virtualX || w > scrn->displayWidth ||
|
|
222 |
- h != scrn->virtualY ||
|
|
223 |
- format->bitsPerPixel != scrn->bitsPerPixel) {
|
|
224 |
- pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
|
|
225 |
- if (pixmap)
|
|
226 |
- return pixmap;
|
|
227 |
- } else {
|
|
228 |
- usage |= AMDGPU_CREATE_PIXMAP_SCANOUT;
|
|
229 |
- }
|
|
230 |
+ pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
|
|
231 |
+ if (pixmap)
|
|
232 |
+ return pixmap;
|
|
230 | 233 |
}
|
231 | 234 |
}
|
232 | 235 |
|
... | ... | @@ -87,6 +87,7 @@ const OptionInfoRec AMDGPUOptions_KMS[] = { |
87 | 87 |
{OPTION_TEAR_FREE, "TearFree", OPTV_BOOLEAN, {0}, FALSE},
|
88 | 88 |
{OPTION_DELETE_DP12, "DeleteUnusedDP12Displays", OPTV_BOOLEAN, {0}, FALSE},
|
89 | 89 |
{OPTION_VARIABLE_REFRESH, "VariableRefresh", OPTV_BOOLEAN, {0}, FALSE },
|
90 |
+ {OPTION_ASYNC_FLIP_SECONDARIES, "AsyncFlipSecondaries", OPTV_BOOLEAN, {0}, FALSE},
|
|
90 | 91 |
{-1, NULL, OPTV_NONE, {0}, FALSE}
|
91 | 92 |
};
|
92 | 93 |
|
... | ... | @@ -1637,6 +1638,13 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags) |
1637 | 1638 |
|
1638 | 1639 |
xf86DrvMsg(pScrn->scrnIndex, from, "VariableRefresh: %sabled\n",
|
1639 | 1640 |
info->vrr_support ? "en" : "dis");
|
1641 |
+ |
|
1642 |
+ info->async_flip_secondaries = FALSE;
|
|
1643 |
+ from = xf86GetOptValBool(info->Options, OPTION_ASYNC_FLIP_SECONDARIES,
|
|
1644 |
+ &info->async_flip_secondaries) ? X_CONFIG : X_DEFAULT;
|
|
1645 |
+ |
|
1646 |
+ xf86DrvMsg(pScrn->scrnIndex, from, "AsyncFlipSecondaries: %sabled\n",
|
|
1647 |
+ info->async_flip_secondaries ? "en" : "dis");
|
|
1640 | 1648 |
}
|
1641 | 1649 |
}
|
1642 | 1650 |
|
... | ... | @@ -38,7 +38,7 @@ amdgpu_pixmap_create(ScreenPtr screen, int w, int h, int depth, unsigned usage) |
38 | 38 |
PixmapPtr pixmap;
|
39 | 39 |
AMDGPUInfoPtr info;
|
40 | 40 |
|
41 |
- /* only DRI2 pixmap is suppported */
|
|
41 |
+ /* only DRI2 pixmap is supported */
|
|
42 | 42 |
if (!(usage & AMDGPU_CREATE_PIXMAP_DRI2))
|
43 | 43 |
return fbCreatePixmap(screen, w, h, depth, usage);
|
44 | 44 |
|
... | ... | @@ -496,8 +496,13 @@ amdgpu_present_has_async_flip(ScreenPtr screen) |
496 | 496 |
Bool
|
497 | 497 |
amdgpu_present_screen_init(ScreenPtr screen)
|
498 | 498 |
{
|
499 |
- if (amdgpu_present_has_async_flip(screen))
|
|
499 |
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
|
500 |
+ AMDGPUInfoPtr info = AMDGPUPTR(scrn);
|
|
501 |
+ |
|
502 |
+ if (amdgpu_present_has_async_flip(screen)) {
|
|
500 | 503 |
amdgpu_present_screen_info.capabilities |= PresentCapabilityAsync;
|
504 |
+ info->can_async_flip = TRUE;
|
|
505 |
+ }
|
|
501 | 506 |
|
502 | 507 |
if (!present_screen_init(screen, &amdgpu_present_screen_info)) {
|
503 | 508 |
xf86DrvMsg(xf86ScreenToScrn(screen)->scrnIndex, X_WARNING,
|
... | ... | @@ -3970,17 +3970,27 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, |
3970 | 3970 |
uint32_t target_msc)
|
3971 | 3971 |
{
|
3972 | 3972 |
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
|
3973 |
+ AMDGPUInfoPtr info = AMDGPUPTR(scrn);
|
|
3973 | 3974 |
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
3974 | 3975 |
xf86CrtcPtr crtc = NULL;
|
3975 | 3976 |
drmmode_crtc_private_ptr drmmode_crtc = config->crtc[0]->driver_private;
|
3976 | 3977 |
int crtc_id;
|
3977 | 3978 |
uint32_t flip_flags = flip_sync == FLIP_ASYNC ? DRM_MODE_PAGE_FLIP_ASYNC : 0;
|
3979 |
+ uint32_t sec_flip_flags = flip_flags;
|
|
3978 | 3980 |
drmmode_flipdata_ptr flipdata;
|
3979 | 3981 |
Bool handle_deferred = FALSE;
|
3980 | 3982 |
uintptr_t drm_queue_seq = 0;
|
3981 | 3983 |
struct drmmode_fb *fb;
|
3982 | 3984 |
int i = 0;
|
3983 | 3985 |
|
3986 |
+ /*
|
|
3987 |
+ * Flip secondary non-ref_crtc crtc's async if possible and requested
|
|
3988 |
+ * by xorg.conf option "AsyncFlipSecondaries". Otherwise follow the lead
|
|
3989 |
+ * of flip_sync.
|
|
3990 |
+ */
|
|
3991 |
+ if (info->can_async_flip && info->async_flip_secondaries)
|
|
3992 |
+ sec_flip_flags |= DRM_MODE_PAGE_FLIP_ASYNC;
|
|
3993 |
+ |
|
3984 | 3994 |
flipdata = calloc(1, sizeof(*flipdata) + drmmode_crtc->drmmode->count_crtcs *
|
3985 | 3995 |
sizeof(flipdata->fb[0]));
|
3986 | 3996 |
if (!flipdata) {
|
... | ... | @@ -4081,7 +4091,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, |
4081 | 4091 |
if (drmmode_page_flip_target_relative(pAMDGPUEnt,
|
4082 | 4092 |
drmmode_crtc,
|
4083 | 4093 |
flipdata->fb[crtc_id]->handle,
|
4084 |
- flip_flags,
|
|
4094 |
+ sec_flip_flags,
|
|
4085 | 4095 |
drm_queue_seq, 0) != 0)
|
4086 | 4096 |
goto flip_error;
|
4087 | 4097 |
}
|
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 |
* \file simple_list.h
|
3 | 3 |
* Simple macros for type-safe, intrusive lists.
|
4 | 4 |
*
|
5 |
- * Intended to work with a list sentinal which is created as an empty
|
|
5 |
+ * Intended to work with a list sentinel which is created as an empty
|
|
6 | 6 |
* list. Insert & delete are O(1).
|
7 | 7 |
*
|
8 | 8 |
* \author
|
... | ... | @@ -107,12 +107,12 @@ do { \ |
107 | 107 |
/**
|
108 | 108 |
* Make a empty list empty.
|
109 | 109 |
*
|
110 |
- * \param sentinal list (sentinal element).
|
|
110 |
+ * \param sentinel list (sentinel element).
|
|
111 | 111 |
*/
|
112 |
-#define make_empty_list(sentinal) \
|
|
112 |
+#define make_empty_list(sentinel) \
|
|
113 | 113 |
do { \
|
114 |
- (sentinal)->next = sentinal; \
|
|
115 |
- (sentinal)->prev = sentinal; \
|
|
114 |
+ (sentinel)->next = sentinel; \
|
|
115 |
+ (sentinel)->prev = sentinel; \
|
|
116 | 116 |
} while (0)
|
117 | 117 |
|
118 | 118 |
/**
|