[Mesa-dev] [PATCHv2 7/9] drisw: learn to query shmid handle type
Marc-André Lureau
marcandre.lureau at gmail.com
Mon Jun 15 06:34:13 PDT 2015
---
src/gallium/include/state_tracker/drisw_api.h | 1 +
src/gallium/include/state_tracker/sw_winsys.h | 3 +--
src/gallium/include/state_tracker/winsys_handle.h | 1 +
src/gallium/winsys/sw/dri/dri_sw_winsys.c | 10 +++++++++-
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/gallium/include/state_tracker/drisw_api.h b/src/gallium/include/state_tracker/drisw_api.h
index 010a603..8f4ec93 100644
--- a/src/gallium/include/state_tracker/drisw_api.h
+++ b/src/gallium/include/state_tracker/drisw_api.h
@@ -2,6 +2,7 @@
#define _DRISW_API_H_
#include "pipe/p_compiler.h"
+#include "sw_winsys.h"
struct pipe_screen;
struct dri_drawable;
diff --git a/src/gallium/include/state_tracker/sw_winsys.h b/src/gallium/include/state_tracker/sw_winsys.h
index a3479eb..7e909f2 100644
--- a/src/gallium/include/state_tracker/sw_winsys.h
+++ b/src/gallium/include/state_tracker/sw_winsys.h
@@ -37,14 +37,13 @@
#include "pipe/p_compiler.h" /* for boolean */
#include "pipe/p_format.h"
-
+#include "state_tracker/winsys_handle.h"
#ifdef __cplusplus
extern "C" {
#endif
-struct winsys_handle;
struct pipe_screen;
struct pipe_context;
struct pipe_resource;
diff --git a/src/gallium/include/state_tracker/winsys_handle.h b/src/gallium/include/state_tracker/winsys_handle.h
index 55537ef..b1c046b 100644
--- a/src/gallium/include/state_tracker/winsys_handle.h
+++ b/src/gallium/include/state_tracker/winsys_handle.h
@@ -9,6 +9,7 @@ extern "C" {
#define WINSYS_HANDLE_TYPE_SHARED 0
#define WINSYS_HANDLE_TYPE_KMS 1
#define WINSYS_HANDLE_TYPE_FD 2
+#define WINSYS_HANDLE_TYPE_SHMID 3
/**
* For use with pipe_screen::{texture_from_handle|texture_get_handle}.
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index 38c47b1..076c8c0 100644
--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -194,7 +194,15 @@ dri_sw_displaytarget_get_handle(struct sw_winsys *winsys,
struct sw_displaytarget *dt,
struct winsys_handle *whandle)
{
- assert(0);
+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+
+ if (whandle->type == WINSYS_HANDLE_TYPE_SHMID) {
+ if (dri_sw_dt->shmid < 0)
+ return FALSE;
+ whandle->handle = dri_sw_dt->shmid;
+ return TRUE;
+ }
+
return FALSE;
}
--
2.4.2
More information about the mesa-dev
mailing list