• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ drmCommandWrite函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中drmCommandWrite函数的典型用法代码示例。如果您正苦于以下问题:C++ drmCommandWrite函数的具体用法?C++ drmCommandWrite怎么用?C++ drmCommandWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了drmCommandWrite函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mgaFlushDMA

int mgaFlushDMA( int fd, drmLockFlags flags )
{
   drm_lock_t lock;
   int ret, i = 0;

   memset( &lock, 0, sizeof(lock) );

   lock.flags = flags & (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH 
			 | DRM_LOCK_FLUSH_ALL);

   do {
      ret = drmCommandWrite( fd, DRM_MGA_FLUSH, &lock, sizeof(lock) );
   } while ( ret && errno == EBUSY && i++ < DRM_MGA_IDLE_RETRY );

   if ( ret == 0 )
      return 0;
   if ( errno != EBUSY )
      return -errno;

   if ( lock.flags & DRM_LOCK_QUIESCENT ) {
      /* Only keep trying if we need quiescence.
       */
      lock.flags &= ~(DRM_LOCK_FLUSH | DRM_LOCK_FLUSH_ALL);

      do {
         ret = drmCommandWrite( fd, DRM_MGA_FLUSH, &lock, sizeof(lock) );
      } while ( ret && errno == EBUSY && i++ < DRM_MGA_IDLE_RETRY );
   }

   if ( ret == 0 ) {
      return 0;
   } else {
      return -errno;
   }
}
开发者ID:freedesktop-unofficial-mirror,项目名称:nouveau__mesa,代码行数:35,代码来源:mgaioctl.c


示例2: r128ReadDepthPixelsLocked

void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
                                const GLint x[], const GLint y[] )
{
    drm_clip_rect_t *pbox = rmesa->pClipRects;
    drm_r128_depth_t d;
    int nbox = rmesa->numClipRects;
    int fd = rmesa->driScreen->fd;
    int i;

    if ( !nbox || !n ) {
        return;
    }
    if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
        rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
    }

    if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
    {
        if ( nbox < 3 ) {
            rmesa->sarea->nbox = 0;
        } else {
            rmesa->sarea->nbox = nbox;
        }

        d.func = R128_READ_PIXELS;
        d.n = n;
        d.x = (int*)&x;
        d.y = (int*)&y;
        d.buffer = NULL;
        d.mask = NULL;

        drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
    }
    else
    {
        for (i = 0 ; i < nbox ; ) {
            int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
            drm_clip_rect_t *b = rmesa->sarea->boxes;

            rmesa->sarea->nbox = nr - i;
            for ( ; i < nr ; i++) {
                *b++ = pbox[i];
            }

            rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;

            d.func = R128_READ_PIXELS;
            d.n = n;
            d.x = (int*)&x;
            d.y = (int*)&y;
            d.buffer = NULL;
            d.mask = NULL;

            drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
        }
    }

    rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
}
开发者ID:beligit,项目名称:psx4m,代码行数:59,代码来源:r128_ioctl.c


示例3: VIAFreeLinear

void
VIAFreeLinear(VIAMemPtr mem)
{
    DEBUG(ErrorF("Freed %lu (pool %d)\n", mem->base, mem->pool));
    switch (mem->pool) {
        case 0:
            return;
        case 1:
            {
                VIAPtr pVia = VIAPTR(mem->pScrn);

                if (pVia->useEXA && !pVia->NoAccel) {
                    exaOffscreenFree(mem->pScrn->pScreen, mem->exa);
                    mem->linear = NULL;
                    mem->pool = 0;
                    return;
                }
            }
            xf86FreeOffscreenLinear(mem->linear);
            mem->linear = NULL;
            mem->pool = 0;
            return;
        case 2:
#ifdef XF86DRI
            if (drmCommandWrite(mem->drm_fd, DRM_VIA_FREEMEM,
                                &mem->drm, sizeof(drm_via_mem_t)) < 0)
                ErrorF("DRM module failed free.\n");
#endif
            mem->pool = 0;
            return;
    }
}
开发者ID:nobled,项目名称:openchrome,代码行数:32,代码来源:via_memory.c


示例4: amdgpu_query_firmware_version

int amdgpu_query_firmware_version(amdgpu_device_handle dev, unsigned fw_type,
				  unsigned ip_instance, unsigned index,
				  uint32_t *version, uint32_t *feature)
{
	struct drm_amdgpu_info request;
	struct drm_amdgpu_info_firmware firmware = {};
	int r;

	memset(&request, 0, sizeof(request));
	request.return_pointer = (uintptr_t)&firmware;
	request.return_size = sizeof(firmware);
	request.query = AMDGPU_INFO_FW_VERSION;
	request.query_fw.fw_type = fw_type;
	request.query_fw.ip_instance = ip_instance;
	request.query_fw.index = index;

	r = drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request,
			    sizeof(struct drm_amdgpu_info));
	if (r)
		return r;

	*version = firmware.ver;
	*feature = firmware.feature;
	return 0;
}
开发者ID:chadversary,项目名称:libdrm,代码行数:25,代码来源:amdgpu_gpu_info.c


示例5: i830WaitAge

void i830WaitAge( i830ContextPtr imesa, int age  ) 
{
   int i = 0;
   if (GET_DISPATCH_AGE(imesa) >= age) return;

   while (1) {
      drmCommandNone(imesa->driFd, DRM_I830_GETAGE);
      if (GET_DISPATCH_AGE(imesa) >= age) return;
      imesa->perf_boxes |= I830_BOX_WAIT;

      if (imesa->do_irqs) {
	 drmI830IrqEmit ie;
	 drmI830IrqWait iw;
	 int ret;
      
	 ie.irq_seq = &iw.irq_seq;
	 
	 LOCK_HARDWARE( imesa ); 
	 ret = drmCommandWriteRead( imesa->driFd, DRM_I830_IRQ_EMIT, &ie, sizeof(ie) );
	 if ( ret ) {
	    fprintf( stderr, "%s: drmI830IrqEmit: %d\n", __FUNCTION__, ret );
	    exit(1);
	 }
	 UNLOCK_HARDWARE(imesa);
	 
	 ret = drmCommandWrite( imesa->driFd, DRM_I830_IRQ_WAIT, &iw, sizeof(iw) );
	 if ( ret ) {
	    fprintf( stderr, "%s: drmI830IrqWait: %d\n", __FUNCTION__, ret );
	    exit(1);
	 }
      } else {
	 if (++i > 5000) usleep(1); 
      }
   }
}
开发者ID:dikerex,项目名称:theqvd,代码行数:35,代码来源:i830_ioctl.c


示例6: etna_pipe_wait

int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)
{
	struct etna_device *dev = pipe->gpu->dev;
	int ret;

	struct drm_etnaviv_wait_fence req = {
		.pipe = pipe->gpu->core,
		.fence = timestamp,
	};

	if (ms == 0)
		req.flags |= ETNA_WAIT_NONBLOCK;

	get_abs_timeout(&req.timeout, ms);

	ret = drmCommandWrite(dev->fd, DRM_ETNAVIV_WAIT_FENCE, &req, sizeof(req));
	if (ret) {
		ERROR_MSG("wait-fence failed! %d (%s)", ret, strerror(errno));
		return ret;
	}

	return 0;
}

void etna_pipe_del(struct etna_pipe *pipe)
{
	free(pipe);
}
开发者ID:jonathangray,项目名称:drm,代码行数:28,代码来源:etnaviv_pipe.c


示例7: nouveau_channel_free

void
nouveau_channel_free(struct nouveau_channel **chan)
{
	struct nouveau_channel_priv *nvchan;
	struct nouveau_device_priv *nvdev;
	struct drm_nouveau_channel_free cf;

	if (!chan || !*chan)
		return;
	nvchan = nouveau_channel(*chan);
	*chan = NULL;
	nvdev = nouveau_device(nvchan->base.device);

	FIRE_RING(&nvchan->base);

	nouveau_bo_unmap(nvchan->notifier_bo);
	nouveau_bo_ref(NULL, &nvchan->notifier_bo);

	nouveau_grobj_free(&nvchan->base.vram);
	nouveau_grobj_free(&nvchan->base.gart);
	nouveau_grobj_free(&nvchan->base.nullobj);

	cf.channel = nvchan->drm.channel;
	drmCommandWrite(nvdev->fd, DRM_NOUVEAU_CHANNEL_FREE, &cf, sizeof(cf));
	free(nvchan);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_hardware_intel,代码行数:26,代码来源:nouveau_channel.c


示例8: nouveau_channel_free

void
nouveau_channel_free(struct nouveau_channel **chan)
{
	struct nouveau_channel_priv *nvchan;
	struct nouveau_device_priv *nvdev;
	struct drm_nouveau_channel_free cf;
	unsigned i;

	if (!chan || !*chan)
		return;
	nvchan = nouveau_channel(*chan);
	(*chan)->flush_notify = NULL;
	*chan = NULL;
	nvdev = nouveau_device(nvchan->base.device);

	FIRE_RING(&nvchan->base);

	nouveau_pushbuf_fini(&nvchan->base);
	if (nvchan->notifier_bo) {
		nouveau_bo_unmap(nvchan->notifier_bo);
		nouveau_bo_ref(NULL, &nvchan->notifier_bo);
	}

	for (i = 0; i < nvchan->drm.nr_subchan; i++)
		free(nvchan->base.subc[i].gr);

	nouveau_grobj_free(&nvchan->base.vram);
	nouveau_grobj_free(&nvchan->base.gart);
	nouveau_grobj_free(&nvchan->base.nullobj);

	cf.channel = nvchan->drm.channel;
	drmCommandWrite(nvdev->fd, DRM_NOUVEAU_CHANNEL_FREE, &cf, sizeof(cf));
	free(nvchan);
}
开发者ID:Amazi,项目名称:libdrm-1,代码行数:34,代码来源:nouveau_channel.c


示例9: mga_iload_dma_ioctl

static void mga_iload_dma_ioctl(mgaContextPtr mmesa,
				unsigned long dest,
				int length)
{
   drmBufPtr buf = mmesa->iload_buffer;
   drmMGAIload iload;
   int ret, i;

   if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
      fprintf(stderr, "DRM_IOCTL_MGA_ILOAD idx %d dst %x length %d\n",
	      buf->idx, (int) dest, length);

   iload.idx = buf->idx;
   iload.dstorg = dest;
   iload.length = length;

   i = 0;
   do {
      ret = drmCommandWrite( mmesa->driFd, DRM_MGA_ILOAD, 
                             &iload, sizeof(drmMGAIload) );
   } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );

   if ( ret < 0 ) {
      printf("send iload retcode = %d\n", ret);
      exit(1);
   }

   mmesa->iload_buffer = 0;

   if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
      fprintf(stderr, "finished iload dma put\n");

}
开发者ID:dikerex,项目名称:theqvd,代码行数:33,代码来源:mgaioctl.c


示例10: r128FireBlitLocked

void r128FireBlitLocked( r128ContextPtr rmesa, drmBufPtr buffer,
                         GLint offset, GLint pitch, GLint format,
                         GLint x, GLint y, GLint width, GLint height )
{
    drm_r128_blit_t blit;
    GLint ret;

    blit.idx = buffer->idx;
    blit.offset = offset;
    blit.pitch = pitch;
    blit.format = format;
    blit.x = x;
    blit.y = y;
    blit.width = width;
    blit.height = height;

    ret = drmCommandWrite( rmesa->driFd, DRM_R128_BLIT,
                           &blit, sizeof(blit) );

    if ( ret ) {
        UNLOCK_HARDWARE( rmesa );
        fprintf( stderr, "DRM_R128_BLIT: return = %d\n", ret );
        exit( 1 );
    }
}
开发者ID:beligit,项目名称:psx4m,代码行数:25,代码来源:r128_ioctl.c


示例11: r200FreeMemoryMESA

/* Called via glXFreeMemoryMESA() */
void r200FreeMemoryMESA(__DRIscreen *screen, GLvoid *pointer)
{
    GET_CURRENT_CONTEXT(ctx);
    r200ContextPtr rmesa;
    ptrdiff_t region_offset;
    drm_radeon_mem_free_t memfree;
    int ret;

    if (R200_DEBUG & RADEON_IOCTL)
        fprintf(stderr, "%s %p\n", __FUNCTION__, pointer);

    if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->radeon.radeonScreen->gartTextures.map) {
        fprintf(stderr, "%s: no context\n", __FUNCTION__);
        return;
    }

    region_offset = (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map;

    if (region_offset < 0 ||
            region_offset > rmesa->radeon.radeonScreen->gartTextures.size) {
        fprintf(stderr, "offset %d outside range 0..%d\n", region_offset,
                rmesa->radeon.radeonScreen->gartTextures.size);
        return;
    }

    memfree.region = RADEON_MEM_REGION_GART;
    memfree.region_offset = region_offset;

    ret = drmCommandWrite( rmesa->radeon.radeonScreen->driScreen->fd,
                           DRM_RADEON_FREE,
                           &memfree, sizeof(memfree));

    if (ret)
        fprintf(stderr, "%s: DRM_RADEON_FREE ret %d\n", __FUNCTION__, ret);
}
开发者ID:CPFDSoftware-Tony,项目名称:gmv,代码行数:36,代码来源:r200_ioctl.c


示例12: intelFreeAGP

void intelFreeAGP( intelContextPtr intel, void *pointer )
{
   int region_offset;
   drmI830MemFree memfree;
   int ret;

   region_offset = (char *)pointer - (char *)intel->intelScreen->tex.map;

   if (region_offset < 0 || 
       region_offset > intel->intelScreen->tex.size) {
      fprintf(stderr, "offset %d outside range 0..%d\n", region_offset,
	      intel->intelScreen->tex.size);
      return;
   }

   memfree.region = I830_MEM_REGION_AGP;
   memfree.region_offset = region_offset;
   
   ret = drmCommandWrite( intel->driFd,
			  DRM_I830_FREE,
			  &memfree, sizeof(memfree));
   
   if (ret) 
      fprintf(stderr, "%s: DRM_I830_FREE ret %d\n", __FUNCTION__, ret);
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:25,代码来源:intel_ioctl.c


示例13: intelWaitIrq

void
intelWaitIrq(struct intel_context *intel, int seq)
{
   struct drm_i915_irq_wait iw;
   int ret, lastdispatch;
   volatile struct drm_i915_sarea *sarea = intel->sarea;

   if (intel->no_hw)
      return;

   DBG("%s %d\n", __FUNCTION__, seq);

   iw.irq_seq = seq;

   do {
      lastdispatch = sarea->last_dispatch;
      ret = drmCommandWrite(intel->driFd, DRM_I915_IRQ_WAIT, &iw, sizeof(iw));
   } while (ret == -EAGAIN ||
	    ret == -EINTR ||
	    (ret == -EBUSY && lastdispatch != sarea->last_dispatch) ||
	    (ret == 0 && seq > sarea->last_dispatch) ||
	    (ret == 0 && sarea->last_dispatch - seq >= (1 << 24)));

   if (ret) {
      fprintf(stderr, "%s: drm_i915_irq_wait: %d\n", __FUNCTION__, ret);
      exit(1);
   }
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:28,代码来源:intel_ioctl.c


示例14: omap_set_param

int omap_set_param(struct omap_device *dev, uint64_t param, uint64_t value)
{
	struct drm_omap_param req = {
			.param = param,
			.value = value,
	};
	return drmCommandWrite(dev->fd, DRM_OMAP_GET_PARAM, &req, sizeof(req));
}
开发者ID:vstehle,项目名称:libdrm,代码行数:8,代码来源:omap_drm.c


示例15: vmw_ioctl_init

boolean
vmw_ioctl_init(struct vmw_winsys_screen *vws)
{
   struct drm_vmw_getparam_arg gp_arg;
   struct drm_vmw_get_3d_cap_arg cap_arg;
   unsigned int size;
   int ret;

   VMW_FUNC;

   memset(&gp_arg, 0, sizeof(gp_arg));
   gp_arg.param = DRM_VMW_PARAM_3D;
   ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM,
			     &gp_arg, sizeof(gp_arg));
   if (ret || gp_arg.value == 0) {
      vmw_error("No 3D enabled (%i, %s).\n", ret, strerror(-ret));
      goto out_no_3d;
   }

   memset(&gp_arg, 0, sizeof(gp_arg));
   gp_arg.param = DRM_VMW_PARAM_FIFO_HW_VERSION;
   ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM,
			     &gp_arg, sizeof(gp_arg));
   if (ret) {
      vmw_error("Failed to get fifo hw version (%i, %s).\n",
                ret, strerror(-ret));
      goto out_no_3d;
   }
   vws->ioctl.hwversion = gp_arg.value;

   size = SVGA_FIFO_3D_CAPS_SIZE * sizeof(uint32_t);
   vws->ioctl.buffer = calloc(1, size);
   if (!vws->ioctl.buffer) {
      debug_printf("Failed alloc fifo 3D caps buffer.\n");
      goto out_no_3d;
   }

   memset(&cap_arg, 0, sizeof(cap_arg));
   cap_arg.buffer = (uint64_t) (unsigned long) (vws->ioctl.buffer);
   cap_arg.max_size = size;

   ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_GET_3D_CAP,
			 &cap_arg, sizeof(cap_arg));

   if (ret) {
      debug_printf("Failed to get 3D capabilities"
		   " (%i, %s).\n", ret, strerror(-ret));
      goto out_no_caps;
   }

   vmw_printf("%s OK\n", __FUNCTION__);
   return TRUE;
  out_no_caps:
   free(vws->ioctl.buffer);
  out_no_3d:
   debug_printf("%s Failed\n", __FUNCTION__);
   return FALSE;
}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:58,代码来源:vmw_screen_ioctl.c


示例16: I810InitDma

Bool
I810InitDma(ScrnInfoPtr pScrn)
{
   I810Ptr pI810 = I810PTR(pScrn);
   I810RingBuffer *ring = pI810->LpRing;
   I810DRIPtr pI810DRI = (I810DRIPtr) pI810->pDRIInfo->devPrivate;
   drmI810Init info;

   memset(&info, 0, sizeof(drmI810Init));

   info.ring_start = ring->mem.Start;
   info.ring_end = ring->mem.End;
   info.ring_size = ring->mem.Size;
   info.mmio_offset = (unsigned int)pI810DRI->regs;
   info.buffers_offset = (unsigned int)pI810->buffer_map;
   info.sarea_priv_offset = sizeof(XF86DRISAREARec);

   info.front_offset = 0;
   info.back_offset = pI810->BackBuffer.Start;
   info.depth_offset = pI810->DepthBuffer.Start;
   info.overlay_offset = pI810->OverlayStart;
   info.overlay_physical = pI810->OverlayPhysical;
   info.w = pScrn->virtualX;
   info.h = pScrn->virtualY;
   info.pitch = pI810->auxPitch;
   info.pitch_bits = pI810->auxPitchBits;

   /* We require DRM v1.2 or greater. Since DRM v1.2 broke compatibility
    * we created a new v1.4 that supports a new init function. Eventually the
    * old init function will go away. If you change the drm interface, make a
    * new init type too so that we can detect the new client.
    */
   switch(i810_drm_version) {
   case ((1<<16) | 0):
   case ((1<<16) | 1):
   case ((1<<16) | 2):
   case ((1<<16) | 3):
      /* Use OLD drm < 1.4 init */
      info.func = I810_INIT_DMA;
      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Init PRE v1.4 interface.\n");
      break;
   default:
   case ((1<<16) | 4):
      /*  DRM version 1.3 or greater init */
      info.func = I810_INIT_DMA_1_4;
      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Init v1.4 interface.\n");
      break;
   }

   if (drmCommandWrite(pI810->drmSubFD, DRM_I810_INIT,
		       &info, sizeof(drmI810Init))) {
      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
		 "[drm] I810 Dma Initialization failed.\n");
      return FALSE;
   }

   return TRUE;
}
开发者ID:01org,项目名称:iotg-lin-gfx-ddx,代码行数:58,代码来源:i810_dri.c


示例17: set_memtype

static int set_memtype(struct fd_device *dev, uint32_t handle, uint32_t flags)
{
	struct drm_kgsl_gem_memtype req = {
			.handle = handle,
			.type = flags & DRM_FREEDRENO_GEM_TYPE_MEM_MASK,
	};

	return drmCommandWrite(dev->fd, DRM_KGSL_GEM_SETMEMTYPE,
			&req, sizeof(req));
}
开发者ID:Distrotech,项目名称:libdrm,代码行数:10,代码来源:kgsl_bo.c


示例18: R128CCEStop

static int R128CCEStop(const DRIDriverContext *ctx)
{
    R128InfoPtr info = ctx->driverPrivate;
    drm_r128_cce_stop_t stop;
    int            ret, i;

    stop.flush = 1;
    stop.idle  = 1;

    ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
                           &stop, sizeof(stop) );

    if ( ret == 0 ) {
        return 0;
    } else if ( errno != EBUSY ) {
        return -errno;
    }

    stop.flush = 0;

    i = 0;
    do {
        ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
                               &stop, sizeof(stop) );
    } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );

    if ( ret == 0 ) {
        return 0;
    } else if ( errno != EBUSY ) {
        return -errno;
    }

    stop.idle = 0;

    if ( drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
                          &stop, sizeof(stop) )) {
        return -errno;
    } else {
        return 0;
    }
}
开发者ID:DavidGriffith,项目名称:finx,代码行数:41,代码来源:r128_dri.c


示例19: mgaReleaseBufLocked

void mgaReleaseBufLocked( mgaContextPtr mmesa, drmBufPtr buffer )
{
   drmMGAVertex vertex;

   if (!buffer) return;

   vertex.idx = buffer->idx;
   vertex.used = 0;
   vertex.discard = 1;
   drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX, 
                    &vertex, sizeof(drmMGAVertex) );
}
开发者ID:dikerex,项目名称:theqvd,代码行数:12,代码来源:mgaioctl.c


示例20: R128DRICloseScreen

/* The screen is being closed, so clean up any state and free any
   resources used by the DRI. */
void R128DRICloseScreen(const DRIDriverContext *ctx)
{
    R128InfoPtr info = ctx->driverPrivate;
    drm_r128_init_t drmInfo;

    /* Stop the CCE if it is still in use */
    R128CCE_STOP(ctx, info);

    if (info->irq) {
	drmCtlUninstHandler(ctx->drmFD);
	info->irq = 0;
    }

    /* De-allocate vertex buffers */
    if (info->buffers) {
	drmUnmapBufs(info->buffers);
	info->buffers = NULL;
    }

    /* De-allocate all kernel resources */
    memset(&drmInfo, 0, sizeof(drmInfo));
    drmInfo.func = R128_CLEANUP_CCE;
    drmCommandWrite(ctx->drmFD, DRM_R128_INIT,
                    &drmInfo, sizeof(drmInfo));

    /* De-allocate all AGP resources */
    if (info->agpTex) {
	drmUnmap(info->agpTex, info->agpTexMapSize);
	info->agpTex = NULL;
    }
    if (info->buf) {
	drmUnmap(info->buf, info->bufMapSize);
	info->buf = NULL;
    }
    if (info->ringReadPtr) {
	drmUnmap(info->ringReadPtr, info->ringReadMapSize);
	info->ringReadPtr = NULL;
    }
    if (info->ring) {
	drmUnmap(info->ring, info->ringMapSize);
	info->ring = NULL;
    }
    if (info->agpMemHandle != DRM_AGP_NO_HANDLE) {
	drmAgpUnbind(ctx->drmFD, info->agpMemHandle);
	drmAgpFree(ctx->drmFD, info->agpMemHandle);
	info->agpMemHandle = 0;
	drmAgpRelease(ctx->drmFD);
    }
    if (info->pciMemHandle) {
	drmScatterGatherFree(ctx->drmFD, info->pciMemHandle);
	info->pciMemHandle = 0;
    }
}
开发者ID:DavidGriffith,项目名称:finx,代码行数:55,代码来源:r128_dri.c



注:本文中的drmCommandWrite函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ drmCommandWriteRead函数代码示例发布时间:2022-05-30
下一篇:
C++ driver_unregister函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap