summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-04-11 02:59:06 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-04-11 02:59:06 +0000
commit79a79347380689a5798fed37c1d8b097c9fa7e21 (patch)
treefbf611610689fe194580a0f35104c964467a77f5 /sys/dev
parentb6e98346088212741018d722ef50364d78385e67 (diff)
add/use max_t()
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drm_linux.h7
-rw-r--r--sys/dev/pci/drm/i915/intel_overlay.c10
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;