I forgot that I needed to add this diff. There is an "#ifdef __OpenBSD__" just
above this and a comment that looks a bit dated in the latest drm code.

diff --git xf86drm.c xf86drm.c
index 2e76f0ea..7c4f5cf0 100644
--- xf86drm.c
+++ xf86drm.c
@@ -4585,6 +4585,7 @@ drm_public int drmGetDeviceFromDevId(dev_t find_rdev, 
uint32_t flags, drmDeviceP
     const char      *dev_name;
     int              node_type, subsystem_type;
     int              maj, min, n, ret;
+    struct stat sbuf;

     if (device == NULL)
         return -EINVAL;

On Thu, Jan 04, 2024 at 11:07:56AM +0100, Matthieu Herrb wrote:
> On Wed, Jan 03, 2024 at 07:52:56PM -0700, Chris Waddey wrote:
> > Hello.
> 
> Hi,
> 
> > I was able to get the latest version of sway working on my box after
> > getting the latest version of wlroots to work, which was after applying
> > the following patch to the latest version of libdrm (source obtained
> > from https://gitlab.freedesktop.org/mesa/drm.git). I don't know if we
> > have some patches somewhere else that handle this, but I figured I
> > would send it your way in case it would save some effort.
> 
> Does this include the removal of the wlr_drm protocol which was
> committed to sway/wlroots a few hours ago ?

So I just did a fresh pull/build/install of libdrm, wlroots, and
sway. Still working with the caveats below.
 
> I wasn't sure if OpenBSD libdrm / mesa supports linux-dmabuf which is
> supposed to replace it.
> 
> If it works with linux-dmabuf, that's great news. I don't think there
> are any other significant changes since the released versions packaged
> in ports that could impact OpenBSD.
> 
> > I also had to do
> > 
> > doas chmod $USER:$USER /dev/dri/* && env WLR_RENDERER=pixman
> > startsway.sh
> 
> Normally if you log in on the text console where you want to run sway,
> the /dev/dri/* owndership  is taken care of by fbtab(5).

Yeah, I don't know why I included the chown bit. Off-topic I think.

> I think setting WLR_RENDERER to pixman means that you don't use the
> new linux-dmabuf protocol. What happens if you leave that variable
> undefined (defaults to 'auto') ?

It only works with WLR_RENDERER=pixman both before and after the
recompile this morning. I've tried auto (which tries gles2) as well as
vulkan. Sorry if this is just noise.

> > to get everything just right. And of course I applied the patches I
> > found in ports to sway and wlroots, but nothing else that I can
> > think of.
> 
> This diff is present in the /usr/xenocara/lib/libdrm tree. (not
> exactly the same though: the whole #ifdef __OpenBSD__ part can be
> removed now).

I think I see this now. I figured it lived somewhere in there.

> > 
> > ~ 0$ pkg-config --modversion libdrm
> > 2.4.119
> > ~ 0$ pkg-config --modversion wlroots
> > 0.18.0-dev
> > ~ 0$ sway --version
> > sway version 1.9-dev-52eaa5be (Jan  3 2024, branch 'master')
> > 
> > diff --git xf86drm.h xf86drm.h
> > index 2cb14156..c91f157b 100644
> > --- xf86drm.h
> > +++ xf86drm.h
> > @@ -77,8 +77,8 @@ extern "C" {
> >  #define DRM_DEV_MODE        (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
> >  
> >  #ifdef __OpenBSD__
> > -#define DRM_DIR_NAME  "/dev"
> > -#define DRM_PRIMARY_MINOR_NAME  "drm"
> > +#define DRM_DIR_NAME  "/dev/dri"
> > +#define DRM_PRIMARY_MINOR_NAME  "card"
> >  #define DRM_CONTROL_MINOR_NAME  "drmC" /* deprecated */
> >  #define DRM_RENDER_MINOR_NAME   "drmR"
> >  #else
> > 
> 

Reply via email to