Skip to content

Commit

Permalink
Remove CPU rendering support for Ubuntu 18.04 (old mesa SW)
Browse files Browse the repository at this point in the history
Update docs.
  • Loading branch information
ssheorey committed Aug 2, 2024
1 parent 100b63b commit 7a6cff0
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 199 deletions.
18 changes: 0 additions & 18 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1405,24 +1405,6 @@ else()
endif()
list(APPEND Open3D_3RDPARTY_HEADER_TARGETS_FROM_SYSTEM Open3D::3rdparty_opengl)

# CPU Rendering
if(BUILD_GUI AND UNIX AND NOT APPLE)
include(FetchContent)
FetchContent_Declare(
download_mesa_libgl
PREFIX mesa
URL https://github.com/isl-org/open3d_downloads/releases/download/mesa-libgl/mesa_libGL_22.1.4.tar.bz2
URL_HASH SHA256=5732bfb70e8fcc747018820bc8fd31cd1867ebae5aa09baf65482b42c134d45a
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/mesa"
)
FetchContent_MakeAvailable(download_mesa_libgl)

set(MESA_CPU_GL_LIBRARY "${download_mesa_libgl_SOURCE_DIR}/libGL.so.1.2.0" "${download_mesa_libgl_SOURCE_DIR}/libEGL.so.1.0.0"
"${download_mesa_libgl_SOURCE_DIR}/libgallium_dri.so" "${download_mesa_libgl_SOURCE_DIR}/kms_swrast_dri.so"
"${download_mesa_libgl_SOURCE_DIR}/swrast_dri.so")
message(STATUS "MESA_CPU_GL_LIBRARY: ${MESA_CPU_GL_LIBRARY}")
endif()

# RPC interface
# zeromq
if(USE_SYSTEM_ZEROMQ)
Expand Down
62 changes: 0 additions & 62 deletions 3rdparty/mesa/build-mesa-cpu.sh

This file was deleted.

78 changes: 0 additions & 78 deletions cmake/Open3DMakeCudaArchitectures.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions cpp/pybind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ set_target_properties(pybind PROPERTIES
# libc++.so is a linker script including libc++.so.1 and libc++abi.so, so append 1 to libc++.so
set(PYTHON_EXTRA_LIBRARIES "")
if (BUILD_GUI AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND PYTHON_EXTRA_LIBRARIES ${CPP_LIBRARY}.1 ${CPPABI_LIBRARY}
${MESA_CPU_GL_LIBRARY})
list(APPEND PYTHON_EXTRA_LIBRARIES ${CPP_LIBRARY}.1 ${CPPABI_LIBRARY})
endif()
if (WITH_OPENMP AND APPLE AND NOT BUILD_SHARED_LIBS)
# Package libomp v11.1.0, if it is not installed. Later version cause crash on
Expand Down
33 changes: 1 addition & 32 deletions docs/tutorial/visualization/cpu_rendering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,23 @@ the :class: `.OffscreenRenderer` for a process by setting an environment
variable before importing Open3D::

- ``EGL_PLATFORM=surfaceless`` for Ubuntu 20.04+ (Mesa v20.2 or newer)
- ``OPEN3D_CPU_RENDERING=true`` for Ubuntu 18.04 (Mesa older than v20.2).

Here are the different ways to do that:

.. code:: bash
# from the command line (Ubuntu 20.04+)
EGL_PLATFORM=surfaceless python examples/python/visualization/render_to_image.py
# or Ubuntu 18.04
OPEN3D_CPU_RENDERING=true python examples/python/visualization/render_to_image.py
.. code:: python
# In Python code
import os
os.environ['EGL_PLATFORM'] = 'surfaceless' # Ubuntu 20.04+
os.environ['OPEN3D_CPU_RENDERING'] = 'true' # Ubuntu 18.04
import open3d as o3d
# In a Jupyter notebook
%env EGL_PLATFORM surfaceless # Ubuntu 20.04+
%env OPEN3D_CPU_RENDERING true # Ubuntu 18.04
import open3d as o3d
.. note:: Setting the environment variable after importing ``open3d`` will not work,
Expand Down Expand Up @@ -106,30 +101,4 @@ The method for enabling interactive CPU rendering depends on your system:
.. code:: bash
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
python examples/python/visualization/draw.py
3. **Your OS has old Mesa drivers (< v20.2).** We provide
the Mesa software rendering library binary for download `here
<https://github.com/isl-org/open3d_downloads/releases/download/mesa-libgl/mesa_libGL_22.0.tar.xz>`__.
This is automatically downloaded to
`build/_deps/download_mesa_libgl-src/libGL.so.1.5.0` when you build Open3D
from source. The prebuilt version works on Ubuntu 18.04 and Ubuntu 20.04. If
you want to use CPU rendering all the time, install this library to
``/usr/local/lib`` or ``$HOME/.local/lib`` and *prepend* it to your
``LD_LIBRARY_PATH``:

.. code:: bash
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
For occasional use, you can instead launch a program with CPU rendering with:

.. code:: bash
LD_PRELOAD=$HOME/.local/lib/libGL.so.1.5.0 Open3D
Or with Python code:

.. code:: bash
LD_PRELOAD=$HOME/.local/lib/libGL.so.1.5.0 python examples/python/visualization/draw.py
python examples/python/visualization/draw.py
7 changes: 0 additions & 7 deletions python/open3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ def load_cdll(path):
except StopIteration: # Not found: check system paths while loading
pass

# Enable CPU rendering based on env vars
if _build_config["BUILD_GUI"] and sys.platform.startswith("linux") and (
os.getenv("OPEN3D_CPU_RENDERING", default="") == "true"):
os.environ["LIBGL_DRIVERS_PATH"] = str(Path(__file__).parent)
load_cdll(Path(__file__).parent / "libEGL.so.1")
load_cdll(Path(__file__).parent / "libGL.so.1")

__DEVICE_API__ = "cpu"
if _build_config["BUILD_CUDA_MODULE"]:
# Load CPU pybind dll gracefully without introducing new python variable.
Expand Down

0 comments on commit 7a6cff0

Please sign in to comment.