summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/pl111/Android.mk38
-rw-r--r--src/gallium/drivers/pl111/Automake.inc9
-rw-r--r--src/gallium/drivers/pl111/Makefile.am8
-rw-r--r--src/gallium/drivers/pl111/Makefile.sources2
-rw-r--r--src/gallium/drivers/vc4/vc4_resource.c38
-rw-r--r--src/gallium/drivers/vc4/vc4_resource.h1
-rw-r--r--src/gallium/drivers/vc4/vc4_screen.c12
-rw-r--r--src/gallium/drivers/vc4/vc4_screen.h5
8 files changed, 111 insertions, 2 deletions
diff --git a/src/gallium/drivers/pl111/Android.mk b/src/gallium/drivers/pl111/Android.mk
new file mode 100644
index 00000000000..0b00b4e9ce0
--- /dev/null
+++ b/src/gallium/drivers/pl111/Android.mk
@@ -0,0 +1,38 @@
+# Copyright (C) 2014 Emil Velikov <[email protected]>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+# get C_SOURCES
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ $(C_SOURCES)
+
+LOCAL_MODULE := libmesa_pipe_pl111
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+ifneq ($(HAVE_GALLIUM_PL111),)
+$(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_pl111)
+endif
diff --git a/src/gallium/drivers/pl111/Automake.inc b/src/gallium/drivers/pl111/Automake.inc
new file mode 100644
index 00000000000..4ecd7dec988
--- /dev/null
+++ b/src/gallium/drivers/pl111/Automake.inc
@@ -0,0 +1,9 @@
+if HAVE_GALLIUM_PL111
+
+TARGET_DRIVERS += pl111
+TARGET_CPPFLAGS += -DGALLIUM_PL111
+TARGET_LIB_DEPS += \
+ $(top_builddir)/src/gallium/winsys/pl111/drm/libpl111drm.la \
+ $(LIBDRM_LIBS)
+
+endif
diff --git a/src/gallium/drivers/pl111/Makefile.am b/src/gallium/drivers/pl111/Makefile.am
new file mode 100644
index 00000000000..b3e95eeff44
--- /dev/null
+++ b/src/gallium/drivers/pl111/Makefile.am
@@ -0,0 +1,8 @@
+include $(top_srcdir)/src/gallium/Automake.inc
+
+AM_CPPFLAGS = \
+ $(GALLIUM_CFLAGS)
+
+noinst_LTLIBRARIES = libpl111.la
+
+libpl111_la_SOURCES = $(C_SOURCES)
diff --git a/src/gallium/drivers/pl111/Makefile.sources b/src/gallium/drivers/pl111/Makefile.sources
new file mode 100644
index 00000000000..20396753fdb
--- /dev/null
+++ b/src/gallium/drivers/pl111/Makefile.sources
@@ -0,0 +1,2 @@
+C_SOURCES :=
+
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index db7faf7ce3b..5aaa31d6e67 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -371,9 +371,14 @@ static void
vc4_resource_destroy(struct pipe_screen *pscreen,
struct pipe_resource *prsc)
{
+ struct vc4_screen *screen = vc4_screen(pscreen);
struct vc4_resource *rsc = vc4_resource(prsc);
pipe_resource_reference(&rsc->shadow_parent, NULL);
vc4_bo_unreference(&rsc->bo);
+
+ if (rsc->scanout)
+ renderonly_scanout_destroy(rsc->scanout, screen->ro);
+
free(rsc);
}
@@ -384,6 +389,7 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
struct winsys_handle *whandle,
unsigned usage)
{
+ struct vc4_screen *screen = vc4_screen(pscreen);
struct vc4_resource *rsc = vc4_resource(prsc);
whandle->stride = rsc->slices[0].stride;
@@ -396,11 +402,23 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
switch (whandle->type) {
case DRM_API_HANDLE_TYPE_SHARED:
+ if (screen->ro) {
+ /* This could probably be supported, assuming that a
+ * control node was used for pl111.
+ */
+ fprintf(stderr, "flink unsupported with pl111\n");
+ return FALSE;
+ }
+
return vc4_bo_flink(rsc->bo, &whandle->handle);
case DRM_API_HANDLE_TYPE_KMS:
+ if (screen->ro && renderonly_get_handle(rsc->scanout, whandle))
+ return TRUE;
whandle->handle = rsc->bo->handle;
return TRUE;
case DRM_API_HANDLE_TYPE_FD:
+ /* FDs are cross-device, so we can export directly from vc4.
+ */
whandle->handle = vc4_bo_get_dmabuf(rsc->bo);
return whandle->handle != -1;
}
@@ -553,6 +571,7 @@ struct pipe_resource *
vc4_resource_create(struct pipe_screen *pscreen,
const struct pipe_resource *tmpl)
{
+ struct vc4_screen *screen = vc4_screen(pscreen);
struct vc4_resource *rsc = vc4_resource_setup(pscreen, tmpl);
struct pipe_resource *prsc = &rsc->base;
@@ -577,6 +596,13 @@ vc4_resource_create(struct pipe_screen *pscreen,
if (!vc4_resource_bo_alloc(rsc))
goto fail;
+ if (screen->ro && tmpl->bind & PIPE_BIND_SCANOUT) {
+ rsc->scanout =
+ renderonly_scanout_for_resource(prsc, screen->ro);
+ if (!rsc->scanout)
+ goto fail;
+ }
+
return prsc;
fail:
vc4_resource_destroy(pscreen, prsc);
@@ -646,6 +672,18 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
rsc->vc4_format = get_resource_texture_format(prsc);
+ if (screen->ro) {
+ /* Make sure that renderonly has a handle to our buffer in the
+ * display's fd, so that a later renderonly_get_handle()
+ * returns correct handles or GEM names.
+ */
+ rsc->scanout =
+ renderonly_create_gpu_import_for_resource(prsc,
+ screen->ro);
+ if (!rsc->scanout)
+ goto fail;
+ }
+
if (miptree_debug) {
fprintf(stderr,
"rsc import %p (format %d), %dx%d: "
diff --git a/src/gallium/drivers/vc4/vc4_resource.h b/src/gallium/drivers/vc4/vc4_resource.h
index 877db513ace..32e73dddb34 100644
--- a/src/gallium/drivers/vc4/vc4_resource.h
+++ b/src/gallium/drivers/vc4/vc4_resource.h
@@ -54,6 +54,7 @@ struct vc4_surface {
struct vc4_resource {
struct pipe_resource base;
struct vc4_bo *bo;
+ struct renderonly_scanout *scanout;
struct vc4_resource_slice slices[VC4_MAX_MIP_LEVELS];
uint32_t cube_map_stride;
int cpp;
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index b87aaf73f94..6b35abb10eb 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -100,6 +100,7 @@ vc4_screen_destroy(struct pipe_screen *pscreen)
util_hash_table_destroy(screen->bo_handles);
vc4_bufmgr_destroy(pscreen);
slab_destroy_parent(&screen->transfer_pool);
+ free(screen->ro);
#if USE_VC4_SIMULATOR
vc4_simulator_destroy(screen);
@@ -605,7 +606,7 @@ vc4_get_chip_info(struct vc4_screen *screen)
}
struct pipe_screen *
-vc4_screen_create(int fd)
+vc4_screen_create(int fd, struct renderonly *ro)
{
struct vc4_screen *screen = rzalloc(NULL, struct vc4_screen);
struct pipe_screen *pscreen;
@@ -620,6 +621,15 @@ vc4_screen_create(int fd)
pscreen->is_format_supported = vc4_screen_is_format_supported;
screen->fd = fd;
+ if (ro) {
+ screen->ro = renderonly_dup(ro);
+ if (!screen->ro) {
+ fprintf(stderr, "Failed to dup renderonly object\n");
+ ralloc_free(screen);
+ return NULL;
+ }
+ }
+
list_inithead(&screen->bo_cache.time_list);
(void) mtx_init(&screen->bo_handles_mutex, mtx_plain);
screen->bo_handles = util_hash_table_create(handle_hash, handle_compare);
diff --git a/src/gallium/drivers/vc4/vc4_screen.h b/src/gallium/drivers/vc4/vc4_screen.h
index 0f80ffb3463..295633db469 100644
--- a/src/gallium/drivers/vc4/vc4_screen.h
+++ b/src/gallium/drivers/vc4/vc4_screen.h
@@ -25,6 +25,7 @@
#define VC4_SCREEN_H
#include "pipe/p_screen.h"
+#include "renderonly/renderonly.h"
#include "os/os_thread.h"
#include "state_tracker/drm_driver.h"
#include "util/list.h"
@@ -55,6 +56,8 @@ struct vc4_simulator_file;
struct vc4_screen {
struct pipe_screen base;
+ struct renderonly *ro;
+
int fd;
int v3d_ver;
@@ -101,7 +104,7 @@ vc4_screen(struct pipe_screen *screen)
return (struct vc4_screen *)screen;
}
-struct pipe_screen *vc4_screen_create(int fd);
+struct pipe_screen *vc4_screen_create(int fd, struct renderonly *ro);
const void *
vc4_screen_get_compiler_options(struct pipe_screen *pscreen,