|
@@ -15,6 +15,8 @@
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+#include <linux/sync_file.h>
|
|
|
|
+
|
|
#include "msm_drv.h"
|
|
#include "msm_drv.h"
|
|
#include "msm_gpu.h"
|
|
#include "msm_gpu.h"
|
|
#include "msm_gem.h"
|
|
#include "msm_gem.h"
|
|
@@ -361,6 +363,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|
struct msm_file_private *ctx = file->driver_priv;
|
|
struct msm_file_private *ctx = file->driver_priv;
|
|
struct msm_gem_submit *submit;
|
|
struct msm_gem_submit *submit;
|
|
struct msm_gpu *gpu = priv->gpu;
|
|
struct msm_gpu *gpu = priv->gpu;
|
|
|
|
+ struct fence *in_fence = NULL;
|
|
unsigned i;
|
|
unsigned i;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
@@ -394,9 +397,32 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|
if (ret)
|
|
if (ret)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
- ret = submit_fence_sync(submit);
|
|
|
|
- if (ret)
|
|
|
|
- goto out;
|
|
|
|
|
|
+ if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
|
|
|
|
+ in_fence = sync_file_get_fence(args->fence_fd);
|
|
|
|
+
|
|
|
|
+ if (!in_fence) {
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* TODO if we get an array-fence due to userspace merging multiple
|
|
|
|
+ * fences, we need a way to determine if all the backing fences
|
|
|
|
+ * are from our own context..
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ if (in_fence->context != gpu->fctx->context) {
|
|
|
|
+ ret = fence_wait(in_fence, true);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!(args->fence & MSM_SUBMIT_NO_IMPLICIT)) {
|
|
|
|
+ ret = submit_fence_sync(submit);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
|
|
ret = submit_pin_objects(submit);
|
|
ret = submit_pin_objects(submit);
|
|
if (ret)
|
|
if (ret)
|
|
@@ -467,6 +493,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|
args->fence = submit->fence->seqno;
|
|
args->fence = submit->fence->seqno;
|
|
|
|
|
|
out:
|
|
out:
|
|
|
|
+ if (in_fence)
|
|
|
|
+ fence_put(in_fence);
|
|
submit_cleanup(submit);
|
|
submit_cleanup(submit);
|
|
if (ret)
|
|
if (ret)
|
|
msm_gem_submit_free(submit);
|
|
msm_gem_submit_free(submit);
|