Re: Updating to newest sway, wlroots, and libdrm

2024-01-04 Thread Chris Waddey
Okay so I was able to get it to start on auto with the following diff
(the xf86drm.h header has been established as already (sort of) merged,
but I hadn't included the "renderD" change in my own tree):

diff --git xf86drm.c xf86drm.c
index 2e76f0ea..6d29184f 100644
--- xf86drm.c
+++ xf86drm.c
@@ -3517,8 +3517,11 @@ static char *drmGetMinorNameForFD(int fd, int type)
 
 if (!dev_name)
 return NULL;
-
+#ifdef __OpenBSD__
+n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min+128);
+#else
 n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min);
+#endif
 if (n == -1 || n >= sizeof(buf))
 return NULL;
 
@@ -4585,6 +4588,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;
diff --git xf86drm.h xf86drm.h
index 2cb14156..6254d912 100644
--- xf86drm.h
+++ xf86drm.h
@@ -77,10 +77,10 @@ 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"
+#define DRM_RENDER_MINOR_NAME   "renderD"
 #else
 #define DRM_DIR_NAME  "/dev/dri"
 #define DRM_PRIMARY_MINOR_NAME  "card"


On Thu, Jan 04, 2024 at 09:20:18AM -0700, Chris Waddey wrote:
> 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"
> > > +#

Re: Updating to newest sway, wlroots, and libdrm

2024-01-04 Thread Chris Waddey
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
> > 
> 



Re: Updating to newest sway, wlroots, and libdrm

2024-01-04 Thread Jonathan Gray
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 ?
> 
> 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).
> 
> 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') ?
> 
> > 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).

attempts to merge the patches upstream stalled years ago

https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/119



Re: Updating to newest sway, wlroots, and libdrm

2024-01-04 Thread Matthieu Herrb
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 ?

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).

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') ?

> 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).

> 
> ~ 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
>