diff options
author | Ilija Hadzic <ihadzic@research.bell-labs.com> | 2012-12-19 10:35:41 -0500 |
---|---|---|
committer | Michel Dänzer <michel.daenzer@amd.com> | 2013-01-03 10:47:48 +0100 |
commit | 61d0aec40e2521488c2fe43e7a6823e5c87d94d7 (patch) | |
tree | b7678312f211fd803a6b845480c506aefbdd0ccb | |
parent | a60d2152e928a7011fc7c44a885a34c3cdd4f0fe (diff) |
video: add option to include disabled CRTCs in best CRTC search
This patch adds an option called consider_disabled to
radeon_pick_best_crtc function. If this option is set
and searching for best-fit CRTC yields nothing, the search
will be widened to include CRTCs in DPMS "off" state.
The new option is not used yet; it will be in the patches
to follow.
v2: Do not look at the CRTC mode, we only care about its box.
Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r-- | src/evergreen_textured_videofuncs.c | 2 | ||||
-rw-r--r-- | src/r600_textured_videofuncs.c | 2 | ||||
-rw-r--r-- | src/radeon.h | 1 | ||||
-rw-r--r-- | src/radeon_dri2.c | 2 | ||||
-rw-r--r-- | src/radeon_exa_funcs.c | 4 | ||||
-rw-r--r-- | src/radeon_exa_render.c | 2 | ||||
-rw-r--r-- | src/radeon_exa_shared.c | 3 | ||||
-rw-r--r-- | src/radeon_textured_videofuncs.c | 8 | ||||
-rw-r--r-- | src/radeon_video.c | 19 |
9 files changed, 31 insertions, 12 deletions
diff --git a/src/evergreen_textured_videofuncs.c b/src/evergreen_textured_videofuncs.c index a1956e72..be00ecfa 100644 --- a/src/evergreen_textured_videofuncs.c +++ b/src/evergreen_textured_videofuncs.c @@ -452,7 +452,7 @@ EVERGREENDisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) if (pPriv->desired_crtc) crtc = pPriv->desired_crtc; else - crtc = radeon_pick_best_crtc(pScrn, + crtc = radeon_pick_best_crtc(pScrn, FALSE, pPriv->drw_x, pPriv->drw_x + pPriv->dst_w, pPriv->drw_y, diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c index 19cf82d8..d20df7e2 100644 --- a/src/r600_textured_videofuncs.c +++ b/src/r600_textured_videofuncs.c @@ -435,7 +435,7 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) if (pPriv->desired_crtc) crtc = pPriv->desired_crtc; else - crtc = radeon_pick_best_crtc(pScrn, + crtc = radeon_pick_best_crtc(pScrn, FALSE, pPriv->drw_x, pPriv->drw_x + pPriv->dst_w, pPriv->drw_y, diff --git a/src/radeon.h b/src/radeon.h index 0ad14114..0ae3d1e5 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -516,6 +516,7 @@ extern void RADEONInitVideo(ScreenPtr pScreen); extern void RADEONResetVideo(ScrnInfoPtr pScrn); extern Bool radeon_load_bicubic_texture(ScrnInfoPtr pScrn); extern xf86CrtcPtr radeon_pick_best_crtc(ScrnInfoPtr pScrn, + Bool consider_disabled, int x1, int x2, int y1, int y2); extern void radeon_cs_flush_indirect(ScrnInfoPtr pScrn); diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index 919f1f67..83bc2d29 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -781,7 +781,7 @@ static int radeon_dri2_drawable_crtc(DrawablePtr pDraw) xf86CrtcPtr crtc; int crtc_id = -1; - crtc = radeon_pick_best_crtc(pScrn, + crtc = radeon_pick_best_crtc(pScrn, FALSE, pDraw->x, pDraw->x + pDraw->width, pDraw->y, diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c index 2533d786..ce6186d9 100644 --- a/src/radeon_exa_funcs.c +++ b/src/radeon_exa_funcs.c @@ -190,7 +190,7 @@ RADEONSolid(PixmapPtr pPix, int x1, int y1, int x2, int y2) if (info->accel_state->vsync) RADEONWaitForVLine(pScrn, pPix, - radeon_pick_best_crtc(pScrn, x1, x2, y1, y2), + radeon_pick_best_crtc(pScrn, FALSE, x1, x2, y1, y2), y1, y2); BEGIN_RING(2*2); @@ -304,7 +304,7 @@ RADEONCopy(PixmapPtr pDst, if (info->accel_state->vsync) RADEONWaitForVLine(pScrn, pDst, - radeon_pick_best_crtc(pScrn, dstX, dstX + w, dstY, dstY + h), + radeon_pick_best_crtc(pScrn, FALSE, dstX, dstX + w, dstY, dstY + h), dstY, dstY + h); BEGIN_RING(2*3); diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index c673f2c7..1a357422 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -2261,7 +2261,7 @@ static void RadeonCompositeTile(ScrnInfoPtr pScrn, if (info->accel_state->vsync) RADEONWaitForVLine(pScrn, pDst, - radeon_pick_best_crtc(pScrn, dstX, dstX + w, dstY, dstY + h), + radeon_pick_best_crtc(pScrn, FALSE, dstX, dstX + w, dstY, dstY + h), dstY, dstY + h); if (info->ChipFamily < CHIP_FAMILY_R200) { diff --git a/src/radeon_exa_shared.c b/src/radeon_exa_shared.c index 1218efbc..cca1c67e 100644 --- a/src/radeon_exa_shared.c +++ b/src/radeon_exa_shared.c @@ -63,7 +63,8 @@ void RADEONVlineHelperSet(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2) RADEONInfoPtr info = RADEONPTR(pScrn); struct radeon_accel_state *accel_state = info->accel_state; - accel_state->vline_crtc = radeon_pick_best_crtc(pScrn, x1, x2, y1, y2); + accel_state->vline_crtc = + radeon_pick_best_crtc(pScrn, FALSE, x1, x2, y1, y2); if (accel_state->vline_y1 == -1) accel_state->vline_y1 = y1; if (y1 < accel_state->vline_y1) diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c index 02eb0b70..cfac9022 100644 --- a/src/radeon_textured_videofuncs.c +++ b/src/radeon_textured_videofuncs.c @@ -269,7 +269,7 @@ RADEONPrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) if (pPriv->desired_crtc) crtc = pPriv->desired_crtc; else - crtc = radeon_pick_best_crtc(pScrn, + crtc = radeon_pick_best_crtc(pScrn, FALSE, pPriv->drw_x, pPriv->drw_x + pPriv->dst_w, pPriv->drw_y, @@ -813,7 +813,7 @@ R200PrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) if (pPriv->desired_crtc) crtc = pPriv->desired_crtc; else - crtc = radeon_pick_best_crtc(pScrn, + crtc = radeon_pick_best_crtc(pScrn, FALSE, pPriv->drw_x, pPriv->drw_x + pPriv->dst_w, pPriv->drw_y, @@ -2165,7 +2165,7 @@ R300PrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) if (pPriv->desired_crtc) crtc = pPriv->desired_crtc; else - crtc = radeon_pick_best_crtc(pScrn, + crtc = radeon_pick_best_crtc(pScrn, FALSE, pPriv->drw_x, pPriv->drw_x + pPriv->dst_w, pPriv->drw_y, @@ -3718,7 +3718,7 @@ R500PrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) if (pPriv->desired_crtc) crtc = pPriv->desired_crtc; else - crtc = radeon_pick_best_crtc(pScrn, + crtc = radeon_pick_best_crtc(pScrn, FALSE, pPriv->drw_x, pPriv->drw_x + pPriv->dst_w, pPriv->drw_y, diff --git a/src/radeon_video.c b/src/radeon_video.c index 80730816..9381e4a3 100644 --- a/src/radeon_video.c +++ b/src/radeon_video.c @@ -75,7 +75,7 @@ radeon_crtc_is_enabled(xf86CrtcPtr crtc) } xf86CrtcPtr -radeon_pick_best_crtc(ScrnInfoPtr pScrn, +radeon_pick_best_crtc(ScrnInfoPtr pScrn, Bool consider_disabled, int x1, int x2, int y1, int y2) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -103,6 +103,7 @@ radeon_pick_best_crtc(ScrnInfoPtr pScrn, if (primary_output && primary_output->crtc) primary_crtc = primary_output->crtc->devPrivate; + /* first consider only enabled CRTCs */ for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; @@ -118,6 +119,22 @@ radeon_pick_best_crtc(ScrnInfoPtr pScrn, best_coverage = coverage; } } + if (best_crtc || !consider_disabled) + return best_crtc; + + /* if we found nothing, repeat the search including disabled CRTCs */ + for (c = 0; c < xf86_config->num_crtc; c++) { + xf86CrtcPtr crtc = xf86_config->crtc[c]; + + radeon_crtc_box(crtc, &crtc_box); + radeon_box_intersect(&cover_box, &crtc_box, &box); + coverage = radeon_box_area(&cover_box); + if (coverage > best_coverage || + (coverage == best_coverage && crtc == primary_crtc)) { + best_crtc = crtc; + best_coverage = coverage; + } + } return best_crtc; } |