Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | From 6e035c007876ffe972a497681dd3debdc806e979 Mon Sep 17 00:00:00 2001 |
| 2 | From: Dave Airlie <airlied@redhat.com> |
| 3 | Date: Mon, 13 Jul 2020 09:11:28 +1000 |
| 4 | Subject: [PATCH] ati: cleanup terminology to use primary/secondary |
| 5 | |
| 6 | The X server changed some API/ABIs here. |
| 7 | |
| 8 | Based on amdgpu patch by Michel |
| 9 | --- |
| 10 | Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/commit/8da3e4561ef82bb78c9a17b8cd8bf139b9cfd680.patch] |
| 11 | man/radeon.man | 2 +- |
| 12 | src/compat-api.h | 6 ++++ |
| 13 | src/drmmode_display.c | 4 +-- |
| 14 | src/evergreen_state.h | 2 +- |
| 15 | src/r600_state.h | 2 +- |
| 16 | src/radeon.h | 10 +++--- |
| 17 | src/radeon_exa.c | 2 +- |
| 18 | src/radeon_glamor.c | 2 +- |
| 19 | src/radeon_kms.c | 74 +++++++++++++++++++++---------------------- |
| 20 | 9 files changed, 55 insertions(+), 49 deletions(-) |
| 21 | |
| 22 | diff --git a/man/radeon.man b/man/radeon.man |
| 23 | index dcebf53..247dcdb 100644 |
| 24 | --- a/man/radeon.man |
| 25 | +++ b/man/radeon.man |
| 26 | @@ -290,7 +290,7 @@ on. If this option is set, the default value of the property is 'on' or 'off' |
| 27 | accordingly. If this option isn't set, the default value of the property is |
| 28 | .B auto, |
| 29 | which means that TearFree is on for rotated outputs, outputs with RandR |
| 30 | -transforms applied and for RandR 1.4 slave outputs, otherwise off. |
| 31 | +transforms applied and for RandR 1.4 secondary outputs, otherwise off. |
| 32 | .TP |
| 33 | .BI "Option \*qAccelMethod\*q \*q" "string" \*q |
| 34 | Chooses between available acceleration architectures. Valid values are |
| 35 | diff --git a/src/compat-api.h b/src/compat-api.h |
| 36 | index f4e7524..def6d3e 100644 |
| 37 | --- a/src/compat-api.h |
| 38 | +++ b/src/compat-api.h |
| 39 | @@ -34,4 +34,10 @@ |
| 40 | #define BLOCKHANDLER_ARGS pScreen, pTimeout, pReadmask |
| 41 | #endif |
| 42 | |
| 43 | +#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2) |
| 44 | +#define current_primary current_master |
| 45 | +#define primary_pixmap master_pixmap |
| 46 | +#define secondary_dst slave_dst |
| 47 | +#endif |
| 48 | + |
| 49 | #endif |
| 50 | diff --git a/src/drmmode_display.c b/src/drmmode_display.c |
| 51 | index 0e9e247..3dec91e 100644 |
| 52 | --- a/src/drmmode_display.c |
| 53 | +++ b/src/drmmode_display.c |
| 54 | @@ -720,7 +720,7 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode, |
| 55 | xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, |
| 56 | ent) { |
| 57 | if (radeon_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) { |
| 58 | - dirty->slave_dst = |
| 59 | + dirty->secondary_dst = |
| 60 | drmmode_crtc->scanout[scanout_id].pixmap; |
| 61 | break; |
| 62 | } |
| 63 | @@ -1356,7 +1356,7 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix) |
| 64 | |
| 65 | xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) { |
| 66 | if (radeon_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) { |
| 67 | - PixmapStopDirtyTracking(dirty->src, dirty->slave_dst); |
| 68 | + PixmapStopDirtyTracking(dirty->src, dirty->secondary_dst); |
| 69 | break; |
| 70 | } |
| 71 | } |
| 72 | diff --git a/src/evergreen_state.h b/src/evergreen_state.h |
| 73 | index 7e54e1c..34ba87b 100644 |
| 74 | --- a/src/evergreen_state.h |
| 75 | +++ b/src/evergreen_state.h |
| 76 | @@ -350,7 +350,7 @@ extern void *RADEONEXACreatePixmap2(ScreenPtr pScreen, int width, int height, |
| 77 | int *new_pitch); |
| 78 | extern void RADEONEXADestroyPixmap(ScreenPtr pScreen, void *driverPriv); |
| 79 | extern Bool RADEONEXAPixmapIsOffscreen(PixmapPtr pPix); |
| 80 | -extern Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **handle_p); |
| 81 | +extern Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr secondary, void **handle_p); |
| 82 | extern Bool RADEONEXASetSharedPixmapBacking(PixmapPtr ppix, void *handle); |
| 83 | |
| 84 | #endif |
| 85 | diff --git a/src/r600_state.h b/src/r600_state.h |
| 86 | index 3434599..567c3ca 100644 |
| 87 | --- a/src/r600_state.h |
| 88 | +++ b/src/r600_state.h |
| 89 | @@ -321,6 +321,6 @@ extern void *RADEONEXACreatePixmap2(ScreenPtr pScreen, int width, int height, |
| 90 | int *new_pitch); |
| 91 | extern void RADEONEXADestroyPixmap(ScreenPtr pScreen, void *driverPriv); |
| 92 | extern Bool RADEONEXAPixmapIsOffscreen(PixmapPtr pPix); |
| 93 | -extern Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **handle_p); |
| 94 | +extern Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr secondary, void **handle_p); |
| 95 | extern Bool RADEONEXASetSharedPixmapBacking(PixmapPtr ppix, void *handle); |
| 96 | #endif |
| 97 | diff --git a/src/radeon.h b/src/radeon.h |
| 98 | index 2c91346..85fd021 100644 |
| 99 | --- a/src/radeon.h |
| 100 | +++ b/src/radeon.h |
| 101 | @@ -182,18 +182,18 @@ typedef enum { |
| 102 | |
| 103 | |
| 104 | static inline ScreenPtr |
| 105 | -radeon_master_screen(ScreenPtr screen) |
| 106 | +radeon_primary_screen(ScreenPtr screen) |
| 107 | { |
| 108 | - if (screen->current_master) |
| 109 | - return screen->current_master; |
| 110 | + if (screen->current_primary) |
| 111 | + return screen->current_primary; |
| 112 | |
| 113 | return screen; |
| 114 | } |
| 115 | |
| 116 | static inline ScreenPtr |
| 117 | -radeon_dirty_master(PixmapDirtyUpdatePtr dirty) |
| 118 | +radeon_dirty_primary(PixmapDirtyUpdatePtr dirty) |
| 119 | { |
| 120 | - return radeon_master_screen(dirty->slave_dst->drawable.pScreen); |
| 121 | + return radeon_primary_screen(dirty->secondary_dst->drawable.pScreen); |
| 122 | } |
| 123 | |
| 124 | static inline DrawablePtr |
| 125 | diff --git a/src/radeon_exa.c b/src/radeon_exa.c |
| 126 | index 268155e..320ff99 100644 |
| 127 | --- a/src/radeon_exa.c |
| 128 | +++ b/src/radeon_exa.c |
| 129 | @@ -282,7 +282,7 @@ void RADEONEXADestroyPixmap(ScreenPtr pScreen, void *driverPriv) |
| 130 | free(driverPriv); |
| 131 | } |
| 132 | |
| 133 | -Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **fd_handle) |
| 134 | +Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr seconndary, void **fd_handle) |
| 135 | { |
| 136 | struct radeon_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(ppix); |
| 137 | |
| 138 | diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c |
| 139 | index f109838..ccf9994 100644 |
| 140 | --- a/src/radeon_glamor.c |
| 141 | +++ b/src/radeon_glamor.c |
| 142 | @@ -366,7 +366,7 @@ radeon_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap) |
| 143 | |
| 144 | |
| 145 | static Bool |
| 146 | -radeon_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave, |
| 147 | +radeon_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr secondary, |
| 148 | void **handle_p) |
| 149 | { |
| 150 | ScreenPtr screen = pixmap->drawable.pScreen; |
| 151 | diff --git a/src/radeon_kms.c b/src/radeon_kms.c |
| 152 | index b3db7c4..62962d6 100644 |
| 153 | --- a/src/radeon_kms.c |
| 154 | +++ b/src/radeon_kms.c |
| 155 | @@ -559,8 +559,8 @@ dirty_region(PixmapDirtyUpdatePtr dirty) |
| 156 | if (dirty->rotation != RR_Rotate_0) { |
| 157 | dstregion = transform_region(damageregion, |
| 158 | &dirty->f_inverse, |
| 159 | - dirty->slave_dst->drawable.width, |
| 160 | - dirty->slave_dst->drawable.height); |
| 161 | + dirty->secondary_dst->drawable.width, |
| 162 | + dirty->secondary_dst->drawable.height); |
| 163 | } else |
| 164 | #endif |
| 165 | { |
| 166 | @@ -568,7 +568,7 @@ dirty_region(PixmapDirtyUpdatePtr dirty) |
| 167 | |
| 168 | dstregion = RegionDuplicate(damageregion); |
| 169 | RegionTranslate(dstregion, -dirty->x, -dirty->y); |
| 170 | - PixmapRegionInit(&pixregion, dirty->slave_dst); |
| 171 | + PixmapRegionInit(&pixregion, dirty->secondary_dst); |
| 172 | RegionIntersect(dstregion, dstregion, &pixregion); |
| 173 | RegionUninit(&pixregion); |
| 174 | } |
| 175 | @@ -585,8 +585,8 @@ redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region) |
| 176 | if (RegionNil(region)) |
| 177 | goto out; |
| 178 | |
| 179 | - if (dirty->slave_dst->master_pixmap) |
| 180 | - DamageRegionAppend(&dirty->slave_dst->drawable, region); |
| 181 | + if (dirty->secondary_dst->primary_pixmap) |
| 182 | + DamageRegionAppend(&dirty->secondary_dst->drawable, region); |
| 183 | |
| 184 | #ifdef HAS_DIRTYTRACKING_ROTATION |
| 185 | PixmapSyncDirtyHelper(dirty); |
| 186 | @@ -595,8 +595,8 @@ redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region) |
| 187 | #endif |
| 188 | |
| 189 | radeon_cs_flush_indirect(src_scrn); |
| 190 | - if (dirty->slave_dst->master_pixmap) |
| 191 | - DamageRegionProcessPending(&dirty->slave_dst->drawable); |
| 192 | + if (dirty->secondary_dst->primary_pixmap) |
| 193 | + DamageRegionProcessPending(&dirty->secondary_dst->drawable); |
| 194 | |
| 195 | out: |
| 196 | DamageEmpty(dirty->damage); |
| 197 | @@ -613,12 +613,12 @@ radeon_prime_scanout_update_abort(xf86CrtcPtr crtc, void *event_data) |
| 198 | void |
| 199 | radeon_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty) |
| 200 | { |
| 201 | - ScreenPtr master_screen = radeon_dirty_master(dirty); |
| 202 | + ScreenPtr primary_screen = radeon_dirty_primary(dirty); |
| 203 | PixmapDirtyUpdatePtr ent; |
| 204 | RegionPtr region; |
| 205 | |
| 206 | - xorg_list_for_each_entry(ent, &master_screen->pixmap_dirty_list, ent) { |
| 207 | - if (!radeon_dirty_src_equals(dirty, ent->slave_dst)) |
| 208 | + xorg_list_for_each_entry(ent, &primary_screen->pixmap_dirty_list, ent) { |
| 209 | + if (!radeon_dirty_src_equals(dirty, ent->secondary_dst)) |
| 210 | continue; |
| 211 | |
| 212 | region = dirty_region(ent); |
| 213 | @@ -631,45 +631,45 @@ radeon_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty) |
| 214 | #if HAS_SYNC_SHARED_PIXMAP |
| 215 | |
| 216 | static Bool |
| 217 | -master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 218 | +primary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 219 | { |
| 220 | - ScreenPtr master_screen = radeon_dirty_master(dirty); |
| 221 | + ScreenPtr primary_screen = radeon_dirty_primary(dirty); |
| 222 | |
| 223 | - return !!master_screen->SyncSharedPixmap; |
| 224 | + return !!primary_screen->SyncSharedPixmap; |
| 225 | } |
| 226 | |
| 227 | static Bool |
| 228 | -slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 229 | +secondary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 230 | { |
| 231 | - ScreenPtr slave_screen = dirty->slave_dst->drawable.pScreen; |
| 232 | + ScreenPtr secondary_screen = dirty->secondary_dst->drawable.pScreen; |
| 233 | |
| 234 | - return !!slave_screen->SyncSharedPixmap; |
| 235 | + return !!secondary_screen->SyncSharedPixmap; |
| 236 | } |
| 237 | |
| 238 | static void |
| 239 | call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty) |
| 240 | { |
| 241 | - ScreenPtr master_screen = radeon_dirty_master(dirty); |
| 242 | + ScreenPtr primary_screen = radeon_dirty_primary(dirty); |
| 243 | |
| 244 | - master_screen->SyncSharedPixmap(dirty); |
| 245 | + primary_screen->SyncSharedPixmap(dirty); |
| 246 | } |
| 247 | |
| 248 | #else /* !HAS_SYNC_SHARED_PIXMAP */ |
| 249 | |
| 250 | static Bool |
| 251 | -master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 252 | +primary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 253 | { |
| 254 | - ScrnInfoPtr master_scrn = xf86ScreenToScrn(radeon_dirty_master(dirty)); |
| 255 | + ScrnInfoPtr primary_scrn = xf86ScreenToScrn(radeon_dirty_primary(dirty)); |
| 256 | |
| 257 | - return master_scrn->driverName == scrn->driverName; |
| 258 | + return primary_scrn->driverName == scrn->driverName; |
| 259 | } |
| 260 | |
| 261 | static Bool |
| 262 | -slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 263 | +secondary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) |
| 264 | { |
| 265 | - ScrnInfoPtr slave_scrn = xf86ScreenToScrn(dirty->slave_dst->drawable.pScreen); |
| 266 | + ScrnInfoPtr secondary_scrn = xf86ScreenToScrn(dirty->secondary_dst->drawable.pScreen); |
| 267 | |
| 268 | - return slave_scrn->driverName == scrn->driverName; |
| 269 | + return secondary_scrn->driverName == scrn->driverName; |
| 270 | } |
| 271 | |
| 272 | static void |
| 273 | @@ -684,12 +684,12 @@ call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty) |
| 274 | static xf86CrtcPtr |
| 275 | radeon_prime_dirty_to_crtc(PixmapDirtyUpdatePtr dirty) |
| 276 | { |
| 277 | - ScreenPtr screen = dirty->slave_dst->drawable.pScreen; |
| 278 | + ScreenPtr screen = dirty->secondary_dst->drawable.pScreen; |
| 279 | ScrnInfoPtr scrn = xf86ScreenToScrn(screen); |
| 280 | xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); |
| 281 | int c; |
| 282 | |
| 283 | - /* Find the CRTC which is scanning out from this slave pixmap */ |
| 284 | + /* Find the CRTC which is scanning out from this secondary pixmap */ |
| 285 | for (c = 0; c < xf86_config->num_crtc; c++) { |
| 286 | xf86CrtcPtr xf86_crtc = xf86_config->crtc[c]; |
| 287 | drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private; |
| 288 | @@ -714,7 +714,7 @@ radeon_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id) |
| 289 | if (radeon_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) { |
| 290 | RegionPtr region; |
| 291 | |
| 292 | - if (master_has_sync_shared_pixmap(scrn, dirty)) |
| 293 | + if (primary_has_sync_shared_pixmap(scrn, dirty)) |
| 294 | call_sync_shared_pixmap(dirty); |
| 295 | |
| 296 | region = dirty_region(dirty); |
| 297 | @@ -727,7 +727,7 @@ radeon_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id) |
| 298 | radeon_cs_flush_indirect(scrn); |
| 299 | RegionCopy(&drmmode_crtc->scanout_last_region, region); |
| 300 | RegionTranslate(region, -crtc->x, -crtc->y); |
| 301 | - dirty->slave_dst = drmmode_crtc->scanout[scanout_id].pixmap; |
| 302 | + dirty->secondary_dst = drmmode_crtc->scanout[scanout_id].pixmap; |
| 303 | } |
| 304 | |
| 305 | redisplay_dirty(dirty, region); |
| 306 | @@ -754,7 +754,7 @@ radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t u |
| 307 | static void |
| 308 | radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty) |
| 309 | { |
| 310 | - ScreenPtr screen = dirty->slave_dst->drawable.pScreen; |
| 311 | + ScreenPtr screen = dirty->secondary_dst->drawable.pScreen; |
| 312 | ScrnInfoPtr scrn = xf86ScreenToScrn(screen); |
| 313 | RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); |
| 314 | xf86CrtcPtr xf86_crtc = radeon_prime_dirty_to_crtc(dirty); |
| 315 | @@ -818,7 +818,7 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty) |
| 316 | static void |
| 317 | radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent) |
| 318 | { |
| 319 | - ScreenPtr screen = ent->slave_dst->drawable.pScreen; |
| 320 | + ScreenPtr screen = ent->secondary_dst->drawable.pScreen; |
| 321 | ScrnInfoPtr scrn = xf86ScreenToScrn(screen); |
| 322 | RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); |
| 323 | xf86CrtcPtr crtc = radeon_prime_dirty_to_crtc(ent); |
| 324 | @@ -893,11 +893,11 @@ radeon_dirty_update(ScrnInfoPtr scrn) |
| 325 | if (screen->isGPU) { |
| 326 | PixmapDirtyUpdatePtr region_ent = ent; |
| 327 | |
| 328 | - if (master_has_sync_shared_pixmap(scrn, ent)) { |
| 329 | - ScreenPtr master_screen = radeon_dirty_master(ent); |
| 330 | + if (primary_has_sync_shared_pixmap(scrn, ent)) { |
| 331 | + ScreenPtr primary_screen = radeon_dirty_primary(ent); |
| 332 | |
| 333 | - xorg_list_for_each_entry(region_ent, &master_screen->pixmap_dirty_list, ent) { |
| 334 | - if (radeon_dirty_src_equals(ent, region_ent->slave_dst)) |
| 335 | + xorg_list_for_each_entry(region_ent, &primary_screen->pixmap_dirty_list, ent) { |
| 336 | + if (radeon_dirty_src_equals(ent, region_ent->secondary_dst)) |
| 337 | break; |
| 338 | } |
| 339 | } |
| 340 | @@ -921,7 +921,7 @@ radeon_dirty_update(ScrnInfoPtr scrn) |
| 341 | |
| 342 | RegionDestroy(region); |
| 343 | } else { |
| 344 | - if (slave_has_sync_shared_pixmap(scrn, ent)) |
| 345 | + if (secondary_has_sync_shared_pixmap(scrn, ent)) |
| 346 | continue; |
| 347 | |
| 348 | region = dirty_region(ent); |
| 349 | @@ -1216,7 +1216,7 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL) |
| 350 | (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS); |
| 351 | pScreen->BlockHandler = RADEONBlockHandler_KMS; |
| 352 | |
| 353 | - if (!xf86ScreenToScrn(radeon_master_screen(pScreen))->vtSema) |
| 354 | + if (!xf86ScreenToScrn(radeon_primary_screen(pScreen))->vtSema) |
| 355 | return; |
| 356 | |
| 357 | if (!pScreen->isGPU) |
| 358 | @@ -2584,7 +2584,7 @@ CARD32 cleanup_black_fb(OsTimerPtr timer, CARD32 now, pointer data) |
| 359 | xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); |
| 360 | int c; |
| 361 | |
| 362 | - if (xf86ScreenToScrn(radeon_master_screen(screen))->vtSema) |
| 363 | + if (xf86ScreenToScrn(radeon_primary_screen(screen))->vtSema) |
| 364 | return 0; |
| 365 | |
| 366 | /* Unreference the all-black FB created by RADEONLeaveVT_KMS. After |
| 367 | -- |
| 368 | 2.33.1 |
| 369 | |