Timo Aaltonen pushed to branch upstream-unstable at X Strike Force / driver / xserver-xorg-video-amdgpu
Commits:
-
9c23076b
by Michel Dänzer at 2019-02-07T16:35:13Z
-
5f91be77
by Michel Dänzer at 2019-02-11T17:32:07Z
-
2a3d00dc
by Michel Dänzer at 2019-02-12T17:58:23Z
-
09a45ff8
by Michel Dänzer at 2019-02-20T15:37:13Z
-
ef8fbe33
by Michel Dänzer at 2019-02-20T16:57:16Z
-
d9be5d71
by Michel Dänzer at 2019-02-22T16:44:30Z
-
bd090f38
by Michel Dänzer at 2019-02-22T16:45:04Z
-
a636f42b
by Michel Dänzer at 2019-02-27T17:43:27Z
-
09be74a3
by Michel Dänzer at 2019-03-01T09:53:38Z
-
28cd209e
by Michel Dänzer at 2019-03-01T10:09:21Z
-
72653455
by Michel Dänzer at 2019-03-04T16:31:45Z
-
2798244b
by Michel Dänzer at 2019-03-04T16:39:12Z
-
a2b32e72
by Michel Dänzer at 2019-03-04T16:39:27Z
-
9534bf3b
by Michel Dänzer at 2019-03-06T11:05:49Z
9 changed files:
- .gitlab-ci.yml
- configure.ac
- src/amdgpu_dri2.c
- src/amdgpu_dri2.h
- src/amdgpu_drv.h
- src/amdgpu_kms.c
- src/amdgpu_present.c
- src/drmmode_display.c
- src/drmmode_display.h
Changes:
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 |
variables:
|
| 16 | 16 |
IMAGE_TAG: "debian-testing-20181213"
|
| 17 | 17 |
IMAGE_LOCAL: "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
|
| 18 |
- IMAGE_MAIN: "registry.freedesktop.org/xorg/driver/$CI_PROJECT_NAME:$IMAGE_TAG"
|
|
| 18 |
+ IMAGE_MAIN: "registry.freedesktop.org/xorg/driver/xf86-video-amdgpu:$IMAGE_TAG"
|
|
| 19 | 19 |
|
| 20 | 20 |
stages:
|
| 21 | 21 |
- docker-image
|
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 |
# Initialize Autoconf
|
| 24 | 24 |
AC_PREREQ([2.60])
|
| 25 | 25 |
AC_INIT([xf86-video-amdgpu],
|
| 26 |
- [18.1.99],
|
|
| 26 |
+ [19.0.0],
|
|
| 27 | 27 |
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu],
|
| 28 | 28 |
[xf86-video-amdgpu])
|
| 29 | 29 |
|
| ... | ... | @@ -884,12 +884,18 @@ CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) |
| 884 | 884 |
if (ret) {
|
| 885 | 885 |
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
| 886 | 886 |
"%s cannot get current time\n", __func__);
|
| 887 |
- if (event_info->drm_queue_seq)
|
|
| 887 |
+ |
|
| 888 |
+ if (event_info->drm_queue_seq) {
|
|
| 888 | 889 |
drmmode_crtc->drmmode->event_context.
|
| 889 | 890 |
vblank_handler(pAMDGPUEnt->fd, 0, 0, 0,
|
| 890 | 891 |
(void*)event_info->drm_queue_seq);
|
| 891 |
- else
|
|
| 892 |
+ drmmode_crtc->wait_flip_nesting_level++;
|
|
| 893 |
+ amdgpu_drm_queue_handle_deferred(crtc);
|
|
| 894 |
+ |
|
| 895 |
+ } else {
|
|
| 892 | 896 |
amdgpu_dri2_frame_event_handler(crtc, 0, 0, data);
|
| 897 |
+ }
|
|
| 898 |
+ |
|
| 893 | 899 |
return 0;
|
| 894 | 900 |
}
|
| 895 | 901 |
/*
|
| ... | ... | @@ -900,13 +906,18 @@ CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) |
| 900 | 906 |
delta_seq = delta_t * drmmode_crtc->dpms_last_fps;
|
| 901 | 907 |
delta_seq /= 1000000;
|
| 902 | 908 |
frame = (CARD64) drmmode_crtc->dpms_last_seq + delta_seq;
|
| 903 |
- if (event_info->drm_queue_seq)
|
|
| 909 |
+ |
|
| 910 |
+ if (event_info->drm_queue_seq) {
|
|
| 904 | 911 |
drmmode_crtc->drmmode->event_context.
|
| 905 | 912 |
vblank_handler(pAMDGPUEnt->fd, frame, drm_now / 1000000,
|
| 906 | 913 |
drm_now % 1000000,
|
| 907 | 914 |
(void*)event_info->drm_queue_seq);
|
| 908 |
- else
|
|
| 915 |
+ drmmode_crtc->wait_flip_nesting_level++;
|
|
| 916 |
+ amdgpu_drm_queue_handle_deferred(crtc);
|
|
| 917 |
+ } else {
|
|
| 909 | 918 |
amdgpu_dri2_frame_event_handler(crtc, frame, drm_now, data);
|
| 919 |
+ }
|
|
| 920 |
+ |
|
| 910 | 921 |
return 0;
|
| 911 | 922 |
}
|
| 912 | 923 |
|
| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 |
#include <xorg-server.h>
|
| 31 | 31 |
|
| 32 | 32 |
struct amdgpu_dri2 {
|
| 33 |
+ drmVersionPtr pKernelDRMVersion;
|
|
| 33 | 34 |
Bool available;
|
| 34 | 35 |
Bool enabled;
|
| 35 | 36 |
char *device_name;
|
| ... | ... | @@ -361,6 +361,7 @@ void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion |
| 361 | 361 |
);
|
| 362 | 362 |
|
| 363 | 363 |
/* amdgpu_present.c */
|
| 364 |
+void amdgpu_present_set_screen_vrr(ScrnInfoPtr scrn, Bool vrr_enabled);
|
|
| 364 | 365 |
Bool amdgpu_present_screen_init(ScreenPtr screen);
|
| 365 | 366 |
|
| 366 | 367 |
/* amdgpu_sync.c */
|
| ... | ... | @@ -66,6 +66,12 @@ static DevPrivateKeyRec amdgpu_window_private_key; |
| 66 | 66 |
static DevScreenPrivateKeyRec amdgpu_client_private_key;
|
| 67 | 67 |
DevScreenPrivateKeyRec amdgpu_device_private_key;
|
| 68 | 68 |
|
| 69 |
+static Atom amdgpu_vrr_atom;
|
|
| 70 |
+static Bool amdgpu_property_vectors_wrapped;
|
|
| 71 |
+static Bool restore_property_vector;
|
|
| 72 |
+static int (*saved_change_property) (ClientPtr client);
|
|
| 73 |
+static int (*saved_delete_property) (ClientPtr client);
|
|
| 74 |
+ |
|
| 69 | 75 |
static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen);
|
| 70 | 76 |
|
| 71 | 77 |
const OptionInfoRec AMDGPUOptions_KMS[] = {
|
| ... | ... | @@ -89,6 +95,134 @@ const OptionInfoRec *AMDGPUOptionsWeak(void) |
| 89 | 95 |
return AMDGPUOptions_KMS;
|
| 90 | 96 |
}
|
| 91 | 97 |
|
| 98 |
+static inline struct amdgpu_window_priv *get_window_priv(WindowPtr win) {
|
|
| 99 |
+ return dixLookupPrivate(&win->devPrivates, &amdgpu_window_private_key);
|
|
| 100 |
+}
|
|
| 101 |
+ |
|
| 102 |
+static void
|
|
| 103 |
+amdgpu_vrr_property_update(WindowPtr window, Bool variable_refresh)
|
|
| 104 |
+{
|
|
| 105 |
+ ScrnInfoPtr scrn = xf86ScreenToScrn(window->drawable.pScreen);
|
|
| 106 |
+ AMDGPUInfoPtr info = AMDGPUPTR(scrn);
|
|
| 107 |
+ |
|
| 108 |
+ get_window_priv(window)->variable_refresh = variable_refresh;
|
|
| 109 |
+ |
|
| 110 |
+ if (info->flip_window == window &&
|
|
| 111 |
+ info->drmmode.present_flipping)
|
|
| 112 |
+ amdgpu_present_set_screen_vrr(scrn, variable_refresh);
|
|
| 113 |
+}
|
|
| 114 |
+ |
|
| 115 |
+/* Wrapper for xserver/dix/property.c:ProcChangeProperty */
|
|
| 116 |
+static int
|
|
| 117 |
+amdgpu_change_property(ClientPtr client)
|
|
| 118 |
+{
|
|
| 119 |
+ WindowPtr window;
|
|
| 120 |
+ int ret;
|
|
| 121 |
+ |
|
| 122 |
+ REQUEST(xChangePropertyReq);
|
|
| 123 |
+ |
|
| 124 |
+ client->requestVector[X_ChangeProperty] = saved_change_property;
|
|
| 125 |
+ ret = saved_change_property(client);
|
|
| 126 |
+ |
|
| 127 |
+ if (restore_property_vector)
|
|
| 128 |
+ return ret;
|
|
| 129 |
+ |
|
| 130 |
+ client->requestVector[X_ChangeProperty] = amdgpu_change_property;
|
|
| 131 |
+ |
|
| 132 |
+ if (ret != Success)
|
|
| 133 |
+ return ret;
|
|
| 134 |
+ |
|
| 135 |
+ ret = dixLookupWindow(&window, stuff->window, client, DixSetPropAccess);
|
|
| 136 |
+ if (ret != Success)
|
|
| 137 |
+ return ret;
|
|
| 138 |
+ |
|
| 139 |
+ if (stuff->property == amdgpu_vrr_atom &&
|
|
| 140 |
+ xf86ScreenToScrn(window->drawable.pScreen)->PreInit ==
|
|
| 141 |
+ AMDGPUPreInit_KMS && stuff->format == 32 && stuff->nUnits == 1) {
|
|
| 142 |
+ uint32_t *value = (uint32_t*)(stuff + 1);
|
|
| 143 |
+ |
|
| 144 |
+ amdgpu_vrr_property_update(window, *value != 0);
|
|
| 145 |
+ }
|
|
| 146 |
+ |
|
| 147 |
+ return ret;
|
|
| 148 |
+}
|
|
| 149 |
+ |
|
| 150 |
+/* Wrapper for xserver/dix/property.c:ProcDeleteProperty */
|
|
| 151 |
+static int
|
|
| 152 |
+amdgpu_delete_property(ClientPtr client)
|
|
| 153 |
+{
|
|
| 154 |
+ WindowPtr window;
|
|
| 155 |
+ int ret;
|
|
| 156 |
+ |
|
| 157 |
+ REQUEST(xDeletePropertyReq);
|
|
| 158 |
+ |
|
| 159 |
+ client->requestVector[X_DeleteProperty] = saved_delete_property;
|
|
| 160 |
+ ret = saved_delete_property(client);
|
|
| 161 |
+ |
|
| 162 |
+ if (restore_property_vector)
|
|
| 163 |
+ return ret;
|
|
| 164 |
+ |
|
| 165 |
+ client->requestVector[X_DeleteProperty] = amdgpu_delete_property;
|
|
| 166 |
+ |
|
| 167 |
+ if (ret != Success)
|
|
| 168 |
+ return ret;
|
|
| 169 |
+ |
|
| 170 |
+ ret = dixLookupWindow(&window, stuff->window, client, DixSetPropAccess);
|
|
| 171 |
+ if (ret != Success)
|
|
| 172 |
+ return ret;
|
|
| 173 |
+ |
|
| 174 |
+ if (stuff->property == amdgpu_vrr_atom &&
|
|
| 175 |
+ xf86ScreenToScrn(window->drawable.pScreen)->PreInit ==
|
|
| 176 |
+ AMDGPUPreInit_KMS)
|
|
| 177 |
+ amdgpu_vrr_property_update(window, FALSE);
|
|
| 178 |
+ |
|
| 179 |
+ return ret;
|
|
| 180 |
+}
|
|
| 181 |
+ |
|
| 182 |
+static void
|
|
| 183 |
+amdgpu_unwrap_property_requests(ScrnInfoPtr scrn)
|
|
| 184 |
+{
|
|
| 185 |
+ int i;
|
|
| 186 |
+ |
|
| 187 |
+ if (!amdgpu_property_vectors_wrapped)
|
|
| 188 |
+ return;
|
|
| 189 |
+ |
|
| 190 |
+ if (ProcVector[X_ChangeProperty] == amdgpu_change_property)
|
|
| 191 |
+ ProcVector[X_ChangeProperty] = saved_change_property;
|
|
| 192 |
+ else
|
|
| 193 |
+ restore_property_vector = TRUE;
|
|
| 194 |
+ |
|
| 195 |
+ if (ProcVector[X_DeleteProperty] == amdgpu_delete_property)
|
|
| 196 |
+ ProcVector[X_DeleteProperty] = saved_delete_property;
|
|
| 197 |
+ else
|
|
| 198 |
+ restore_property_vector = TRUE;
|
|
| 199 |
+ |
|
| 200 |
+ for (i = 0; i < currentMaxClients; i++) {
|
|
| 201 |
+ if (clients[i]->requestVector[X_ChangeProperty] ==
|
|
| 202 |
+ amdgpu_change_property) {
|
|
| 203 |
+ clients[i]->requestVector[X_ChangeProperty] =
|
|
| 204 |
+ saved_change_property;
|
|
| 205 |
+ } else {
|
|
| 206 |
+ restore_property_vector = TRUE;
|
|
| 207 |
+ }
|
|
| 208 |
+ |
|
| 209 |
+ if (clients[i]->requestVector[X_DeleteProperty] ==
|
|
| 210 |
+ amdgpu_delete_property) {
|
|
| 211 |
+ clients[i]->requestVector[X_DeleteProperty] =
|
|
| 212 |
+ saved_delete_property;
|
|
| 213 |
+ } else {
|
|
| 214 |
+ restore_property_vector = TRUE;
|
|
| 215 |
+ }
|
|
| 216 |
+ }
|
|
| 217 |
+ |
|
| 218 |
+ if (restore_property_vector) {
|
|
| 219 |
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
|
|
| 220 |
+ "Couldn't unwrap some window property request vectors\n");
|
|
| 221 |
+ }
|
|
| 222 |
+ |
|
| 223 |
+ amdgpu_property_vectors_wrapped = FALSE;
|
|
| 224 |
+}
|
|
| 225 |
+ |
|
| 92 | 226 |
extern _X_EXPORT int gAMDGPUEntityIndex;
|
| 93 | 227 |
|
| 94 | 228 |
static int getAMDGPUEntityIndex(void)
|
| ... | ... | @@ -146,6 +280,7 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn) |
| 146 | 280 |
pAMDGPUEnt = pPriv->ptr;
|
| 147 | 281 |
pAMDGPUEnt->fd_ref--;
|
| 148 | 282 |
if (!pAMDGPUEnt->fd_ref) {
|
| 283 |
+ amdgpu_unwrap_property_requests(pScrn);
|
|
| 149 | 284 |
amdgpu_device_deinitialize(pAMDGPUEnt->pDev);
|
| 150 | 285 |
amdgpu_kernel_close_fd(pAMDGPUEnt);
|
| 151 | 286 |
free(pPriv->ptr);
|
| ... | ... | @@ -156,52 +291,6 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn) |
| 156 | 291 |
free(pEnt);
|
| 157 | 292 |
}
|
| 158 | 293 |
|
| 159 |
- |
|
| 160 |
-static inline struct amdgpu_window_priv *get_window_priv(WindowPtr win) {
|
|
| 161 |
- return dixLookupPrivate(&win->devPrivates, &amdgpu_window_private_key);
|
|
| 162 |
-}
|
|
| 163 |
- |
|
| 164 |
-static void
|
|
| 165 |
-amdgpu_property_notify(ClientPtr client,
|
|
| 166 |
- XID id,
|
|
| 167 |
- int state,
|
|
| 168 |
- ATOM property_name)
|
|
| 169 |
-{
|
|
| 170 |
- WindowPtr win;
|
|
| 171 |
- PropertyPtr prop;
|
|
| 172 |
- struct amdgpu_window_priv *priv;
|
|
| 173 |
- const char* str;
|
|
| 174 |
- int res;
|
|
| 175 |
- |
|
| 176 |
- res = dixLookupWindow(&win, id, client, DixReadAccess);
|
|
| 177 |
- if (res != Success)
|
|
| 178 |
- return;
|
|
| 179 |
- |
|
| 180 |
- str = NameForAtom(property_name);
|
|
| 181 |
- if (str == NULL)
|
|
| 182 |
- return;
|
|
| 183 |
- |
|
| 184 |
- if (strcmp(str, "_VARIABLE_REFRESH") != 0)
|
|
| 185 |
- return;
|
|
| 186 |
- |
|
| 187 |
- priv = get_window_priv(win);
|
|
| 188 |
- if (!priv)
|
|
| 189 |
- return;
|
|
| 190 |
- |
|
| 191 |
- priv->variable_refresh = 0;
|
|
| 192 |
- |
|
| 193 |
- res = dixLookupProperty(&prop,
|
|
| 194 |
- win,
|
|
| 195 |
- property_name,
|
|
| 196 |
- client,
|
|
| 197 |
- DixReadAccess);
|
|
| 198 |
- |
|
| 199 |
- if (res == Success && prop->format == 32 && prop->size == 1) {
|
|
| 200 |
- uint32_t value = *(uint32_t*)prop->data;
|
|
| 201 |
- priv->variable_refresh = (value != 0);
|
|
| 202 |
- }
|
|
| 203 |
-}
|
|
| 204 |
- |
|
| 205 | 294 |
Bool amdgpu_window_has_variable_refresh(WindowPtr win) {
|
| 206 | 295 |
struct amdgpu_window_priv *priv = get_window_priv(win);
|
| 207 | 296 |
|
| ... | ... | @@ -249,17 +338,6 @@ amdgpu_event_callback(CallbackListPtr *list, |
| 249 | 338 |
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
|
| 250 | 339 |
int i;
|
| 251 | 340 |
|
| 252 |
- if (info->vrr_support) {
|
|
| 253 |
- for (i = 0; i < eventinfo->count; i++) {
|
|
| 254 |
- xEventPtr ev = &eventinfo->events[i];
|
|
| 255 |
- if (ev->u.u.type == PropertyNotify)
|
|
| 256 |
- amdgpu_property_notify(eventinfo->client,
|
|
| 257 |
- ev->u.property.window,
|
|
| 258 |
- ev->u.property.state,
|
|
| 259 |
- ev->u.property.atom);
|
|
| 260 |
- }
|
|
| 261 |
- }
|
|
| 262 |
- |
|
| 263 | 341 |
if (callback_needs_flush(info, client_priv) ||
|
| 264 | 342 |
callback_needs_flush(info, server_priv))
|
| 265 | 343 |
return;
|
| ... | ... | @@ -365,7 +443,8 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen) |
| 365 | 443 |
}
|
| 366 | 444 |
}
|
| 367 | 445 |
|
| 368 |
- if (!dixRegisterPrivateKey(&amdgpu_window_private_key,
|
|
| 446 |
+ if (info->vrr_support &&
|
|
| 447 |
+ !dixRegisterPrivateKey(&amdgpu_window_private_key,
|
|
| 369 | 448 |
PRIVATE_WINDOW,
|
| 370 | 449 |
sizeof(struct amdgpu_window_priv)))
|
| 371 | 450 |
return FALSE;
|
| ... | ... | @@ -1516,6 +1595,12 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags) |
| 1516 | 1595 |
|
| 1517 | 1596 |
info->dri2.available = FALSE;
|
| 1518 | 1597 |
info->dri2.enabled = FALSE;
|
| 1598 |
+ info->dri2.pKernelDRMVersion = drmGetVersion(pAMDGPUEnt->fd);
|
|
| 1599 |
+ if (info->dri2.pKernelDRMVersion == NULL) {
|
|
| 1600 |
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
| 1601 |
+ "AMDGPUDRIGetVersion failed to get the DRM version\n");
|
|
| 1602 |
+ return FALSE;
|
|
| 1603 |
+ }
|
|
| 1519 | 1604 |
|
| 1520 | 1605 |
/* Get ScreenInit function */
|
| 1521 | 1606 |
if (!xf86LoadSubModule(pScrn, "fb"))
|
| ... | ... | @@ -1550,11 +1635,13 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags) |
| 1550 | 1635 |
if (info->shadow_primary)
|
| 1551 | 1636 |
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowPrimary enabled\n");
|
| 1552 | 1637 |
|
| 1553 |
- from = xf86GetOptValBool(info->Options, OPTION_VARIABLE_REFRESH,
|
|
| 1554 |
- &info->vrr_support) ? X_CONFIG : X_DEFAULT;
|
|
| 1638 |
+ if (!pScrn->is_gpu) {
|
|
| 1639 |
+ from = xf86GetOptValBool(info->Options, OPTION_VARIABLE_REFRESH,
|
|
| 1640 |
+ &info->vrr_support) ? X_CONFIG : X_DEFAULT;
|
|
| 1555 | 1641 |
|
| 1556 |
- xf86DrvMsg(pScrn->scrnIndex, from, "VariableRefresh: %sabled\n",
|
|
| 1557 |
- info->vrr_support ? "en" : "dis");
|
|
| 1642 |
+ xf86DrvMsg(pScrn->scrnIndex, from, "VariableRefresh: %sabled\n",
|
|
| 1643 |
+ info->vrr_support ? "en" : "dis");
|
|
| 1644 |
+ }
|
|
| 1558 | 1645 |
}
|
| 1559 | 1646 |
|
| 1560 | 1647 |
if (!pScrn->is_gpu) {
|
| ... | ... | @@ -2092,6 +2179,19 @@ Bool AMDGPUScreenInit_KMS(ScreenPtr pScreen, int argc, char **argv) |
| 2092 | 2179 |
if (serverGeneration == 1)
|
| 2093 | 2180 |
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
|
| 2094 | 2181 |
|
| 2182 |
+ if (info->vrr_support) {
|
|
| 2183 |
+ if (!amdgpu_property_vectors_wrapped) {
|
|
| 2184 |
+ saved_change_property = ProcVector[X_ChangeProperty];
|
|
| 2185 |
+ ProcVector[X_ChangeProperty] = amdgpu_change_property;
|
|
| 2186 |
+ saved_delete_property = ProcVector[X_DeleteProperty];
|
|
| 2187 |
+ ProcVector[X_DeleteProperty] = amdgpu_delete_property;
|
|
| 2188 |
+ amdgpu_property_vectors_wrapped = TRUE;
|
|
| 2189 |
+ }
|
|
| 2190 |
+ |
|
| 2191 |
+ amdgpu_vrr_atom = MakeAtom("_VARIABLE_REFRESH",
|
|
| 2192 |
+ strlen("_VARIABLE_REFRESH"), TRUE);
|
|
| 2193 |
+ }
|
|
| 2194 |
+ |
|
| 2095 | 2195 |
drmmode_init(pScrn, &info->drmmode);
|
| 2096 | 2196 |
|
| 2097 | 2197 |
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
|
| ... | ... | @@ -90,7 +90,7 @@ amdgpu_present_get_ust_msc(RRCrtcPtr crtc, CARD64 *ust, CARD64 *msc) |
| 90 | 90 |
/*
|
| 91 | 91 |
* Changes the variable refresh state for every CRTC on the screen.
|
| 92 | 92 |
*/
|
| 93 |
-static void
|
|
| 93 |
+void
|
|
| 94 | 94 |
amdgpu_present_set_screen_vrr(ScrnInfoPtr scrn, Bool vrr_enabled)
|
| 95 | 95 |
{
|
| 96 | 96 |
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
| ... | ... | @@ -255,6 +255,7 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, |
| 255 | 255 |
xf86CrtcPtr xf86_crtc = crtc->devPrivate;
|
| 256 | 256 |
ScreenPtr screen = window->drawable.pScreen;
|
| 257 | 257 |
ScrnInfoPtr scrn = xf86_crtc->scrn;
|
| 258 |
+ PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
|
| 258 | 259 |
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
| 259 | 260 |
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
|
| 260 | 261 |
int num_crtcs_on;
|
| ... | ... | @@ -272,12 +273,23 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, |
| 272 | 273 |
if (info->drmmode.dri2_flipping)
|
| 273 | 274 |
return FALSE;
|
| 274 | 275 |
|
| 275 |
- /* The kernel driver doesn't handle flipping between BOs with different
|
|
| 276 |
- * tiling parameters correctly yet
|
|
| 277 |
- */
|
|
| 278 |
- if (amdgpu_pixmap_get_tiling_info(pixmap) !=
|
|
| 279 |
- amdgpu_pixmap_get_tiling_info(screen->GetScreenPixmap(screen)))
|
|
| 276 |
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1, 20, 99, 1, 0)
|
|
| 277 |
+ if (pixmap->devKind != screen_pixmap->devKind)
|
|
| 280 | 278 |
return FALSE;
|
| 279 |
+#endif
|
|
| 280 |
+ |
|
| 281 |
+ /* Only DC supports advanced color management features, so we can use
|
|
| 282 |
+ * drmmode_cm_enabled as a proxy for "Is DC enabled?"
|
|
| 283 |
+ */
|
|
| 284 |
+ if (info->dri2.pKernelDRMVersion->version_minor < 31 ||
|
|
| 285 |
+ !drmmode_cm_enabled(&info->drmmode)) {
|
|
| 286 |
+ /* The kernel driver doesn't handle flipping between BOs with
|
|
| 287 |
+ * different tiling parameters correctly
|
|
| 288 |
+ */
|
|
| 289 |
+ if (amdgpu_pixmap_get_tiling_info(pixmap) !=
|
|
| 290 |
+ amdgpu_pixmap_get_tiling_info(screen_pixmap))
|
|
| 291 |
+ return FALSE;
|
|
| 292 |
+ }
|
|
| 281 | 293 |
|
| 282 | 294 |
for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {
|
| 283 | 295 |
if (drmmode_crtc_can_flip(config->crtc[i]))
|
| ... | ... | @@ -826,14 +826,6 @@ static enum drmmode_cm_prop get_cm_enum_from_str(const char *prop_name) |
| 826 | 826 |
return CM_INVALID_PROP;
|
| 827 | 827 |
}
|
| 828 | 828 |
|
| 829 |
-/**
|
|
| 830 |
- * Return TRUE if kernel supports non-legacy color management.
|
|
| 831 |
- */
|
|
| 832 |
-static Bool drmmode_cm_enabled(drmmode_ptr drmmode)
|
|
| 833 |
-{
|
|
| 834 |
- return drmmode->cm_prop_ids[CM_GAMMA_LUT_SIZE] != 0;
|
|
| 835 |
-}
|
|
| 836 |
- |
|
| 837 | 829 |
/**
|
| 838 | 830 |
* If legacy LUT is a, and non-legacy LUT is b, then the result of b(a(x)) is
|
| 839 | 831 |
* returned in out_lut. out_lut's length is expected to be the same as the
|
| ... | ... | @@ -182,6 +182,15 @@ enum drmmode_flip_sync { |
| 182 | 182 |
};
|
| 183 | 183 |
|
| 184 | 184 |
|
| 185 |
+/**
|
|
| 186 |
+ * Return TRUE if kernel supports non-legacy color management.
|
|
| 187 |
+ */
|
|
| 188 |
+static inline Bool
|
|
| 189 |
+drmmode_cm_enabled(drmmode_ptr drmmode)
|
|
| 190 |
+{
|
|
| 191 |
+ return drmmode->cm_prop_ids[CM_GAMMA_LUT_SIZE] != 0;
|
|
| 192 |
+}
|
|
| 193 |
+ |
|
| 185 | 194 |
/* Can the page flip ioctl be used for this CRTC? */
|
| 186 | 195 |
static inline Bool
|
| 187 | 196 |
drmmode_crtc_can_flip(xf86CrtcPtr crtc)
|