From 5be3b80b8d084ca5721be8791910d5827d1b6014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Spintzyk?= Date: Fri, 18 Sep 2020 14:32:01 +0200 Subject: [PATCH] modesetting: Remove few common functions from ms namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A lot of that code is the same as in xf86-amdgpu and xf86-nouveau drivers. By removing that functions from ms namespace we can move that code to common implementation. Signed-off-by: Ɓukasz Spintzyk --- hw/xfree86/drivers/modesetting/dri2.c | 2 +- hw/xfree86/drivers/modesetting/driver.h | 2 +- hw/xfree86/drivers/modesetting/pageflip.c | 2 +- hw/xfree86/drivers/modesetting/present.c | 2 +- hw/xfree86/drivers/modesetting/vblank.c | 34 +++++++++++------------ 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c index e893da422..7ff52be6d 100644 --- a/hw/xfree86/drivers/modesetting/dri2.c +++ b/hw/xfree86/drivers/modesetting/dri2.c @@ -552,7 +552,7 @@ can_exchange(ScrnInfoPtr scrn, DrawablePtr draw, return FALSE; #endif - if (ms_crtc_on(config->crtc[i])) + if (xf86_crtc_on(config->crtc[i])) num_crtcs_on++; } diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h index 77afc8302..114971048 100644 --- a/hw/xfree86/drivers/modesetting/driver.h +++ b/hw/xfree86/drivers/modesetting/driver.h @@ -200,7 +200,7 @@ void ms_drm_abort(ScrnInfoPtr scrn, void *match_data); void ms_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq); -Bool ms_crtc_on(xf86CrtcPtr crtc); +Bool xf86_crtc_on(xf86CrtcPtr crtc); xf86CrtcPtr ms_dri2_crtc_covering_drawable(DrawablePtr pDraw); RRCrtcPtr ms_randr_crtc_covering_drawable(DrawablePtr pDraw); diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c index 9c199668f..aaa284bf6 100644 --- a/hw/xfree86/drivers/modesetting/pageflip.c +++ b/hw/xfree86/drivers/modesetting/pageflip.c @@ -313,7 +313,7 @@ ms_do_pageflip(ScreenPtr screen, for (i = 0; i < config->num_crtc; i++) { xf86CrtcPtr crtc = config->crtc[i]; - if (!ms_crtc_on(crtc)) + if (!xf86_crtc_on(crtc)) continue; if (!queue_flip_on_crtc(screen, crtc, flipdata, diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c index 869a38c8e..f0a0e2704 100644 --- a/hw/xfree86/drivers/modesetting/present.c +++ b/hw/xfree86/drivers/modesetting/present.c @@ -259,7 +259,7 @@ ms_present_check_unflip(RRCrtcPtr crtc, if (drmmode_crtc->rotate_bo.gbm) return FALSE; - if (ms_crtc_on(config->crtc[i])) + if (xf86_crtc_on(config->crtc[i])) num_crtcs_on++; } diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c index 25784777e..c8da476b5 100644 --- a/hw/xfree86/drivers/modesetting/vblank.c +++ b/hw/xfree86/drivers/modesetting/vblank.c @@ -49,7 +49,7 @@ static struct xorg_list ms_drm_queue; static uint32_t ms_drm_seq; -static void ms_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b) +static void box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b) { dest->x1 = a->x1 > b->x1 ? a->x1 : b->x1; dest->x2 = a->x2 < b->x2 ? a->x2 : b->x2; @@ -64,7 +64,7 @@ static void ms_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b) dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0; } -static void ms_randr_crtc_box(RRCrtcPtr crtc, BoxPtr crtc_box) +static void rr_crtc_box(RRCrtcPtr crtc, BoxPtr crtc_box) { if (crtc->mode) { crtc_box->x1 = crtc->x; @@ -86,25 +86,25 @@ static void ms_randr_crtc_box(RRCrtcPtr crtc, BoxPtr crtc_box) crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0; } -static int ms_box_area(BoxPtr box) +static int box_area(BoxPtr box) { return (int)(box->x2 - box->x1) * (int)(box->y2 - box->y1); } -static Bool rr_crtc_on(RRCrtcPtr crtc, Bool crtc_is_ms_hint) +static Bool rr_crtc_on(RRCrtcPtr crtc, Bool crtc_is_xf86_hint) { if (!crtc) { return FALSE; } - if (crtc_is_ms_hint && crtc->devPrivate) { - return ms_crtc_on(crtc->devPrivate); + if (crtc_is_xf86_hint && crtc->devPrivate) { + return xf86_crtc_on(crtc->devPrivate); } else { return !!crtc->mode; } } Bool -ms_crtc_on(xf86CrtcPtr crtc) +xf86_crtc_on(xf86CrtcPtr crtc) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; @@ -117,7 +117,7 @@ ms_crtc_on(xf86CrtcPtr crtc) * 'box', then prefer the crtc with greater coverage. */ static RRCrtcPtr -ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms) +rr_crtc_covering_box(ScreenPtr pScreen, BoxPtr box, Bool screen_is_xf86_hint) { rrScrPrivPtr pScrPriv; RRCrtcPtr crtc, best_crtc; @@ -140,12 +140,12 @@ ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms) crtc = pScrPriv->crtcs[c]; /* If the CRTC is off, treat it as not covering */ - if (!rr_crtc_on(crtc, screen_is_ms)) + if (!rr_crtc_on(crtc, screen_is_xf86_hint)) continue; - ms_randr_crtc_box(crtc, &crtc_box); - ms_box_intersect(&cover_box, &crtc_box, box); - coverage = ms_box_area(&cover_box); + rr_crtc_box(crtc, &crtc_box); + box_intersect(&cover_box, &crtc_box, box); + coverage = box_area(&cover_box); if (coverage > best_coverage) { best_crtc = crtc; best_coverage = coverage; @@ -156,7 +156,7 @@ ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms) } static RRCrtcPtr -ms_covering_randr_crtc_on_secondary(ScreenPtr pScreen, BoxPtr box) +rr_crtc_covering_box_on_secondary(ScreenPtr pScreen, BoxPtr box) { if (!pScreen->isGPU) { ScreenPtr secondary; @@ -166,7 +166,7 @@ ms_covering_randr_crtc_on_secondary(ScreenPtr pScreen, BoxPtr box) if (!secondary->is_output_secondary) continue; - crtc = ms_covering_randr_crtc(secondary, box, FALSE); + crtc = rr_crtc_covering_box(secondary, box, FALSE); if (crtc) return crtc; } @@ -187,7 +187,7 @@ ms_dri2_crtc_covering_drawable(DrawablePtr pDraw) box.x2 = box.x1 + pDraw->width; box.y2 = box.y1 + pDraw->height; - crtc = ms_covering_randr_crtc(pScreen, &box, TRUE); + crtc = rr_crtc_covering_box(pScreen, &box, TRUE); if (crtc) { return crtc->devPrivate; } @@ -206,9 +206,9 @@ ms_randr_crtc_covering_drawable(DrawablePtr pDraw) box.x2 = box.x1 + pDraw->width; box.y2 = box.y1 + pDraw->height; - crtc = ms_covering_randr_crtc(pScreen, &box, TRUE); + crtc = rr_crtc_covering_box(pScreen, &box, TRUE); if (!crtc) { - crtc = ms_covering_randr_crtc_on_secondary(pScreen, &box); + crtc = rr_crtc_covering_box_on_secondary(pScreen, &box); } return crtc; }