diff mbox

[RFC,xf86-video-intel] sna: OpenBSD drm_i915_gem_execbuffer2 support

Message ID 201303252208.r2PM88EO005672@glazunov.sibelius.xs4all.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Mark Kettenis March 25, 2013, 10:08 p.m. UTC
The OpenBSD version of struct drm_i915_execbuffer2 doesn't include the
member for cliprect support.  Not entirely sure why.  Perhaps when
Owain Ainsworth added GEM support, it was already obvious that
cliprects were not going to be supported on new hardware and therefore
not worth supporting.

Unfortunately the sna code explicitly initializes these members.
Obviously we can't just add those members without breaking binary
compatibility.  So the diff below takes an easy way out and adds an
#infdef __OpenBSD__ around the initializations.  An alternative would
be to use memset() to zero-initialize the entire struct and skip the
initialization of members that are zero.  What would be preferred?

Comments

Chris Wilson March 25, 2013, 10:38 p.m. UTC | #1
On Mon, Mar 25, 2013 at 11:08:09PM +0100, Mark Kettenis wrote:
> The OpenBSD version of struct drm_i915_execbuffer2 doesn't include the
> member for cliprect support.  Not entirely sure why.  Perhaps when
> Owain Ainsworth added GEM support, it was already obvious that
> cliprects were not going to be supported on new hardware and therefore
> not worth supporting.
> 
> Unfortunately the sna code explicitly initializes these members.
> Obviously we can't just add those members without breaking binary
> compatibility.  So the diff below takes an easy way out and adds an
> #infdef __OpenBSD__ around the initializations.  An alternative would
> be to use memset() to zero-initialize the entire struct and skip the
> initialization of members that are zero.  What would be preferred?

I would prefer a memset rather than adding ifdef.
-Chris
diff mbox

Patch

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index e0d864d..ff01bd2 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2627,10 +2627,12 @@  void _kgem_submit(struct kgem *kgem)
 			execbuf.buffer_count = kgem->nexec;
 			execbuf.batch_start_offset = 0;
 			execbuf.batch_len = batch_end*sizeof(uint32_t);
+#ifndef __OpenBSD__
 			execbuf.cliprects_ptr = 0;
 			execbuf.num_cliprects = 0;
 			execbuf.DR1 = 0;
 			execbuf.DR4 = 0;
+#endif
 			execbuf.flags = kgem->ring | kgem->batch_flags;
 			execbuf.rsvd1 = 0;
 			execbuf.rsvd2 = 0;