Split updateImgInfoMethod

Change-Id: Ief0ecd7d0bcca77e02e946c0590674fc82ab3e69
This commit is contained in:
Maciej Dziuban
2019-12-17 15:01:24 +01:00
committed by sys_ocldev
parent c81f0e5c17
commit 93849d6984
8 changed files with 70 additions and 12 deletions

View File

@@ -183,7 +183,7 @@ uint32_t Gmm::queryQPitch(GMM_RESOURCE_TYPE resType) {
return gmmResourceInfo->getQPitch();
}
void Gmm::updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex) {
void Gmm::updateImgInfoAndDesc(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex) {
imgDesc.image_width = gmmResourceInfo->getBaseWidth();
imgDesc.image_row_pitch = gmmResourceInfo->getRenderPitch();
if (imgDesc.image_row_pitch == 0) {
@@ -204,6 +204,10 @@ void Gmm::updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arra
imgDesc.image_slice_pitch = gmmResourceInfo->getSizeAllocation();
}
updateOffsetsInImgInfo(imgInfo, arrayIndex);
}
void Gmm::updateOffsetsInImgInfo(ImageInfo &imgInfo, cl_uint arrayIndex) {
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
reqOffsetInfo.ReqRender = 1;
reqOffsetInfo.Slice = 0;

View File

@@ -39,7 +39,8 @@ class Gmm {
bool hasMultisampleControlSurface() const;
uint32_t queryQPitch(GMM_RESOURCE_TYPE resType);
void updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex);
void updateImgInfoAndDesc(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex);
void updateOffsetsInImgInfo(ImageInfo &imgInfo, cl_uint arrayIndex);
uint8_t resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, OCLPlane plane);
uint32_t getUnifiedAuxPitchTiles();

View File

@@ -67,9 +67,9 @@ void D3DSharing<D3D>::releaseResource(MemObj *memObject) {
}
template <typename D3D>
void D3DSharing<D3D>::updateImgInfo(Gmm *gmm, ImageInfo &imgInfo, cl_image_desc &imgDesc, OCLPlane oclPlane, cl_uint arrayIndex) {
void D3DSharing<D3D>::updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, cl_image_desc &imgDesc, OCLPlane oclPlane, cl_uint arrayIndex) {
gmm->updateImgInfo(imgInfo, imgDesc, arrayIndex);
gmm->updateImgInfoAndDesc(imgInfo, imgDesc, arrayIndex);
if (oclPlane == OCLPlane::PLANE_U || oclPlane == OCLPlane::PLANE_V || oclPlane == OCLPlane::PLANE_UV) {
imgDesc.image_width /= 2;

View File

@@ -40,7 +40,7 @@ class D3DSharing : public SharingHandler {
static bool isFormatWithPlane1(DXGI_FORMAT format);
protected:
static void updateImgInfo(Gmm *gmm, ImageInfo &imgInfo, cl_image_desc &imgDesc, OCLPlane oclPlane, cl_uint arrayIndex);
static void updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, cl_image_desc &imgDesc, OCLPlane oclPlane, cl_uint arrayIndex);
Context *context;
D3DSharingFunctions<D3D> *sharingFunctions = nullptr;

View File

@@ -84,7 +84,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
AllocationProperties allocProperties(rootDeviceIndex, false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)surfaceInfo->shared_handle), allocProperties,
false);
updateImgInfo(alloc->getDefaultGmm(), imgInfo, imgDesc, oclPlane, 0u);
updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, imgDesc, oclPlane, 0u);
} else {
lockable = !(surfaceDesc.Usage & D3DResourceFlags::USAGE_RENDERTARGET) || oclPlane != OCLPlane::NO_PLANE;
if (!lockable) {

View File

@@ -77,7 +77,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
}
DEBUG_BREAK_IF(!alloc);
updateImgInfo(alloc->getDefaultGmm(), imgInfo, imgDesc, oclPlane, arrayIndex);
updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, imgDesc, oclPlane, arrayIndex);
auto d3dTextureObj = new D3DTexture<D3D>(context, d3dTexture, subresource, textureStaging, sharedResource);
@@ -141,7 +141,7 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
}
DEBUG_BREAK_IF(!alloc);
updateImgInfo(alloc->getDefaultGmm(), imgInfo, imgDesc, OCLPlane::NO_PLANE, 0u);
updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, imgDesc, OCLPlane::NO_PLANE, 0u);
auto d3dTextureObj = new D3DTexture<D3D>(context, d3dTexture, subresource, textureStaging, sharedResource);

View File

@@ -34,8 +34,7 @@ Image *UnifiedImage::createSharedUnifiedImage(Context *context, cl_mem_flags fla
return nullptr;
}
cl_image_desc throwAwayImgDesc{}; // TODO shouldn't require this, we need only bottom portion of this method
graphicsAllocation->getDefaultGmm()->updateImgInfo(imgInfo, throwAwayImgDesc, 0u);
graphicsAllocation->getDefaultGmm()->updateOffsetsInImgInfo(imgInfo, 0u);
auto &memoryManager = *context->getMemoryManager();
if (graphicsAllocation->getDefaultGmm()->unifiedAuxTranslationCapable()) {