> Date: Sun, 16 Jul 2017 10:05:54 -0700
> From: Andrew Marks <amra...@gmail.com>
> 
> Hello,
> 
> I happen to have a Haswell 4600 so I tried to apply this patch, I am
> running a snapshot from 16 Jul 2017 and just updated my src.  My
> drm_linux.h looks much different than the one your patch was meant for.
> cvs log shows it to be revision 1.56 so I'm not sure where the
> discrepancy lies. My drm_linux.h does not contain the lines provided in
> the context of the diff.
> 
> Is there a tag or branch I should be pulling from? I've followed the
> instructions following current.

No the diff is defenitely against rev 1.56 of drm_linux.h.

> This is the first time I've tried to apply a patch from this mailing
> list so I suspect I am doing something wrong, any pointers?

# cd /usr/src/sys
# cat ~/patch | patch -p0

should do the trick.  Could be your mail client is mangling the diff
though.

> On Sun, Jul 16, 2017 at 03:19:41PM +0200, Mark Kettenis wrote:
> > Can somebody test the following diff on Ivy Bridge or Haswell (Intel
> > HD Graphics 2500/4000/4600/4700/5000/5100/5200)?
> > 
> > When I added support for the command parser, I took a bit of a
> > shortcut and implemented the hash tables as a single linked list.
> > This diff fixes that.
> > 
> > For the hash function I used a "mode (size-1)" approach that leaves
> > one of the hash table entries unused.  Perhaps somebody with a CS
> > background has a better idea that isn't too complicated to implement?
> > 
> > Paul, Stuart, there is a small chance that this will improve the
> > vncviewer performance.
> > 
> > 
> > Index: dev/pci/drm/drm_linux.h
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.h,v
> > retrieving revision 1.56
> > diff -u -p -r1.56 drm_linux.h
> > --- dev/pci/drm/drm_linux.h 14 Jul 2017 11:18:04 -0000      1.56
> > +++ dev/pci/drm/drm_linux.h 16 Jul 2017 12:54:51 -0000
> > @@ -40,6 +40,7 @@
> >  
> >  #include <dev/pci/drm/linux_types.h>
> >  #include <dev/pci/drm/drm_linux_atomic.h>
> > +#include <dev/pci/drm/drm_linux_list.h>
> >  
> >  /* The Linux code doesn't meet our usual standards! */
> >  #ifdef __clang__
> > @@ -202,16 +203,42 @@ bitmap_weight(void *p, u_int n)
> >     return sum;
> >  }
> >  
> > -#define DECLARE_HASHTABLE(x, y) struct hlist_head x;
> > +#define DECLARE_HASHTABLE(name, bits) struct hlist_head name[1 << (bits)]
> >  
> > -#define hash_init(x)               INIT_HLIST_HEAD(&(x))
> > -#define hash_add(x, y, z)  hlist_add_head(y, &(x))
> > -#define hash_del(x)                hlist_del_init(x)
> > -#define hash_empty(x)              hlist_empty(&(x))
> > -#define hash_for_each_possible(a, b, c, d) \
> > -   hlist_for_each_entry(b, &(a), c)
> > -#define hash_for_each_safe(a, b, c, d, e) (void)(b); \
> > -   hlist_for_each_entry_safe(d, c, &(a), e)
> > +static inline void
> > +__hash_init(struct hlist_head *table, u_int size)
> > +{
> > +   u_int i;
> > +
> > +   for (i = 0; i < size; i++)
> > +           INIT_HLIST_HEAD(&table[i]);
> > +}
> > +
> > +static inline bool
> > +__hash_empty(struct hlist_head *table, u_int size)
> > +{
> > +   u_int i;
> > +
> > +   for (i = 0; i < size; i++) {
> > +           if (!hlist_empty(&table[i]))
> > +                   return false;
> > +   }
> > +
> > +   return true;
> > +}
> > +
> > +#define __hash(table, key) &table[key % (nitems(table) - 1)]
> > +
> > +#define hash_init(table)   __hash_init(table, nitems(table))
> > +#define hash_add(table, node, key) \
> > +   hlist_add_head(node, __hash(table, key))
> > +#define hash_del(node)             hlist_del_init(node)
> > +#define hash_empty(table)  __hash_empty(table, nitems(table))
> > +#define hash_for_each_possible(table, obj, member, key) \
> > +   hlist_for_each_entry(obj, __hash(table, key), member)
> > +#define hash_for_each_safe(table, i, tmp, obj, member)     \
> > +   for (i = 0; i < nitems(table); i++)             \
> > +          hlist_for_each_entry_safe(obj, tmp, &table[i], member)
> >  
> >  #define ACCESS_ONCE(x)             (x)
> >  
> > 
> 
> 

Reply via email to