diff options
author | Rob Herring <[email protected]> | 2019-01-23 16:08:08 -0600 |
---|---|---|
committer | Rob Herring <[email protected]> | 2019-01-28 11:45:43 -0600 |
commit | 827e0d6654a2dba0c2090abde84ccef8c8d8ec7e (patch) | |
tree | 195d0827403f9833dae0c68a14c4f25e65dd4a60 /src/gallium/winsys/kmsro | |
parent | 272b6cf58f507180b2ff3059bec16d8f023f5f40 (diff) |
kmsro: Add etnaviv renderonly support
Enable using etnaviv for KMS renderonly. This still needs KMS driver
name mapping to kmsro to be used automatically.
Acked-by: Eric Anholt <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Diffstat (limited to 'src/gallium/winsys/kmsro')
-rw-r--r-- | src/gallium/winsys/kmsro/drm/Makefile.am | 8 | ||||
-rw-r--r-- | src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c | 36 | ||||
-rw-r--r-- | src/gallium/winsys/kmsro/drm/meson.build | 11 |
3 files changed, 44 insertions, 11 deletions
diff --git a/src/gallium/winsys/kmsro/drm/Makefile.am b/src/gallium/winsys/kmsro/drm/Makefile.am index ad471d31d4f..0092206539c 100644 --- a/src/gallium/winsys/kmsro/drm/Makefile.am +++ b/src/gallium/winsys/kmsro/drm/Makefile.am @@ -29,6 +29,14 @@ AM_CFLAGS = \ $(GALLIUM_WINSYS_CFLAGS) \ $(LIBDRM_CFLAGS) +if HAVE_GALLIUM_ETNAVIV +AM_CFLAGS += -DGALLIUM_ETNAVIV +endif + +if HAVE_GALLIUM_VC4 +AM_CFLAGS += -DGALLIUM_VC4 +endif + noinst_LTLIBRARIES = libkmsrodrm.la libkmsrodrm_la_SOURCES = $(C_SOURCES) diff --git a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c index 4448150cc0c..e086c0858f0 100644 --- a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c +++ b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c @@ -27,6 +27,7 @@ #include "kmsro_drm_public.h" #include "vc4/drm/vc4_drm_public.h" +#include "etnaviv/drm/etnaviv_drm_public.h" #include "xf86drm.h" #include "pipe/p_screen.h" @@ -34,22 +35,39 @@ struct pipe_screen *kmsro_drm_screen_create(int fd) { + struct pipe_screen *screen = NULL; struct renderonly ro = { + .kms_fd = fd, + .gpu_fd = -1, + }; + +#if defined(GALLIUM_VC4) + ro.gpu_fd = drmOpenWithType("vc4", NULL, DRM_NODE_RENDER); + if (ro.gpu_fd >= 0) { /* Passes the vc4-allocated BO through to the KMS-only DRM device using * PRIME buffer sharing. The VC4 BO must be linear, which the SCANOUT * flag on allocation will have ensured. */ - .create_for_resource = renderonly_create_gpu_import_for_resource, - .kms_fd = fd, - .gpu_fd = drmOpenWithType("vc4", NULL, DRM_NODE_RENDER), - }; + ro.create_for_resource = renderonly_create_gpu_import_for_resource, + screen = vc4_drm_screen_create_renderonly(&ro); + if (!screen) + close(ro.gpu_fd); + + return screen; + } +#endif - if (ro.gpu_fd < 0) - return NULL; +#if defined(GALLIUM_ETNAVIV) + ro.gpu_fd = drmOpenWithType("etnaviv", NULL, DRM_NODE_RENDER); + if (ro.gpu_fd >= 0) { + ro.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource, + screen = etna_drm_screen_create_renderonly(&ro); + if (!screen) + close(ro.gpu_fd); - struct pipe_screen *screen = vc4_drm_screen_create_renderonly(&ro); - if (!screen) - close(ro.gpu_fd); + return screen; + } +#endif return screen; } diff --git a/src/gallium/winsys/kmsro/drm/meson.build b/src/gallium/winsys/kmsro/drm/meson.build index f157982d728..e8c350e081b 100644 --- a/src/gallium/winsys/kmsro/drm/meson.build +++ b/src/gallium/winsys/kmsro/drm/meson.build @@ -18,6 +18,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +kmsro_c_args = [] +if with_gallium_etnaviv + kmsro_c_args += '-DGALLIUM_ETNAVIV' +endif +if with_gallium_vc4 + kmsro_c_args += '-DGALLIUM_VC4' +endif + libkmsrowinsys = static_library( 'kmsrowinsys', files('kmsro_drm_winsys.c'), @@ -25,9 +33,8 @@ libkmsrowinsys = static_library( inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_gallium_winsys, ], - c_args : [c_vis_args], + c_args : [c_vis_args, kmsro_c_args], dependencies: dep_libdrm, - link_with : libvc4winsys, ) driver_kmsro = declare_dependency( |