dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Packard <keithp@keithp.com>
To: mesa3d-dev@lists.sourceforge.net
Cc: dri-devel@lists.sourceforge.net
Subject: [PATCH 4/6] dri/intel: Add intel_fd_for_region
Date: Thu, 31 Oct 2013 16:13:14 -0700	[thread overview]
Message-ID: <1383261196-25093-5-git-send-email-keithp@keithp.com> (raw)
In-Reply-To: <1383261196-25093-1-git-send-email-keithp@keithp.com>

Returns a prime file descriptor for the specified region.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 src/mesa/drivers/dri/i915/intel_regions.c | 13 +++++++++++++
 src/mesa/drivers/dri/i915/intel_regions.h |  4 ++++
 src/mesa/drivers/dri/i965/intel_regions.c | 13 +++++++++++++
 src/mesa/drivers/dri/i965/intel_regions.h |  4 ++++
 4 files changed, 34 insertions(+)

diff --git a/src/mesa/drivers/dri/i915/intel_regions.c b/src/mesa/drivers/dri/i915/intel_regions.c
index 9f5b89e..bac997d 100644
--- a/src/mesa/drivers/dri/i915/intel_regions.c
+++ b/src/mesa/drivers/dri/i915/intel_regions.c
@@ -238,6 +238,19 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
    return region;
 }
 
+int
+intel_fd_for_region(struct intel_screen *screen,
+                    struct intel_region *region)
+{
+   int  fd;
+   int  ret;
+
+   ret = drm_intel_bo_gem_export_to_prime(region->bo, &fd);
+   if (ret < 0)
+      return ret;
+   return fd;
+}
+
 void
 intel_region_reference(struct intel_region **dst, struct intel_region *src)
 {
diff --git a/src/mesa/drivers/dri/i915/intel_regions.h b/src/mesa/drivers/dri/i915/intel_regions.h
index 6bc4a42..84c013a 100644
--- a/src/mesa/drivers/dri/i915/intel_regions.h
+++ b/src/mesa/drivers/dri/i915/intel_regions.h
@@ -93,6 +93,10 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
                           GLuint width, GLuint height, GLuint pitch,
                           GLuint size, int fd, const char *name);
 
+int
+intel_fd_for_region(struct intel_screen *screen,
+                    struct intel_region *region);
+
 bool
 intel_region_flink(struct intel_region *region, uint32_t *name);
 
diff --git a/src/mesa/drivers/dri/i965/intel_regions.c b/src/mesa/drivers/dri/i965/intel_regions.c
index 3920f4f..2e70326 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.c
+++ b/src/mesa/drivers/dri/i965/intel_regions.c
@@ -238,6 +238,19 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
    return region;
 }
 
+int
+intel_fd_for_region(struct intel_screen *screen,
+                    struct intel_region *region)
+{
+   int  fd;
+   int  ret;
+
+   ret = drm_intel_bo_gem_export_to_prime(region->bo, &fd);
+   if (ret < 0)
+      return ret;
+   return fd;
+}
+
 void
 intel_region_reference(struct intel_region **dst, struct intel_region *src)
 {
diff --git a/src/mesa/drivers/dri/i965/intel_regions.h b/src/mesa/drivers/dri/i965/intel_regions.h
index 05dfef3..f471b94 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.h
+++ b/src/mesa/drivers/dri/i965/intel_regions.h
@@ -95,6 +95,10 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
                           GLuint size,
                           int fd, const char *name);
 
+int
+intel_fd_for_region(struct intel_screen *screen,
+                    struct intel_region *region);
+
 bool
 intel_region_flink(struct intel_region *region, uint32_t *name);
 
-- 
1.8.4.2


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

  parent reply	other threads:[~2013-10-31 23:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 23:13 [PATCH 0/6] Add DRI3000 support to core and i965 drivers Keith Packard
2013-10-31 23:13 ` [PATCH 1/6] drivers/dri/common: A few dri2 functions are not actually DRI2 specific Keith Packard
2013-11-01 17:48   ` Kristian Høgsberg
2013-10-31 23:13 ` [PATCH 2/6] dri/intel: Split out DRI2 buffer update code to separate function Keith Packard
2013-11-01 17:51   ` Kristian Høgsberg
2013-10-31 23:13 ` Keith Packard [this message]
2013-11-01 17:58   ` [PATCH 4/6] dri/intel: Add intel_fd_for_region Kristian Høgsberg
2013-10-31 23:13 ` [PATCH 5/6] dri3: Add DRI3 support to GLX, DRI common and Intel driver Keith Packard
2013-11-01 23:48   ` Kristian Høgsberg
2013-11-02  5:31   ` Kristian Høgsberg
2013-11-03 22:35     ` Keith Packard
2013-11-04 21:00       ` [Mesa-dev] " Ian Romanick
2013-10-31 23:13 ` [PATCH 6/6] Make GLX/dri3 use the Present extension when available Keith Packard
2013-10-31 23:13 ` Keith Packard
     [not found] ` <1383261196-25093-4-git-send-email-keithp@keithp.com>
2013-11-04 21:38   ` [Mesa3d-dev] [PATCH 3/6] dri/intel: Add explicit size parameter to intel_region_alloc_for_fd Ian Romanick
2013-11-04 21:38   ` Ian Romanick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383261196-25093-5-git-send-email-keithp@keithp.com \
    --to=keithp@keithp.com \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=mesa3d-dev@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox