This repository has been archived by the owner on Dec 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f2bdbe
commit 1799d4a
Showing
17 changed files
with
421 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
#include "device.h" | ||
#include "v3d_cl.inl" | ||
#include "common/v3d_macros.h" | ||
#include "cle/v3d_packet_v42_pack.h" | ||
#include "vk_alloc.h" | ||
|
||
void | ||
v3d_cl_ensure_space_with_branch(struct v3d_cl *cl, uint32_t space) | ||
{ | ||
if (cl_offset(cl) + space + cl_packet_length(BRANCH) <= cl->size) | ||
return; | ||
|
||
struct v3dvk_bo *new_bo = vk_alloc2(&cl->dev->alloc, NULL, sizeof(*new_bo), 8, | ||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); | ||
|
||
if (!new_bo) | ||
return; // FIXME: Handle this properly | ||
|
||
new_bo->name = "CL"; | ||
|
||
VkResult result = v3dvk_bo_init_new(cl->dev, new_bo, space); | ||
if (result != VK_SUCCESS) { | ||
// FIXME: Properly handle this | ||
assert(false); | ||
} | ||
|
||
assert(space <= new_bo->size); | ||
|
||
/* Chain to the new BO from the old one. */ | ||
if (cl->bo) { | ||
cl_emit(cl, BRANCH, branch) { | ||
branch.address = cl_address(new_bo, 0); | ||
} | ||
#if 0 | ||
v3d_bo_unreference(&cl->bo); | ||
#endif | ||
} else { | ||
/* Root the first RCL/BCL BO in the job. */ | ||
v3dvk_cmd_buffer_add_bo(cl->cmd, cl->bo); | ||
} | ||
|
||
cl->bo = new_bo; | ||
cl->base = v3dvk_bo_map(cl->bo); | ||
cl->size = cl->bo->size; | ||
cl->next = cl->base; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
#include "v3d_cl.h" | ||
#include "v3dvk_cmd_buffer.h" | ||
|
||
static inline uint32_t cl_offset(struct v3d_cl *cl) | ||
{ | ||
return (char *)cl->next - (char *)cl->base; | ||
} | ||
|
||
static inline void | ||
cl_advance(struct v3d_cl_out **cl, uint32_t n) | ||
{ | ||
(*cl) = (struct v3d_cl_out *)((char *)(*cl) + n); | ||
} | ||
|
||
static inline struct v3d_cl_out * | ||
cl_start(struct v3d_cl *cl) | ||
{ | ||
return cl->next; | ||
} | ||
|
||
static inline void | ||
cl_end(struct v3d_cl *cl, struct v3d_cl_out *next) | ||
{ | ||
cl->next = next; | ||
assert(cl_offset(cl) <= cl->size); | ||
} | ||
|
||
/** | ||
* Reference to a BO with its associated offset, used in the pack process. | ||
*/ | ||
static inline struct v3d_cl_reloc | ||
cl_address(struct v3dvk_bo *bo, uint32_t offset) | ||
{ | ||
struct v3d_cl_reloc reloc = { | ||
.bo = bo, | ||
.offset = offset, | ||
}; | ||
return reloc; | ||
} | ||
|
||
/** | ||
* Helper function called by the XML-generated pack functions for filling in | ||
* an address field in shader records. | ||
* | ||
* Since we have a private address space as of VC5, our BOs can have lifelong | ||
* offsets, and all the kernel needs to know is which BOs need to be paged in | ||
* for this exec. | ||
*/ | ||
static inline void | ||
cl_pack_emit_reloc(struct v3d_cl *cl, const struct v3d_cl_reloc *reloc) | ||
{ | ||
if (reloc->bo) | ||
v3dvk_cmd_buffer_add_bo(cl->cmd, reloc->bo); | ||
} |
Oops, something went wrong.