summaryrefslogtreecommitdiff
path: root/freedreno
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2014-02-28 10:02:59 -0500
committerRob Clark <robclark@freedesktop.org>2014-03-05 10:35:41 -0500
commitee8c9a1383d4a50871e146ade2fe15b25f3377d4 (patch)
tree2efbd28a6fa37bf6a5812a8fce9f264f6c39bbcb /freedreno
parentcd1996470aa62116183485c5a3bf5754d69e3457 (diff)
freedreno/kgsl: don't even bother trying CREATE_FD
Don't even bother trying DRM_KGSL_GEM_CREATE_FD. It hasn't worked since (afaict) 2.6.35 kernels. And in some cases seems to cause some problems. Instead just allocate a minimum size dummy object (just for purposes of having a handle) and then mmap the framebuffer as user-mem (which is deprecated, but seems to still work.. and as far as I can tell is the best option for now). Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno')
-rw-r--r--freedreno/kgsl/kgsl_bo.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c
index dd7b612d..19a10087 100644
--- a/freedreno/kgsl/kgsl_bo.c
+++ b/freedreno/kgsl/kgsl_bo.c
@@ -174,28 +174,18 @@ struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev,
struct fd_bo * fd_bo_from_fbdev(struct fd_pipe *pipe,
int fbfd, uint32_t size)
{
- struct drm_kgsl_gem_create_fd req = {
- .fd = fbfd,
- };
struct fd_bo *bo;
- struct kgsl_bo *kgsl_bo;
if (!is_kgsl_pipe(pipe))
return NULL;
- if (drmCommandWriteRead(pipe->dev->fd, DRM_KGSL_GEM_CREATE_FD,
- &req, sizeof(req))) {
- return NULL;
- }
-
- bo = fd_bo_from_handle(pipe->dev, req.handle, size);
- kgsl_bo = to_kgsl_bo(bo);
+ bo = fd_bo_new(pipe->dev, 1, 0);
/* this is fugly, but works around a bug in the kernel..
* priv->memdesc.size never gets set, so getbufinfo ioctl
* thinks the buffer hasn't be allocate and fails
*/
- if (bo && !kgsl_bo_gpuaddr(kgsl_bo, 0)) {
+ if (bo) {
void *fbmem = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED, fbfd, 0);
struct kgsl_map_user_mem req = {
@@ -204,7 +194,9 @@ struct fd_bo * fd_bo_from_fbdev(struct fd_pipe *pipe,
.offset = 0,
.hostptr = (unsigned long)fbmem,
};
+ struct kgsl_bo *kgsl_bo = to_kgsl_bo(bo);
int ret;
+
ret = ioctl(to_kgsl_pipe(pipe)->fd, IOCTL_KGSL_MAP_USER_MEM, &req);
if (ret) {
ERROR_MSG("mapping user mem failed: %s",