Commit Graph

9 Commits

Author SHA1 Message Date
Lyude Paul 186a21c4ba glamor: Unbreak glamor_fd_from_pixmap()
When support for allocating GBM BOs with modifiers was added,
glamor_fd_from_pixmap() was changed so that it would return an error if
it got a bo with modifiers set from glamor_fds_from_pixmap(). The
problem is that on systems that support BOs with modifiers,
glamor_fds_from_pixmap() will always return BOs with modifiers.

This means that glamor_fd_from_pixmap() was broken entirely, which broke
a number of other things including glamor_shareable_fd_from_pixmap(),
which meant that modesetting using multiple GPUs with the modesetting
DDX was also broken. Easy reproducer:

- Find a laptop with DRI prime that has outputs connected to the
  dedicated GPU and integrated GPU
- Try to enable one display on each using the modesetting DDX
- Fail

Since there isn't a way to ask for no modifiers from
glamor_fds_from_pixmap, we create a shared _glamor_fds_from_pixmap()
function used by both glamor_fds_from_pixmap() and
glamor_fd_from_pixmap() that calls down to the appropriate
glamor_egl_fd*_from_pixmap() function.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Fixes: c8c276c956 ("glamor: Implement PixmapFromBuffers and BuffersFromPixmap")
2018-06-27 15:07:56 -04:00
Louis-Francis Ratté-Boulianne c8c276c956 glamor: Implement PixmapFromBuffers and BuffersFromPixmap
It relies on GBM >= 17.1.0 where we can import BO with multiple
planes and a format modifier (GBM_BO_IMPORT_FD_MODIFIER).

v2: Properly free fds in Xwayland

[Also add glamor_egl_ext.h to Makefile.am for distcheck's sake - ajax]

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:27:49 -05:00
Eric Anholt 51984dddfc glamor: Delay making pixmaps shareable until we need to.
If a pixmap isn't getting exported as a dmabuf, then we don't need to
make an EGLImage/GBM bo for it.  This should reduce normal pixmap
allocation overhead, and also lets the driver choose non-scanout
formats which may be much higher performance.

On Raspberry Pi, where scanout isn't usable as a texture source, this
improves x11perf -copypixwin100 from about 4300/sec to 5780/sec under
xcompmgr -a, because we no longer need to upload our x11perf window to
a tiled temporary in order to render it to the screen.

v2: Just use pixmap->usage_hint instead of a new field.  Drop the
    changes that started storing gbm_bos in the pixmap priv due to
    lifetime issues.
v3: Fix a missing gbm_bo_destroy() on the pixmap-from-fd success path.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-18 10:04:44 -08:00
Eric Anholt ff2850424c glamor: Hook up EGL DestroyPixmap through the normal wrap chain.
One less layering violation (EGL should call glamor, if anything, not
the other way around).

v2: Move glamor.c's DestroyPixmap wrapping up above the
    glamor_egl_screen_init() call, since glamor.c's DestroyPixmap
    needs to be the bottom of the stack (it calls fb directly and
    doesn't wrap).  Caught by Michel.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-18 10:02:15 -08:00
Dave Airlie ea0e4d752b glamor: add support for allocating linear buffers (v2)
We need this for doing USB offload scenarios using glamor
and modesetting driver.

unfortunately only gbm in mesa 10.6 has support for the
linear API.

v1.1: fix bad define
v2: update the configure.ac test as per amdgpu. (Michel)
set linear bos to external to avoid cache. (Eric)

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-06-30 12:17:55 +10:00
Keith Packard 5064ffab63 glamor: Always destroy EGL image associated with destroyed pixmap
There were three paths that called eglDestroyImageKHR:

 * The front buffer
 * The intel driver's flip buffer
 * pixmaps under DRI3

This patch unifies the second two by having glamor_destroy_pixmap
always destroy any associaged EGL image. This allows us to stop
storing the back_pixmap pointer in glamor as that was only used to
make sure that buffer was freed at server reset time.

v2: check for valid pixmap_priv before using it in
glamor_egl_destroy_pixmap_image

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2014-12-09 08:46:45 -08:00
Kristian Høgsberg fe204185bc glamor: Move glamor_egl_screen_init() prototype to glamor.h
A DDX that implements the glamor EGL functions need to pull in this
prototype but shouldn't need to pull in glamor_priv.h

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-04-01 10:31:09 -07:00
Eric Anholt 4afe15d8bf glamor: Put in a pluggable context switcher for GLX versus EGL.
The GLX side just gets the context from the current state.  That's
also something I want to do for EGL, so that the making a context is
separate from initializing glamor, but I think I need the modesetting
driver in the server before I think about hacking on that more.

The previous code was rather incestuous, along with pulling in xf86
dependencies to our dix code.  The new code just initializes itself
from the current state.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-14 18:30:01 -08:00
Eric Anholt d26f533515 glamor: Hook the module back up to the build.
For now we're just building an uninstalled library.  The extra EGL
stubs are required so that we can get the DIX building and usable
without pulling in the xf86 DDX code in glamor_egl.c.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-01-27 09:30:47 -08:00