From d45b16667b8623527f194c2c440086a07bb15558 Mon Sep 17 00:00:00 2001 From: jsg Date: Sat, 11 Apr 2015 02:59:05 +0000 Subject: [PATCH] add/use max_t() --- sys/dev/pci/drm/drm_linux.h | 7 ++++++- sys/dev/pci/drm/i915/intel_overlay.c | 10 ++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index 8fac1c8ef4f..de79692de2f 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.17 2015/04/10 12:06:52 jsg Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.18 2015/04/11 02:59:05 jsg Exp $ */ /* * Copyright (c) 2013, 2014 Mark Kettenis * @@ -336,6 +336,11 @@ vfree(void *objp) t __min_b = (b); \ __min_a < __min_b ? __min_a : __min_b; }) +#define max_t(t, a, b) ({ \ + t __max_a = (a); \ + t __max_b = (b); \ + __max_a > __max_b ? __max_a : __max_b; }) + static inline uint64_t div_u64(uint64_t x, uint32_t y) { diff --git a/sys/dev/pci/drm/i915/intel_overlay.c b/sys/dev/pci/drm/i915/intel_overlay.c index a2d2d292d67..49b595ae816 100644 --- a/sys/dev/pci/drm/i915/intel_overlay.c +++ b/sys/dev/pci/drm/i915/intel_overlay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_overlay.c,v 1.14 2015/04/08 04:03:06 jsg Exp $ */ +/* $OpenBSD: intel_overlay.c,v 1.15 2015/04/11 02:59:05 jsg Exp $ */ /* * Copyright © 2009 * @@ -692,12 +692,6 @@ static u32 overlay_cmd_reg(struct put_image_params *params) return cmd; } -static inline u32 -max_u32(u32 a, u32 b) -{ - return (a > b ? a : b); -} - static int intel_overlay_do_put_image(struct intel_overlay *overlay, struct drm_i915_gem_object *new_bo, struct put_image_params *params) @@ -773,7 +767,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, params->src_w/uv_hscale); tmp_V = calc_swidthsw(overlay->dev, params->offset_V, params->src_w/uv_hscale); - swidthsw |= max_u32(tmp_U, tmp_V) << 16; + swidthsw |= max_t(u32, tmp_U, tmp_V) << 16; sheight |= (params->src_h/uv_vscale) << 16; regs->OBUF_0U = new_bo->gtt_offset + params->offset_U; regs->OBUF_0V = new_bo->gtt_offset + params->offset_V; -- 2.20.1