Opened 9 years ago

Closed 6 years ago

Last modified 6 years ago

#2998 closed defect (fixed)

m.nviz.image fails with X Error BadValue integer parameter out of range for operation

Reported by: wenzeslaus Owned by: grass-dev@…
Priority: normal Milestone: 7.2.4
Component: LibOpenGL Version: svn-trunk
Keywords: m.nviz.image, NVIZ, 3D, GLX, X_GLXCreateContext, g.gui.animation Cc:
CPU: x86-64 Platform: Linux

Description

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

Attachments (1)

test.png (44.9 KB ) - added by hcho 6 years ago.
Test on Integrated Intel HD Graphics 620, Xorg 1.18.3, Mesa 11.2.2 on Linux kernel 4.14.39.

Download all attachments as: .zip

Change History (34)

comment:1 by neteler, 9 years ago

Milestone: 7.1.07.2.0

Milestone renamed

comment:2 by virtuale71, 9 years ago

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

in reply to:  2 comment:3 by neteler, 9 years ago

Replying to 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?

comment:4 by annakrat, 9 years ago

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

comment:5 by neteler, 8 years ago

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:6 by martinl, 8 years ago

Milestone: 7.2.17.2.2

comment:7 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:8 by martinl, 7 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:9 by martinl, 7 years ago

Milestone: 7.2.4

comment:10 by hcho, 6 years ago

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?

comment:11 by hcho, 6 years ago

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.

comment:12 by hcho, 6 years ago

Resolution: fixed
Status: newclosed

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

in reply to:  11 comment:13 by neteler, 6 years ago

Resolution: fixed
Status: closedreopened

Replying to 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)

comment:14 by hcho, 6 years ago

Resolution: fixed
Status: reopenedclosed

In 72949:

nviz: Fix #2998 (merge from trunk r72939)

comment:15 by hcho, 6 years ago

Resolution: fixed
Status: closedreopened

comment:16 by hcho, 6 years ago

Resolution: fixed
Status: reopenedclosed

In 72950:

nviz: Fix #2998 (merge from trunk r72939)

comment:17 by hcho, 6 years ago

r72949 & r72950 backport it to 7.2 & 7.4.

comment:18 by annakrat, 6 years ago

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.

comment:19 by hcho, 6 years ago

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.

Last edited 6 years ago by hcho (previous) (diff)

in reply to:  19 ; comment:20 by annakrat, 6 years ago

Replying to 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.

in reply to:  20 comment:21 by hcho, 6 years ago

Replying to annakrat:

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

by hcho, 6 years ago

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.

comment:22 by annakrat, 6 years ago

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.

comment:23 by hcho, 6 years ago

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?

comment:24 by hcho, 6 years ago

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

in reply to:  22 comment:25 by hcho, 6 years ago

Replying to 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.

Please try these patches:

They fixed the double buffering issue on my Linux.

Last edited 6 years ago by hcho (previous) (diff)

comment:26 by annakrat, 6 years ago

You found the problem, it is working for me now! I get the correctly rendered image and this output:

m.nviz.image -a --overwrite elevation_map=elevation@PERMANENT resolution_fine=1 perspective=15 output=/tmp/test format=ppm size=640,480
Loading raster map <elevation@PERMANENT>...
Loading raster map <elevation@PERMANENT>...
Translating colors from raster map <elevation@PERMANENT>...
GL Error 1: 0
GL Error 2: 0
m.nviz.image complete. File </tmp/test.ppm> created.

in reply to:  26 comment:27 by hcho, 6 years ago

Replying to annakrat:

You found the problem, it is working for me now! I get the correctly rendered image and this output:

m.nviz.image -a --overwrite elevation_map=elevation@PERMANENT resolution_fine=1 perspective=15 output=/tmp/test format=ppm size=640,480
Loading raster map <elevation@PERMANENT>...
Loading raster map <elevation@PERMANENT>...
Translating colors from raster map <elevation@PERMANENT>...
GL Error 1: 0
GL Error 2: 0
m.nviz.image complete. File </tmp/test.ppm> created.

Yeah~ Party! So you're on Linux or Windows? I need to confirm that my patches compile on MacOS and Windows.

comment:28 by annakrat, 6 years ago

On Linux. I would submit it to trunk to test it on Windows and wait for the automatic built, that's the easiest way.

in reply to:  28 comment:29 by hcho, 6 years ago

Replying to annakrat:

On Linux. I would submit it to trunk to test it on Windows and wait for the automatic built, that's the easiest way.

Yeah.. I tried to compile trunk on Windows myself, but I got some weird errors and gave up. I'll commit the patches and see if anything breaks. Thanks for testing.

comment:30 by wenzeslaus, 6 years ago

Would you mind creating an automated test? (Perhaps testing at least dimensions of created PPM.) This patch is a great progress, thank you!

in reply to:  30 ; comment:31 by hcho, 6 years ago

Replying to wenzeslaus:

Would you mind creating an automated test? (Perhaps testing at least dimensions of created PPM.) This patch is a great progress, thank you!

How does an automated test work? Is it automatically invoked by make? Different modules have different folder names for test scripts.

comment:32 by hcho, 6 years ago

The patch is in r72970. Hopefully, it compiles fine on Windows and MacOS.

in reply to:  31 comment:33 by wenzeslaus, 6 years ago

Replying to hcho:

Replying to wenzeslaus:

Would you mind creating an automated test? (Perhaps testing at least dimensions of created PPM.)

How does an automated test work?

You write a Python class using grass.gunittest package in the best case (and a shell script in the worst case). See documentation here and let me know if you are missing some info there:

https://grass.osgeo.org/grass74/manuals/libpython/gunittest_testing.html

Here is an example, see the directory called testsuite:

source:grass/trunk/raster/r.mapcalc

Is it automatically invoked by make?

No, something like make test is still to be implemented, but it should be fairly straightforward to do so.

Different modules have different folder names for test scripts.

Yes, there are some legacy tests (or tests which can't be automated) in directories with different names (or not in a subdirectory). The name which is picked by the automated tests is testsuite.

If everything is done right, the tests will appear every day at:

http://fatra.cnr.ncsu.edu/grassgistests/summary_report/nc/index.html

Note: See TracTickets for help on using tickets.