sna: Trust the crtc-is-bound determination after modeset and hotplug
As these should be the only time that they change and we now have the checks in place, we can drop the workaround of doing the check just before emitting the wait. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
8a9a585341
commit
4094826aee
|
|
@ -141,7 +141,6 @@ struct kgem {
|
|||
uint16_t nexec;
|
||||
uint16_t nreloc;
|
||||
uint16_t nfence;
|
||||
uint16_t wait;
|
||||
uint16_t batch_size;
|
||||
uint16_t min_alignment;
|
||||
|
||||
|
|
|
|||
|
|
@ -299,6 +299,7 @@ extern void sna_mode_hotplug(struct sna *sna);
|
|||
extern void sna_mode_fini(struct sna *sna);
|
||||
|
||||
extern int sna_crtc_id(xf86CrtcPtr crtc);
|
||||
extern bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc);
|
||||
extern int sna_output_dpms_status(xf86OutputPtr output);
|
||||
|
||||
extern int sna_page_flip(struct sna *sna,
|
||||
|
|
@ -353,7 +354,6 @@ extern xf86CrtcPtr sna_covering_crtc(ScrnInfoPtr scrn,
|
|||
|
||||
extern bool sna_wait_for_scanline(struct sna *sna, PixmapPtr pixmap,
|
||||
xf86CrtcPtr crtc, const BoxRec *clip);
|
||||
extern bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc);
|
||||
|
||||
Bool sna_dri_open(struct sna *sna, ScreenPtr pScreen);
|
||||
void sna_dri_wakeup(struct sna *sna);
|
||||
|
|
|
|||
|
|
@ -389,6 +389,19 @@ mode_to_kmode(drmModeModeInfoPtr kmode, DisplayModePtr mode)
|
|||
kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
|
||||
}
|
||||
|
||||
bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc)
|
||||
{
|
||||
struct drm_mode_crtc mode;
|
||||
|
||||
mode.crtc_id = crtc_id(crtc->driver_private);
|
||||
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode))
|
||||
return false;
|
||||
|
||||
DBG(("%s: mode valid?=%d, fb attached?=%d\n", __FUNCTION__,
|
||||
mode.mode_valid, sna->mode.fb_id == mode.fb_id));
|
||||
return mode.mode_valid && sna->mode.fb_id == mode.fb_id;
|
||||
}
|
||||
|
||||
static Bool
|
||||
sna_crtc_apply(xf86CrtcPtr crtc)
|
||||
{
|
||||
|
|
@ -2110,7 +2123,6 @@ static void sna_emit_wait_for_scanline_gen6(struct sna *sna,
|
|||
b[1] = pipe;
|
||||
b[2] = y2 - 1;
|
||||
b[3] = MI_WAIT_FOR_EVENT | event;
|
||||
sna->kgem.wait = sna->kgem.nbatch + 3;
|
||||
kgem_advance_batch(&sna->kgem, 4);
|
||||
}
|
||||
|
||||
|
|
@ -2140,7 +2152,6 @@ static void sna_emit_wait_for_scanline_gen4(struct sna *sna,
|
|||
b[2] = b[0] = MI_LOAD_SCAN_LINES_INCL | pipe << 20;
|
||||
b[3] = b[1] = (y1 << 16) | (y2-1);
|
||||
b[4] = MI_WAIT_FOR_EVENT | event;
|
||||
sna->kgem.wait = sna->kgem.nbatch + 4;
|
||||
kgem_advance_batch(&sna->kgem, 5);
|
||||
}
|
||||
|
||||
|
|
@ -2168,7 +2179,6 @@ static void sna_emit_wait_for_scanline_gen2(struct sna *sna,
|
|||
b[4] = MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
|
||||
else
|
||||
b[4] = MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
|
||||
sna->kgem.wait = sna->kgem.nbatch + 4;
|
||||
kgem_advance_batch(&sna->kgem, 5);
|
||||
}
|
||||
|
||||
|
|
@ -2233,19 +2243,6 @@ sna_wait_for_scanline(struct sna *sna,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc)
|
||||
{
|
||||
struct drm_mode_crtc mode;
|
||||
|
||||
mode.crtc_id = crtc_id(crtc->driver_private);
|
||||
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode))
|
||||
return false;
|
||||
|
||||
DBG(("%s: mode valid?=%d, fb attached?=%d\n", __FUNCTION__,
|
||||
mode.mode_valid, sna->mode.fb_id == mode.fb_id));
|
||||
return mode.mode_valid && sna->mode.fb_id == mode.fb_id;
|
||||
}
|
||||
|
||||
void sna_mode_hotplug(struct sna *sna)
|
||||
{
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn);
|
||||
|
|
|
|||
|
|
@ -493,8 +493,7 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region,
|
|||
|
||||
DBG(("%s: flushing? %d\n", __FUNCTION__, flush));
|
||||
if (flush) { /* STAT! */
|
||||
if (!sna_crtc_is_bound(sna, crtc))
|
||||
sna->kgem.batch[sna->kgem.wait] = 0;
|
||||
assert(sna_crtc_is_bound(sna, ctrc));
|
||||
kgem_submit(&sna->kgem);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -308,8 +308,7 @@ sna_video_textured_put_image(ScrnInfoPtr scrn,
|
|||
* we can hit the next vsync.
|
||||
*/
|
||||
if (flush) {
|
||||
if (!sna_crtc_is_bound(sna, crtc))
|
||||
sna->kgem.batch[sna->kgem.wait] = 0;
|
||||
assert(sna_crtc_is_bound(sna, ctrc));
|
||||
kgem_submit(&sna->kgem);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue