summaryrefslogtreecommitdiff
path: root/freedreno/freedreno_bo.c
AgeCommit message (Collapse)Author
2015-07-16freedreno: zero is a valid fd number, treat it as suchEmil Velikov
Abeit quite unlikely to get hit by this bug here, let just fix it. v2: Correct conditional (do not call ioctl(DRM_IOCTL_PRIME_HANDLE_TO_FD) when we already have the fd). v3: Fix kgsl_pipe.c, suggested by Thierry. Cc: freedreno@lists.freedesktop.org Cc: Rob Clark <robdclark@gmail.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
2015-04-28drm: remove drm_public macroEmil Velikov
Some compilers (like the Oracle Studio), require that the function declaration must be annotated with the same visibility attribute as the definition. As annotating functions with drm_public is no longer required just remove the macro. Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Damien Lespiau <damien.lespiau@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com> Cc: Michel Dänzer <michel.daenzer@amd.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Thierry Reding <treding@nvidia.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-04-28freedreno: annotate the private symbolsEmil Velikov
They are less and easier to track than the public ones. The macro drm_public will be going away by the end of the series. Cc: Rob Clark <robdclark@gmail.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-18freedreno: do handle lookup on handle and dmabuf importRob Clark
We also need to check handle_table in the _from_handle() path and the _from_dmabuf() (which goes through _from_handle()) to avoid duplicate imports. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-28fix compile error on 32bit systemsRob Clark
4c2766b (drm_mmap/drm_unmap) brought this error for every .c file that was not #including config.h: In file included from private.h:4:0, from abi16.c:29: ../libdrm.h: In function 'drm_munmap': ../libdrm.h:81:4: error: size of unnamed array is negative Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-09-28freedreno: use drm_mmap/drm_munmap wrappersEmil Velikov
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-09-21freedreno: add dmabuf import/export helpersRob Clark
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-08-14freedreno: Use symbol visibility.Maarten Lankhorst
Hiding fd_device_del_locked, and fd_cleanup_bo_cache. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2013-12-13freedreno: add bo cacheRob Clark
Workloads which create many transient buffers cause significant CPU overhead in buffer allocation, zeroing, cache maint, and mmap setup. By caching and re-using existing buffers, the CPU overhead drops significantly. See: http://bloggingthemonkey.blogspot.com/2013/09/freedreno-update-moar-fps.html A simple time based policy is used for purging the cache. Once the kernel supports it, we could use madvise style API to handle memory pressure scenarios a bit better. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-08-28freedreno: support either kgsl or msmRob Clark
Split out common code and backend. Current backend is for 'kgsl' android driver, but a new backend will provide support for the upstream msm drm/kms driver. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-05-17freedreno: also remove from name table on bo deleteRob Clark
When adding the name tracking, I missed removing from the name table when the bo was deleted, leaving a dangling pointer. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-05-15freedreno: add handle and name trackingRob Clark
Due to the evil userspace buffer tracking we have to do, and hacks for creating GEM buffer from fbdev/scanout, "evil-twin" fd_bo objects are problematic. So introduce hashtable tracking of bo's and dev's, to avoid getting duplicate fd_bo ptrs for the same underlying gem object, in particular when importing via flink name. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-04-25freedreno: add synchronization between mesa and ddxRob Clark
Super-cheezy way to synchronization between mesa and ddx.. the SET_ACTIVE ioctl gives us a way to stash a 32b # w/ a GEM bo, and GET_BUFINFO gives us a way to retrieve it. We use this to stash the timestamp of the last ISSUEIBCMDS on the buffer. To avoid an obscene amount of syscalls, we: 1) Only set the timestamp for buffers w/ an flink name, ie. only buffers shared across processes. This is enough to catch the DRI2 buffers. 2) Only set the timestamp for buffers submitted to the 3d ring and only check the timestamps on buffers submitted to the 2d ring. This should be enough to handle synchronizing of presentation blit. We could do synchronization in the other direction too, but that would be problematic if we are using the 3d ring from DDX, since client side wouldn't know this. The waiting on timestamp happens before flush, and setting of timestamp happens after flush. It is transparent to the user of libdrm_freedreno as all the tracking of buffers happens via _emit_reloc().. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-02-14freedreno: add freedreno DRMRob Clark
The libdrm_freedreno helper layer for use by xf86-video-freedreno, fdre (freedreno r/e library and tests for driving gpu), and eventual gallium driver for the Adreno GPU. This uses the msm gpu driver from QCOM's android kernel tree. Note that current msm kernel driver is a bit strange. It provides a DRM interface for GEM, which is basically sufficient to have DRI2 working. But it does not provide KMS. And interface to 2d and 3d cores is via different other devices (/dev/kgsl-*). This is not quite how I'd write a DRM driver, but at this stage it is useful for xf86-video-freedreno and fdre (and eventual gallium driver) to be able to work on existing kernel driver from QCOM, to allow to capture cmdstream dumps from the binary blob drivers without having to reboot. So libdrm_freedreno attempts to hide most of the crazy. The intention is that when there is a proper kernel driver, it will be mostly just changes in libdrm_freedreno to adapt the gallium driver and xf86-video-freedreno (ignoring the fbdev->KMS changes). So don't look at freedreno as an example of how to write a libdrm module or a DRM driver.. it is just an attempt to paper over a non- standard kernel driver architecture. v1: original v2: hold ref's to pending bo's (because qcom's kernel driver doesn't), various bug fixes, add ringbuffer markers so we can emit IB's to portion of ringbuffer (so that gallium driver can use a single ringbuffer for both tile cmds and draw cmds. Signed-off-by: Rob Clark <robclark@freedesktop.org>