[GRASS-dev] [GRASS GIS] #2998: m.nviz.image fails with X Error BadValue integer parameter out of range for operation

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------------------------------+-------------------------
Reporter: wenzeslaus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.1.0
Component: LibOpenGL | Version: svn-trunk
Keywords: m.nviz.image, NVIZ, 3D, GLX, | CPU: x86-64
  X_GLXCreateContext, g.gui.animation |
Platform: Linux |
-------------------------------------------------+-------------------------
G7:m.nviz.image fails to render the image. (3D view in wxGUI works well.)

Generating vector points (fails for any data):

{{{
v.random -z output=points n=100 zmin=0 zmax=20
# or
# r.surf.fractal fractal
}}}

Running, m.nviz.image:

{{{
m.nviz.image vpoint=points vpoint_size=5 vpoint_layer=1 \
   position=0.84,0.16 height=600 perspective=30 focus=172,136,0 \
   output=nviz_output format=ppm size=798,530
}}}

The error:

{{{
X Error of failed request: BadValue (integer parameter out of range for
operation)
   Major opcode of failed request: 154 (GLX)
   Minor opcode of failed request: 3 (X_GLXCreateContext)
   Value in failed request: 0x0
   Serial number of failed request: 24
   Current serial number in output stream: 29
}}}

GRASS version:

{{{
> g.version -re
GRASS 7.1.svn (2016)
libgis Revision: 67275
libgis Date: 2015-12-20 07:50:48 -0500 (Sun, 20 Dec 2015)
PROJ.4: 4.9.1
GDAL/OGR: 1.11.2
GEOS: 3.5.0
SQLite: 3.8.11.1
}}}

Computer and system info:

{{{
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
$ lspci -v # selected lines only
00:02.0 VGA compatible controller: Intel Corporation Sky Lake Integrated
Graphics (rev 07) (prog-if 00 [VGA controller])
         Subsystem: CLEVO/KAPOK Computer Device 2425
         Flags: bus master, fast devsel, latency 0, IRQ 126
         Memory at de000000 (64-bit, non-prefetchable) [size=16M]
         Memory at c0000000 (64-bit, prefetchable) [size=256M]
         I/O ports at f000 [size=64]
         Expansion ROM at <unassigned> [disabled]
         Capabilities: <access denied>
         Kernel driver in use: i915
$ sudo dmidecode -q | grep -iE "Manufacturer|Product Name" | sed
's/[[:blank:]]\{2,\}//g' | sort | uniq
         Manufacturer: Intel(R) Corporation
         Manufacturer: Samsung
         Manufacturer: System76, Inc.
         Product Name: Lemur
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: LibOpenGL | Version: svn-trunk
Resolution: | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by virtuale71):

m.viz.image fails also on generating a tiff image of a dem raster. Here is
the error report:

         APPCRASH
   application name: m.nviz.image.exe
   application version: 7.0.0.0
   Timestamp application: 5725e1e3
   Error module name: libgrass_ogsf.7.0.4.dll
   Error module version : 0.0.0.0
   Timestamp error module: 5725df0e
   exception code: c0000094
   exception offset: 000000000002c080
   Versione SO: 6.1.7601.2.1.0.256.48
   Local settins: 1040
  Extra information 1: f010
  Extra information 2: f010b8bf1a53840503aacbf5539daf48
  Extra information 3: cb08
  Extra information 4: cb08b57330503ec68eb2a7f62401ed8b

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: LibOpenGL | Version: svn-trunk
Resolution: | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by neteler):

Replying to [comment:2 virtuale71]:
> m.viz.image fails also on generating a tiff image of a dem raster. Here
is the error report:
>
> APPCRASH
> application name: m.nviz.image.exe
> application version: 7.0.0.0
> Timestamp application: 5725e1e3
> Error module name: libgrass_ogsf.7.0.4.dll
> Error module version : 0.0.0.0
> Timestamp error module: 5725df0e
> exception code: c0000094
> exception offset: 000000000002c080
> Versione SO: 6.1.7601.2.1.0.256.48
> Local settins: 1040
> Extra information 1: f010
> Extra information 2: f010b8bf1a53840503aacbf5539daf48
> Extra information 3: cb08
> Extra information 4: cb08b57330503ec68eb2a7f62401ed8b

Please post the output of

g.region -p

Perhaps too many rows/cols?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: LibOpenGL | Version: svn-trunk
Resolution: | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by annakrat):

m.nviz.image does not work on Windows: #2114

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by hcho):

I'm getting the same error while trying to visualize the elevation raster
in the NC sample dataset.

{{{
g.region raster=elevation
m.nviz.image elevation_map=elevation output=elev perspective=15

X Error of failed request: BadValue (integer parameter out of range for
operation)
   Major opcode of failed request: 153 (GLX)
   Minor opcode of failed request: 3 (X_GLXCreateContext)
   Value in failed request: 0x0
   Serial number of failed request: 24
   Current serial number in output stream: 29

}}}

glxgears works fine.

Also, wxGUI 3D view doesn't show 3D rasters. Maybe, I don't understand how
to use it. I followed the example in r.to.rast3elev and tried to visualize
threelayer output. I can only display the wire box. I thought it's related
to m.nviz.image?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:10&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by hcho):

r72939 should fix this issue. Indirect rendering is disabled by default
since Xorg 1.17. Nviz now uses direct rendering. If we need to support
indirect rendering, we can add an environment variable later.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:11&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------
Changes (by hcho):

* status: new => closed
* resolution: => fixed

Comment:

For our record, there are three locations that create direct/indirect
rendering contexts:
{{{
./raster3d/r3.showdspf/new_init_graphics.c:1045:
glXCreateContext(XtDisplay(widget), vi, 0, GL_TRUE);
./raster3d/r3.showdspf/new_init_graphics.c:1093:
glXCreateContext(XtDisplay(widget), vi, 0, GL_TRUE);
./lib/nviz/render.c:116: rwin->contextId =
glXCreateContext(rwin->displayId, v, NULL, GL_TRUE);
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:12&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------
Changes (by neteler):

* status: closed => reopened
* resolution: fixed =>

Comment:

Replying to [comment:11 hcho]:
> r72939 should fix this issue. Indirect rendering is disabled by default
since Xorg 1.17. Nviz now uses direct rendering. If we need to support
indirect rendering, we can add an environment variable later.

(reopening for potential backport to 7.4/7.2)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:13&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------
Changes (by hcho):

* status: reopened => closed
* resolution: => fixed

Comment:

In [changeset:"72949" 72949]:
{{{
#!CommitTicketReference repository="" revision="72949"
nviz: Fix #2998 (merge from trunk r72939)
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:14&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------
Changes (by hcho):

* status: closed => reopened
* resolution: fixed =>

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:15&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------
Changes (by hcho):

* status: reopened => closed
* resolution: => fixed

Comment:

In [changeset:"72950" 72950]:
{{{
#!CommitTicketReference repository="" revision="72950"
nviz: Fix #2998 (merge from trunk r72939)
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:16&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by hcho):

r72949 & r72950 backport it to 7.2 & 7.4.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:17&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by annakrat):

Unfortunately, it is not working for me, the error is not there anymore,
but I get black image, nothing in there (both tif and ppm). I am using
Ubuntu 16.04.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:18&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by hcho):

Oh! I'm on Linux (Slackware 14.2). Is there a way to reproduce your issue?
Any sample data set and command line? Maybe, it was related to my mistake
in write_img.c, which is just fixed in r72951?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:19&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by annakrat):

Replying to [comment:19 hcho]:
> Oh! I'm on Linux (Slackware 14.2). Is there a way to reproduce your
issue? Any sample data set and command line? Maybe, it was related to my
mistake in write_img.c, which is just fixed in r72951? Please try r72951.

I am afraid it perhaps might be specific to hardware? I am running simple
command

m.nviz.image --overwrite elevation_map=elevation output=/tmp/test for=tif

I will try a different linux computer.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:20&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by hcho):

Replying to [comment:20 annakrat]:
> Replying to [comment:19 hcho]:
> > Oh! I'm on Linux (Slackware 14.2). Is there a way to reproduce your
issue? Any sample data set and command line? Maybe, it was related to my
mistake in write_img.c, which is just fixed in r72951? Please try r72951.
>
> I am afraid it perhaps might be specific to hardware? I am running
simple command
>
> m.nviz.image --overwrite elevation_map=elevation output=/tmp/test
for=tif
>
> I will try a different linux computer.

Yeah, that command works for me with the NC sample data set (attached).
Maybe, it's GPU specific or its Xorg driver? My laptop has Integrated
Intel HD Graphics 620 and Xorg uses the "intel" driver. Let me try the
same command on my desktop (NVIDIA GTX 1050Ti).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:21&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------
Changes (by hcho):

* Attachment "test.png" added.

Test on Integrated Intel HD Graphics 620, Xorg 1.18.3, Mesa 11.2.2 on
Linux kernel 4.14.39.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by annakrat):

This is my specs: Mesa DRI Intel(R) Haswell Mobile, Xorg 1.18.4, Mesa
12.0.6, Linux 4.8.0-58

I tried today on a different laptop with nvidia and it worked there.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:22&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by hcho):

Linux 4.4.132, GeForce GTX 1050 Ti, Xorg 1.18.3, Mesa 11.2.2

Nouveau (open source) & NVIDIA (proprietary) drivers work fine.

What was the other one that didn't work?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:23&gt;
GRASS GIS <https://grass.osgeo.org>

#2998: m.nviz.image fails with X Error BadValue integer parameter out of range for
operation
-------------------------+-------------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: LibOpenGL | Version: svn-trunk
Resolution: fixed | Keywords: m.nviz.image, NVIZ, 3D, GLX,
                         | X_GLXCreateContext, g.gui.animation
       CPU: x86-64 | Platform: Linux
-------------------------+-------------------------------------------------

Comment (by hcho):

Maybe, this is also related to glViewport in #3600.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2998#comment:24&gt;
GRASS GIS <https://grass.osgeo.org>