Lines 195-202
Link Here
|
195 |
uint32_t id; |
195 |
uint32_t id; |
196 |
xf86CrtcPtr base; |
196 |
xf86CrtcPtr base; |
197 |
struct drm_mode_modeinfo kmode; |
197 |
struct drm_mode_modeinfo kmode; |
198 |
PixmapPtr slave_pixmap; |
198 |
PixmapPtr secondary_pixmap; |
199 |
DamagePtr slave_damage; |
199 |
DamagePtr secondary_damage; |
200 |
struct kgem_bo *bo, *shadow_bo, *client_bo, *cache_bo; |
200 |
struct kgem_bo *bo, *shadow_bo, *client_bo, *cache_bo; |
201 |
struct sna_cursor *cursor; |
201 |
struct sna_cursor *cursor; |
202 |
unsigned int last_cursor_size; |
202 |
unsigned int last_cursor_size; |
Lines 617-623
Link Here
|
617 |
|
617 |
|
618 |
assert(bo->tiling != I915_TILING_Y || sna->kgem.can_scanout_y); |
618 |
assert(bo->tiling != I915_TILING_Y || sna->kgem.can_scanout_y); |
619 |
assert((bo->pitch & 63) == 0); |
619 |
assert((bo->pitch & 63) == 0); |
620 |
assert(scrn->vtSema); /* must be master */ |
620 |
assert(scrn->vtSema); /* must be primary */ |
621 |
|
621 |
|
622 |
VG_CLEAR(arg); |
622 |
VG_CLEAR(arg); |
623 |
arg.width = width; |
623 |
arg.width = width; |
Lines 1604-1610
Link Here
|
1604 |
VG_CLEAR(arg); |
1604 |
VG_CLEAR(arg); |
1605 |
arg.crtc_id = __sna_crtc_id(sna_crtc); |
1605 |
arg.crtc_id = __sna_crtc_id(sna_crtc); |
1606 |
arg.fb_id = fb_id(sna_crtc->bo); |
1606 |
arg.fb_id = fb_id(sna_crtc->bo); |
1607 |
if (sna_crtc->transform || sna_crtc->slave_pixmap) { |
1607 |
if (sna_crtc->transform || sna_crtc->secondary_pixmap) { |
1608 |
arg.x = 0; |
1608 |
arg.x = 0; |
1609 |
arg.y = 0; |
1609 |
arg.y = 0; |
1610 |
sna_crtc->offset = 0; |
1610 |
sna_crtc->offset = 0; |
Lines 2021-2027
Link Here
|
2021 |
sna->mode.shadow_dirty = false; |
2021 |
sna->mode.shadow_dirty = false; |
2022 |
} |
2022 |
} |
2023 |
|
2023 |
|
2024 |
static void sna_crtc_slave_damage(DamagePtr damage, RegionPtr region, void *closure) |
2024 |
static void sna_crtc_secondary_damage(DamagePtr damage, RegionPtr region, void *closure) |
2025 |
{ |
2025 |
{ |
2026 |
struct sna_crtc *crtc = closure; |
2026 |
struct sna_crtc *crtc = closure; |
2027 |
struct sna *sna = to_sna(crtc->base->scrn); |
2027 |
struct sna *sna = to_sna(crtc->base->scrn); |
Lines 2033-2039
Link Here
|
2033 |
region_num_rects(region), |
2033 |
region_num_rects(region), |
2034 |
__sna_crtc_pipe(crtc), crtc->base->x, crtc->base->y)); |
2034 |
__sna_crtc_pipe(crtc), crtc->base->x, crtc->base->y)); |
2035 |
|
2035 |
|
2036 |
assert(crtc->slave_damage == damage); |
2036 |
assert(crtc->secondary_damage == damage); |
2037 |
assert(sna->mode.shadow_damage); |
2037 |
assert(sna->mode.shadow_damage); |
2038 |
|
2038 |
|
2039 |
RegionTranslate(region, crtc->base->x, crtc->base->y); |
2039 |
RegionTranslate(region, crtc->base->x, crtc->base->y); |
Lines 2058-2079
Link Here
|
2058 |
assert(sna->mode.shadow == NULL); |
2058 |
assert(sna->mode.shadow == NULL); |
2059 |
} |
2059 |
} |
2060 |
|
2060 |
|
2061 |
if (crtc->slave_pixmap) { |
2061 |
if (crtc->secondary_pixmap) { |
2062 |
assert(crtc->slave_damage == NULL); |
2062 |
assert(crtc->secondary_damage == NULL); |
2063 |
|
2063 |
|
2064 |
DBG(("%s: enabling PRIME slave tracking on CRTC %d [pipe=%d], pixmap=%ld\n", |
2064 |
DBG(("%s: enabling PRIME secondary tracking on CRTC %d [pipe=%d], pixmap=%ld\n", |
2065 |
__FUNCTION__, __sna_crtc_id(crtc), __sna_crtc_pipe(crtc), crtc->slave_pixmap->drawable.serialNumber)); |
2065 |
__FUNCTION__, __sna_crtc_id(crtc), __sna_crtc_pipe(crtc), crtc->secondary_pixmap->drawable.serialNumber)); |
2066 |
crtc->slave_damage = DamageCreate(sna_crtc_slave_damage, NULL, |
2066 |
crtc->secondary_damage = DamageCreate(sna_crtc_secondary_damage, NULL, |
2067 |
DamageReportRawRegion, TRUE, |
2067 |
DamageReportRawRegion, TRUE, |
2068 |
to_screen_from_sna(sna), |
2068 |
to_screen_from_sna(sna), |
2069 |
crtc); |
2069 |
crtc); |
2070 |
if (crtc->slave_damage == NULL) { |
2070 |
if (crtc->secondary_damage == NULL) { |
2071 |
if (!--sna->mode.shadow_active) |
2071 |
if (!--sna->mode.shadow_active) |
2072 |
sna_mode_disable_shadow(sna); |
2072 |
sna_mode_disable_shadow(sna); |
2073 |
return false; |
2073 |
return false; |
2074 |
} |
2074 |
} |
2075 |
|
2075 |
|
2076 |
DamageRegister(&crtc->slave_pixmap->drawable, crtc->slave_damage); |
2076 |
DamageRegister(&crtc->secondary_pixmap->drawable, crtc->secondary_damage); |
2077 |
} |
2077 |
} |
2078 |
|
2078 |
|
2079 |
crtc->shadow = true; |
2079 |
crtc->shadow = true; |
Lines 2116-2126
Link Here
|
2116 |
DBG(("%s: disabling for crtc %d\n", __FUNCTION__, __sna_crtc_id(crtc))); |
2116 |
DBG(("%s: disabling for crtc %d\n", __FUNCTION__, __sna_crtc_id(crtc))); |
2117 |
assert(sna->mode.shadow_active > 0); |
2117 |
assert(sna->mode.shadow_active > 0); |
2118 |
|
2118 |
|
2119 |
if (crtc->slave_damage) { |
2119 |
if (crtc->secondary_damage) { |
2120 |
assert(crtc->slave_pixmap); |
2120 |
assert(crtc->secondary_pixmap); |
2121 |
DamageUnregister(&crtc->slave_pixmap->drawable, crtc->slave_damage); |
2121 |
DamageUnregister(&crtc->secondary_pixmap->drawable, crtc->secondary_damage); |
2122 |
DamageDestroy(crtc->slave_damage); |
2122 |
DamageDestroy(crtc->secondary_damage); |
2123 |
crtc->slave_damage = NULL; |
2123 |
crtc->secondary_damage = NULL; |
2124 |
} |
2124 |
} |
2125 |
|
2125 |
|
2126 |
sna_crtc_disable_override(sna, crtc); |
2126 |
sna_crtc_disable_override(sna, crtc); |
Lines 2392-2398
Link Here
|
2392 |
return true; |
2392 |
return true; |
2393 |
} |
2393 |
} |
2394 |
|
2394 |
|
2395 |
if (sna->flags & SNA_TEAR_FREE && to_sna_crtc(crtc)->slave_pixmap) { |
2395 |
if (sna->flags & SNA_TEAR_FREE && to_sna_crtc(crtc)->secondary_pixmap) { |
2396 |
DBG(("%s: TearFree shadow required\n", __FUNCTION__)); |
2396 |
DBG(("%s: TearFree shadow required\n", __FUNCTION__)); |
2397 |
return true; |
2397 |
return true; |
2398 |
} |
2398 |
} |
Lines 2659-2665
Link Here
|
2659 |
return NULL; |
2659 |
return NULL; |
2660 |
} |
2660 |
} |
2661 |
|
2661 |
|
2662 |
front = sna_crtc->slave_pixmap ?: sna->front; |
2662 |
front = sna_crtc->secondary_pixmap ?: sna->front; |
2663 |
if (__sna_pixmap_get_bo(front) && !rr_active(crtc)) { |
2663 |
if (__sna_pixmap_get_bo(front) && !rr_active(crtc)) { |
2664 |
BoxRec b; |
2664 |
BoxRec b; |
2665 |
|
2665 |
|
Lines 2717-2725
Link Here
|
2717 |
sna_crtc->shadow_bo = NULL; |
2717 |
sna_crtc->shadow_bo = NULL; |
2718 |
} |
2718 |
} |
2719 |
|
2719 |
|
2720 |
if (sna_crtc->slave_pixmap) { |
2720 |
if (sna_crtc->secondary_pixmap) { |
2721 |
DBG(("%s: attaching to scanout pixmap\n", __FUNCTION__)); |
2721 |
DBG(("%s: attaching to scanout pixmap\n", __FUNCTION__)); |
2722 |
bo = get_scanout_bo(sna, sna_crtc->slave_pixmap); |
2722 |
bo = get_scanout_bo(sna, sna_crtc->secondary_pixmap); |
2723 |
if (bo == NULL) { |
2723 |
if (bo == NULL) { |
2724 |
DBG(("%s: failed to pin crtc scanout\n", __FUNCTION__)); |
2724 |
DBG(("%s: failed to pin crtc scanout\n", __FUNCTION__)); |
2725 |
sna_crtc->fallback_shadow = true; |
2725 |
sna_crtc->fallback_shadow = true; |
Lines 2727-2734
Link Here
|
2727 |
} |
2727 |
} |
2728 |
|
2728 |
|
2729 |
if (!get_fb(sna, bo, |
2729 |
if (!get_fb(sna, bo, |
2730 |
sna_crtc->slave_pixmap->drawable.width, |
2730 |
sna_crtc->secondary_pixmap->drawable.width, |
2731 |
sna_crtc->slave_pixmap->drawable.height)) { |
2731 |
sna_crtc->secondary_pixmap->drawable.height)) { |
2732 |
DBG(("%s: failed to bind fb for crtc scanout\n", __FUNCTION__)); |
2732 |
DBG(("%s: failed to bind fb for crtc scanout\n", __FUNCTION__)); |
2733 |
sna_crtc->fallback_shadow = true; |
2733 |
sna_crtc->fallback_shadow = true; |
2734 |
goto force_shadow; |
2734 |
goto force_shadow; |
Lines 2752-2758
Link Here
|
2752 |
if (sna->flags & SNA_TEAR_FREE) { |
2752 |
if (sna->flags & SNA_TEAR_FREE) { |
2753 |
RegionRec region; |
2753 |
RegionRec region; |
2754 |
|
2754 |
|
2755 |
assert(sna_crtc->slave_pixmap == NULL); |
2755 |
assert(sna_crtc->secondary_pixmap == NULL); |
2756 |
|
2756 |
|
2757 |
DBG(("%s: enabling TearFree shadow\n", __FUNCTION__)); |
2757 |
DBG(("%s: enabling TearFree shadow\n", __FUNCTION__)); |
2758 |
region.extents.x1 = 0; |
2758 |
region.extents.x1 = 0; |
Lines 3286-3292
Link Here
|
3286 |
if (sna_crtc == NULL) |
3286 |
if (sna_crtc == NULL) |
3287 |
return FALSE; |
3287 |
return FALSE; |
3288 |
|
3288 |
|
3289 |
if (pixmap == sna_crtc->slave_pixmap) |
3289 |
if (pixmap == sna_crtc->secondary_pixmap) |
3290 |
return TRUE; |
3290 |
return TRUE; |
3291 |
|
3291 |
|
3292 |
DBG(("%s: CRTC:%d, pipe=%d setting scanout pixmap=%ld\n", |
3292 |
DBG(("%s: CRTC:%d, pipe=%d setting scanout pixmap=%ld\n", |
Lines 3296-3302
Link Here
|
3296 |
/* Disable first so that we can unregister the damage tracking */ |
3296 |
/* Disable first so that we can unregister the damage tracking */ |
3297 |
sna_crtc_disable_shadow(to_sna(crtc->scrn), sna_crtc); |
3297 |
sna_crtc_disable_shadow(to_sna(crtc->scrn), sna_crtc); |
3298 |
|
3298 |
|
3299 |
sna_crtc->slave_pixmap = pixmap; |
3299 |
sna_crtc->secondary_pixmap = pixmap; |
3300 |
|
3300 |
|
3301 |
return TRUE; |
3301 |
return TRUE; |
3302 |
} |
3302 |
} |
Lines 7180-7186
Link Here
|
7180 |
if (crtc->bo == NULL) |
7180 |
if (crtc->bo == NULL) |
7181 |
continue; |
7181 |
continue; |
7182 |
assert(!crtc->transform); |
7182 |
assert(!crtc->transform); |
7183 |
assert(!crtc->slave_pixmap); |
7183 |
assert(!crtc->secondary_pixmap); |
7184 |
assert(crtc->bo->active_scanout); |
7184 |
assert(crtc->bo->active_scanout); |
7185 |
assert(crtc->bo->refcnt >= crtc->bo->active_scanout); |
7185 |
assert(crtc->bo->refcnt >= crtc->bo->active_scanout); |
7186 |
assert(crtc->flip_bo == NULL); |
7186 |
assert(crtc->flip_bo == NULL); |
Lines 8825-8838
Link Here
|
8825 |
inline static DrawablePtr crtc_source(xf86CrtcPtr crtc, int16_t *sx, int16_t *sy) |
8825 |
inline static DrawablePtr crtc_source(xf86CrtcPtr crtc, int16_t *sx, int16_t *sy) |
8826 |
{ |
8826 |
{ |
8827 |
struct sna_crtc *sna_crtc = to_sna_crtc(crtc); |
8827 |
struct sna_crtc *sna_crtc = to_sna_crtc(crtc); |
8828 |
if (sna_crtc->slave_pixmap) { |
8828 |
if (sna_crtc->secondary_pixmap) { |
8829 |
DBG(("%s: using slave pixmap=%ld, offset (%d, %d)\n", |
8829 |
DBG(("%s: using secondary pixmap=%ld, offset (%d, %d)\n", |
8830 |
__FUNCTION__, |
8830 |
__FUNCTION__, |
8831 |
sna_crtc->slave_pixmap->drawable.serialNumber, |
8831 |
sna_crtc->secondary_pixmap->drawable.serialNumber, |
8832 |
-crtc->x, -crtc->y)); |
8832 |
-crtc->x, -crtc->y)); |
8833 |
*sx = -crtc->x; |
8833 |
*sx = -crtc->x; |
8834 |
*sy = -crtc->y; |
8834 |
*sy = -crtc->y; |
8835 |
return &sna_crtc->slave_pixmap->drawable; |
8835 |
return &sna_crtc->secondary_pixmap->drawable; |
8836 |
} else { |
8836 |
} else { |
8837 |
DBG(("%s: using Screen pixmap=%ld\n", |
8837 |
DBG(("%s: using Screen pixmap=%ld\n", |
8838 |
__FUNCTION__, |
8838 |
__FUNCTION__, |
Lines 9263-9269
Link Here
|
9263 |
if (crtc->bo == NULL) |
9263 |
if (crtc->bo == NULL) |
9264 |
continue; |
9264 |
continue; |
9265 |
|
9265 |
|
9266 |
if (crtc->slave_pixmap) |
9266 |
if (crtc->secondary_pixmap) |
9267 |
continue; |
9267 |
continue; |
9268 |
|
9268 |
|
9269 |
if (crtc->client_bo) |
9269 |
if (crtc->client_bo) |
Lines 9358-9365
Link Here
|
9358 |
} |
9358 |
} |
9359 |
RegionUninit(&damage); |
9359 |
RegionUninit(&damage); |
9360 |
|
9360 |
|
9361 |
if (sna_crtc->slave_damage) |
9361 |
if (sna_crtc->secondary_damage) |
9362 |
DamageEmpty(sna_crtc->slave_damage); |
9362 |
DamageEmpty(sna_crtc->secondary_damage); |
9363 |
} |
9363 |
} |
9364 |
|
9364 |
|
9365 |
RegionEmpty(region); |
9365 |
RegionEmpty(region); |
Lines 9529-9536
Link Here
|
9529 |
RegionUninit(&damage); |
9529 |
RegionUninit(&damage); |
9530 |
sigio_unblock(sigio); |
9530 |
sigio_unblock(sigio); |
9531 |
|
9531 |
|
9532 |
if (sna_crtc->slave_damage) |
9532 |
if (sna_crtc->secondary_damage) |
9533 |
DamageEmpty(sna_crtc->slave_damage); |
9533 |
DamageEmpty(sna_crtc->secondary_damage); |
9534 |
} |
9534 |
} |
9535 |
|
9535 |
|
9536 |
if (sna->mode.shadow) { |
9536 |
if (sna->mode.shadow) { |