本文整理汇总了C++中drmCommandWriteRead函数的典型用法代码示例。如果您正苦于以下问题:C++ drmCommandWriteRead函数的具体用法?C++ drmCommandWriteRead怎么用?C++ drmCommandWriteRead使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drmCommandWriteRead函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: radeon_get_drm_value
static boolean radeon_get_drm_value(int fd, unsigned request,
const char *errname, uint32_t *out)
{
struct drm_radeon_info info;
int retval;
memset(&info, 0, sizeof(info));
info.value = (unsigned long)out;
info.request = request;
retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (retval) {
if (errname) {
fprintf(stderr, "radeon: Failed to get %s, error number %d\n",
errname, retval);
}
return FALSE;
}
return TRUE;
}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:21,代码来源:radeon_drm_winsys.c
示例2: vmw_ioctl_fence_signalled
int
vmw_ioctl_fence_signalled(struct vmw_winsys_screen *vws,
uint32_t handle,
uint32_t flags)
{
struct drm_vmw_fence_signaled_arg arg;
uint32_t vflags = vmw_drm_fence_flags(flags);
int ret;
memset(&arg, 0, sizeof(arg));
arg.handle = handle;
arg.flags = vflags;
ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_FENCE_SIGNALED,
&arg, sizeof(arg));
if (ret != 0)
return ret;
return (arg.signaled) ? 0 : -1;
}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:21,代码来源:vmw_screen_ioctl.c
示例3: drm_vc4_bo_set_flags
int drm_vc4_bo_set_flags(struct drm_vc4_bo *bo, uint32_t flags)
{
#if 0
struct drm_vc4_gem_get_flags args;
struct drm_vc4 *drm = bo->drm;
int err;
if (!bo)
return -EINVAL;
memset(&args, 0, sizeof(args));
args.handle = bo->handle;
args.flags = flags;
err = drmCommandWriteRead(drm->fd, DRM_VC4_GEM_SET_FLAGS, &args,
sizeof(args));
if (err < 0)
return -errno;
#endif
return 0;
}
开发者ID:ED6E0F17,项目名称:libdrm,代码行数:21,代码来源:vc4.c
示例4: amdgpu_cs_ctx_free
/**
* Release command submission context
*
* \param dev - \c [in] amdgpu device handle
* \param context - \c [in] amdgpu context handle
*
* \return 0 on success otherwise POSIX Error code
*/
int amdgpu_cs_ctx_free(amdgpu_context_handle context)
{
union drm_amdgpu_ctx args;
int r;
if (NULL == context)
return -EINVAL;
pthread_mutex_destroy(&context->sequence_mutex);
/* now deal with kernel side */
memset(&args, 0, sizeof(args));
args.in.op = AMDGPU_CTX_OP_FREE_CTX;
args.in.ctx_id = context->id;
r = drmCommandWriteRead(context->dev->fd, DRM_AMDGPU_CTX,
&args, sizeof(args));
free(context);
return r;
}
开发者ID:janesma,项目名称:drm,代码行数:29,代码来源:amdgpu_cs.c
示例5: pscnv_gem_info
int pscnv_gem_info(int fd, uint32_t handle, uint32_t *cookie, uint32_t *flags, uint32_t *tile_flags, uint64_t *size, uint64_t *map_handle, uint32_t *user) {
int ret;
struct drm_pscnv_gem_info req;
req.handle = handle;
ret = drmCommandWriteRead(fd, DRM_PSCNV_GEM_INFO, &req, sizeof(req));
if (ret)
return ret;
if (cookie)
*cookie = req.cookie;
if (flags)
*flags = req.flags;
if (tile_flags)
*tile_flags = req.tile_flags;
if (size)
*size = req.size;
if (map_handle)
*map_handle = req.map_handle;
if (user)
memcpy(user, req.user, sizeof(req.user));
return 0;
}
开发者ID:Advael,项目名称:pscnv,代码行数:21,代码来源:libpscnv.c
示例6: amdgpu_bo_list_update
int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
uint32_t number_of_resources,
amdgpu_bo_handle *resources,
uint8_t *resource_prios)
{
struct drm_amdgpu_bo_list_entry *list;
union drm_amdgpu_bo_list args;
unsigned i;
int r;
if (!number_of_resources)
return -EINVAL;
/* overflow check for multiplication */
if (number_of_resources > UINT32_MAX / sizeof(struct drm_amdgpu_bo_list_entry))
return -EINVAL;
list = malloc(number_of_resources * sizeof(struct drm_amdgpu_bo_list_entry));
if (list == NULL)
return -ENOMEM;
args.in.operation = AMDGPU_BO_LIST_OP_UPDATE;
args.in.list_handle = handle->handle;
args.in.bo_number = number_of_resources;
args.in.bo_info_size = sizeof(struct drm_amdgpu_bo_list_entry);
args.in.bo_info_ptr = (uintptr_t)list;
for (i = 0; i < number_of_resources; i++) {
list[i].bo_handle = resources[i]->handle;
if (resource_prios)
list[i].bo_priority = resource_prios[i];
else
list[i].bo_priority = 0;
}
r = drmCommandWriteRead(handle->dev->fd, DRM_AMDGPU_BO_LIST,
&args, sizeof(args));
free(list);
return r;
}
开发者ID:janesma,项目名称:drm,代码行数:40,代码来源:amdgpu_bo.c
示例7: drm_tegra_bo_set_tiling
int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
const struct drm_tegra_bo_tiling *tiling)
{
struct drm_tegra_gem_set_tiling args;
struct drm_tegra *drm = bo->drm;
int err;
if (!bo)
return -EINVAL;
memset(&args, 0, sizeof(args));
args.handle = bo->handle;
args.mode = tiling->mode;
args.value = tiling->value;
err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
sizeof(args));
if (err < 0)
return -errno;
return 0;
}
开发者ID:Distrotech,项目名称:libdrm,代码行数:22,代码来源:tegra.c
示例8: drm_tegra_bo_get_flags
int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
{
struct drm_tegra_gem_get_flags args;
struct drm_tegra *drm = bo->drm;
int err;
if (!bo)
return -EINVAL;
memset(&args, 0, sizeof(args));
args.handle = bo->handle;
err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
sizeof(args));
if (err < 0)
return -errno;
if (flags)
*flags = args.flags;
return 0;
}
开发者ID:Distrotech,项目名称:libdrm,代码行数:22,代码来源:tegra.c
示例9: amdgpu_bo_wait_for_idle
int amdgpu_bo_wait_for_idle(amdgpu_bo_handle bo,
uint64_t timeout_ns,
bool *busy)
{
union drm_amdgpu_gem_wait_idle args;
int r;
memset(&args, 0, sizeof(args));
args.in.handle = bo->handle;
args.in.timeout = amdgpu_cs_calculate_timeout(timeout_ns);
r = drmCommandWriteRead(bo->dev->fd, DRM_AMDGPU_GEM_WAIT_IDLE,
&args, sizeof(args));
if (r == 0) {
*busy = args.out.status;
return 0;
} else {
fprintf(stderr, "amdgpu: GEM_WAIT_IDLE failed with %i\n", r);
return r;
}
}
开发者ID:janesma,项目名称:drm,代码行数:22,代码来源:amdgpu_bo.c
示例10: strncpy
int DrmControl::getVideoExtCommand()
{
if (mVideoExtCommand) {
return mVideoExtCommand;
}
int fd = Hwcomposer::getInstance().getDrm()->getDrmFd();
union drm_psb_extension_arg video_getparam_arg;
strncpy(video_getparam_arg.extension,
"lnc_video_getparam", sizeof(video_getparam_arg.extension));
int ret = drmCommandWriteRead(fd, DRM_PSB_EXTENSION,
&video_getparam_arg, sizeof(video_getparam_arg));
if (ret != 0) {
VLOGTRACE("failed to get video extension command");
return 0;
}
mVideoExtCommand = video_getparam_arg.rep.driver_ioctl_offset;
return mVideoExtCommand;
}
开发者ID:MIPS,项目名称:hardware-intel-img-hwcomposer,代码行数:22,代码来源:DrmControl.cpp
示例11: drmCommandWriteRead
/* allocate a new (un-tiled) buffer object */
struct etna_bo *etna_bo_new(struct etna_device *dev,
uint32_t size, uint32_t flags)
{
struct etna_bo *bo = NULL;
struct drm_vivante_gem_new req = {
.size = size,
.flags = MSM_BO_WC, // TODO figure out proper flags..
};
int ret;
ret = drmCommandWriteRead(dev->fd, DRM_VIVANTE_GEM_NEW,
&req, sizeof(req));
if (ret)
return NULL;
pthread_mutex_lock(&table_lock);
bo = bo_from_handle(dev, size, req.handle);
pthread_mutex_unlock(&table_lock);
return bo;
}
开发者ID:etnaviv,项目名称:libdrm,代码行数:23,代码来源:etnaviv_bo.c
示例12: intelEmitIrqLocked
int
intelEmitIrqLocked(struct intel_context *intel)
{
drmI830IrqEmit ie;
int ret, seq;
assert(((*(int *) intel->driHwLock) & ~DRM_LOCK_CONT) ==
(DRM_LOCK_HELD | intel->hHWContext));
ie.irq_seq = &seq;
ret = drmCommandWriteRead(intel->driFd, DRM_I830_IRQ_EMIT,
&ie, sizeof(ie));
if (ret) {
fprintf(stderr, "%s: drmI830IrqEmit: %d\n", __FUNCTION__, ret);
exit(1);
}
DBG("%s --> %d\n", __FUNCTION__, seq);
return seq;
}
开发者ID:Starlink,项目名称:mesa,代码行数:22,代码来源:intel_ioctl.c
示例13: kgsl_bo_new_handle
/* allocate a buffer handle: */
drm_private int kgsl_bo_new_handle(struct fd_device *dev,
uint32_t size, uint32_t flags, uint32_t *handle)
{
struct drm_kgsl_gem_create req = {
.size = size,
};
int ret;
ret = drmCommandWriteRead(dev->fd, DRM_KGSL_GEM_CREATE,
&req, sizeof(req));
if (ret)
return ret;
// TODO make flags match msm driver, since kgsl is legacy..
// translate flags in kgsl..
set_memtype(dev, req.handle, flags);
*handle = req.handle;
return 0;
}
开发者ID:Distrotech,项目名称:libdrm,代码行数:23,代码来源:kgsl_bo.c
示例14: amdgpu_bo_set_metadata
int amdgpu_bo_set_metadata(amdgpu_bo_handle bo,
struct amdgpu_bo_metadata *info)
{
struct drm_amdgpu_gem_metadata args = {};
args.handle = bo->handle;
args.op = AMDGPU_GEM_METADATA_OP_SET_METADATA;
args.data.flags = info->flags;
args.data.tiling_info = info->tiling_info;
if (info->size_metadata > sizeof(args.data.data))
return -EINVAL;
if (info->size_metadata) {
args.data.data_size_bytes = info->size_metadata;
memcpy(args.data.data, info->umd_metadata, info->size_metadata);
}
return drmCommandWriteRead(bo->dev->fd,
DRM_AMDGPU_GEM_METADATA,
&args, sizeof(args));
}
开发者ID:janesma,项目名称:drm,代码行数:22,代码来源:amdgpu_bo.c
示例15: amdgpu_create_bo_from_user_mem
int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
void *cpu,
uint64_t size,
amdgpu_bo_handle *buf_handle)
{
int r;
struct amdgpu_bo *bo;
struct drm_amdgpu_gem_userptr args;
uintptr_t cpu0;
uint32_t ps, off;
memset(&args, 0, sizeof(args));
ps = getpagesize();
cpu0 = ROUND_DOWN((uintptr_t)cpu, ps);
off = (uintptr_t)cpu - cpu0;
size = ROUND_UP(size + off, ps);
args.addr = cpu0;
args.flags = AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_REGISTER;
args.size = size;
r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_USERPTR,
&args, sizeof(args));
if (r)
return r;
bo = calloc(1, sizeof(struct amdgpu_bo));
if (!bo)
return -ENOMEM;
atomic_set(&bo->refcount, 1);
bo->dev = dev;
bo->alloc_size = size;
bo->handle = args.handle;
*buf_handle = bo;
return r;
}
开发者ID:janesma,项目名称:drm,代码行数:39,代码来源:amdgpu_bo.c
示例16: R600CPFlushIndirect
/* Flush the indirect buffer to the kernel for submission to the card */
void R600CPFlushIndirect(ScrnInfoPtr pScrn, drmBufPtr ib)
{
drmBufPtr buffer = ib;
int start = 0;
drm_radeon_indirect_t indirect;
int drmFD = RHDDRMFDGet(pScrn->scrnIndex);
if (!buffer) return;
while (buffer->used & 0x3c){
E32(buffer, CP_PACKET2()); /* fill up to multiple of 16 dwords */
}
indirect.idx = buffer->idx;
indirect.start = start;
indirect.end = buffer->used;
indirect.discard = 1;
drmCommandWriteRead(drmFD, DRM_RADEON_INDIRECT,
&indirect, sizeof(drm_radeon_indirect_t));
}
开发者ID:AustinSMU,项目名称:osx86-driver-radeonhd,代码行数:23,代码来源:r6xx_accel.c
示例17: radeon_bo_get_tiling
static void radeon_bo_get_tiling(struct pb_buffer *_buf,
enum radeon_bo_layout *microtiled,
enum radeon_bo_layout *macrotiled)
{
struct radeon_bo *bo = get_radeon_bo(_buf);
struct drm_radeon_gem_set_tiling args = {};
args.handle = bo->handle;
drmCommandWriteRead(bo->rws->fd,
DRM_RADEON_GEM_GET_TILING,
&args,
sizeof(args));
*microtiled = RADEON_LAYOUT_LINEAR;
*macrotiled = RADEON_LAYOUT_LINEAR;
if (args.tiling_flags & RADEON_BO_FLAGS_MICRO_TILE)
*microtiled = RADEON_LAYOUT_TILED;
if (args.tiling_flags & RADEON_BO_FLAGS_MACRO_TILE)
*macrotiled = RADEON_LAYOUT_TILED;
}
开发者ID:nikai3d,项目名称:mesa,代码行数:22,代码来源:radeon_drm_bo.c
示例18: amdgpu_cs_ctx_create
/**
* Create command submission context
*
* \param dev - \c [in] amdgpu device handle
* \param context - \c [out] amdgpu context handle
*
* \return 0 on success otherwise POSIX Error code
*/
int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
amdgpu_context_handle *context)
{
struct amdgpu_context *gpu_context;
union drm_amdgpu_ctx args;
int r;
if (NULL == dev)
return -EINVAL;
if (NULL == context)
return -EINVAL;
gpu_context = calloc(1, sizeof(struct amdgpu_context));
if (NULL == gpu_context)
return -ENOMEM;
gpu_context->dev = dev;
r = pthread_mutex_init(&gpu_context->sequence_mutex, NULL);
if (r)
goto error;
/* Create the context */
memset(&args, 0, sizeof(args));
args.in.op = AMDGPU_CTX_OP_ALLOC_CTX;
r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_CTX, &args, sizeof(args));
if (r)
goto error;
gpu_context->id = args.out.alloc.ctx_id;
*context = (amdgpu_context_handle)gpu_context;
return 0;
error:
pthread_mutex_destroy(&gpu_context->sequence_mutex);
free(gpu_context);
return r;
}
开发者ID:janesma,项目名称:drm,代码行数:47,代码来源:amdgpu_cs.c
示例19: GET_CURRENT_CONTEXT
/* This version of AllocateMemoryMESA allocates only GART memory, and
* only does so after the point at which the driver has been
* initialized.
*
* Theoretically a valid context isn't required. However, in this
* implementation, it is, as I'm using the hardware lock to protect
* the kernel data structures, and the current context to get the
* device fd.
*/
void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size,
GLfloat readfreq, GLfloat writefreq,
GLfloat priority)
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa;
int region_offset;
drm_radeon_mem_alloc_t alloc;
int ret;
if (R200_DEBUG & RADEON_IOCTL)
fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq,
writefreq, priority);
if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->radeon.radeonScreen->gartTextures.map)
return NULL;
if (getenv("R200_NO_ALLOC"))
return NULL;
alloc.region = RADEON_MEM_REGION_GART;
alloc.alignment = 0;
alloc.size = size;
alloc.region_offset = ®ion_offset;
ret = drmCommandWriteRead( rmesa->radeon.radeonScreen->driScreen->fd,
DRM_RADEON_ALLOC,
&alloc, sizeof(alloc));
if (ret) {
fprintf(stderr, "%s: DRM_RADEON_ALLOC ret %d\n", __FUNCTION__, ret);
return NULL;
}
{
char *region_start = (char *)rmesa->radeon.radeonScreen->gartTextures.map;
return (void *)(region_start + region_offset);
}
}
开发者ID:CPFDSoftware-Tony,项目名称:gmv,代码行数:48,代码来源:r200_ioctl.c
示例20: drm_tegra_bo_create
int drm_tegra_bo_create(struct drm_tegra *drm, uint32_t flags, uint32_t size,
struct drm_tegra_bo **bop)
{
struct drm_tegra_gem_create args;
struct drm_tegra_bo *bo;
int err;
if (!drm || size == 0 || !bop)
return -EINVAL;
bo = calloc(1, sizeof(*bo));
if (!bo)
return -ENOMEM;
DRMINITLISTHEAD(&bo->list);
atomic_set(&bo->ref, 1);
bo->flags = flags;
bo->size = size;
bo->drm = drm;
memset(&args, 0, sizeof(args));
args.flags = flags;
args.size = size;
err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_CREATE, &args,
sizeof(args));
if (err < 0) {
free(bo);
return -errno;
}
DRMLISTADD(&bo->list, &drm->bo_list);
bo->handle = args.handle;
*bop = bo;
return 0;
}
开发者ID:5py,项目名称:libdrm,代码行数:38,代码来源:tegra.c
注:本文中的drmCommandWriteRead函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论