[PATCH xserver 1/3] modesetting: ms_covering_crtc: Remove unused arguments, make static
Peter Wu
peter at lekensteyn.nl
Sat Aug 27 17:31:55 UTC 2016
On Wed, Aug 24, 2016 at 03:30:10PM +0200, Hans de Goede wrote:
> Remove unused arguments from ms_covering_crtc, make it static as it is
> only used in vblank.c.
>
> While at it also change its first argument from a ScrnInfoPtr to a
> ScreenPtr, this makes the next patch in this patch-set cleaner.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
> hw/xfree86/drivers/modesetting/driver.h | 2 --
> hw/xfree86/drivers/modesetting/vblank.c | 20 +++++---------------
> 2 files changed, 5 insertions(+), 17 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
> index 761490a..aa00d05 100644
> --- a/hw/xfree86/drivers/modesetting/driver.h
> +++ b/hw/xfree86/drivers/modesetting/driver.h
> @@ -137,8 +137,6 @@ void ms_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq);
> Bool ms_crtc_on(xf86CrtcPtr crtc);
>
> xf86CrtcPtr ms_dri2_crtc_covering_drawable(DrawablePtr pDraw);
> -xf86CrtcPtr ms_covering_crtc(ScrnInfoPtr scrn, BoxPtr box,
> - xf86CrtcPtr desired, BoxPtr crtc_box_ret);
>
> int ms_get_crtc_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc);
>
> diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
> index d5a9ded..e738497 100644
> --- a/hw/xfree86/drivers/modesetting/vblank.c
> +++ b/hw/xfree86/drivers/modesetting/vblank.c
> @@ -96,10 +96,10 @@ ms_crtc_on(xf86CrtcPtr crtc)
> * with greater coverage
> */
This code was taken from the xf86-video-intel driver and the
simplification here seems reasonable. Please take care of the comment
above though, it is not valid after this change.
Kind regards,
Peter
> -xf86CrtcPtr
> -ms_covering_crtc(ScrnInfoPtr scrn,
> - BoxPtr box, xf86CrtcPtr desired, BoxPtr crtc_box_ret)
> +static xf86CrtcPtr
> +ms_covering_crtc(ScreenPtr pScreen, BoxPtr box)
> {
> + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
> xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
> xf86CrtcPtr crtc, best_crtc;
> int coverage, best_coverage;
> @@ -108,10 +108,6 @@ ms_covering_crtc(ScrnInfoPtr scrn,
>
> best_crtc = NULL;
> best_coverage = 0;
> - crtc_box_ret->x1 = 0;
> - crtc_box_ret->x2 = 0;
> - crtc_box_ret->y1 = 0;
> - crtc_box_ret->y2 = 0;
> for (c = 0; c < xf86_config->num_crtc; c++) {
> crtc = xf86_config->crtc[c];
>
> @@ -122,12 +118,7 @@ ms_covering_crtc(ScrnInfoPtr scrn,
> ms_crtc_box(crtc, &crtc_box);
> ms_box_intersect(&cover_box, &crtc_box, box);
> coverage = ms_box_area(&cover_box);
> - if (coverage && crtc == desired) {
> - *crtc_box_ret = crtc_box;
> - return crtc;
> - }
> if (coverage > best_coverage) {
> - *crtc_box_ret = crtc_box;
> best_crtc = crtc;
> best_coverage = coverage;
> }
> @@ -139,15 +130,14 @@ xf86CrtcPtr
> ms_dri2_crtc_covering_drawable(DrawablePtr pDraw)
> {
> ScreenPtr pScreen = pDraw->pScreen;
> - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
> - BoxRec box, crtcbox;
> + BoxRec box;
>
> box.x1 = pDraw->x;
> box.y1 = pDraw->y;
> box.x2 = box.x1 + pDraw->width;
> box.y2 = box.y1 + pDraw->height;
>
> - return ms_covering_crtc(pScrn, &box, NULL, &crtcbox);
> + return ms_covering_crtc(pScreen, &box);
> }
>
> static Bool
> --
> 2.9.3
>
More information about the xorg-devel
mailing list