Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record the content of external images during trace #1103

Merged
merged 1 commit into from
Sep 21, 2017

Conversation

dsrbecky
Copy link
Contributor

No description provided.


// Update the content if we made a snapshot.
if e := FindEGLImageData(cmd.Extras()); e != nil {
_, err := database.Resolve(ctx, e.ID)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check currently seems to fail, any idea why the resource can not be found?

I failed to debug it so far as the IDs generally print as random ascii art. Can we just have incrementing integers for the resource IDs please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check currently seems to fail, any idea why the resource can not be found?

Yes.

The resource IDs are generated in GAPII using cityhash. As a memory range is observed, the hash is calculated, and used to determine if the resource has already been encoded. If not, the resource data and hash is encoded in the Capture::Resource message. An observation always refers to the resource data by this hash.

GAPIS uses SHA1 hashes for all database entries. When you store some data, the message is encoded to binary, SHA1 hashed, and checked to see if it is already in the database. We use this to ensure we only have one copy of any data and also for ensuring that Resolvable types always do the work once.

SHA1 is moderately expensive to calculate, hence we use the much faster cityhash in the interceptor. SHA1 is a better hashing function, so we have used it for the server.

So, to avoid having to deal with a cityhash->SHA1 map after load, we replace the cityhash resource hashes with SHA hashes while we're deserializing.

Memory observations are explicitly handled, but we now have your new type that is trying to load the resources from the database using the cityhash IDs.

My recommendation for now would be to generalize the hash remapping logic so you can remap the IDs in the EGLImageData.

Consider creating this interface in the api package:

// ObservationReference is the interface implemented by types that hold references
// to Observation IDs. As these IDs are remapped on load, references must update
// any IDs using the map passed to RemapObservationIDs.
type ObservationReference interface {
    RemapObservationIDs(map[id.ID]id.ID)
}

Then you can check for this interface here and call it.

And move this functionality into api.CmdObservation.RemapObservationIDs(). You'll then be able to do the same for your own new type.

I failed to debug it so far as the IDs generally print as random ascii art.

id.ID should print just fine. Are you referring to printing from the GAPII side?

Can we just have incrementing integers for the resource IDs please?

Which IDs are you proposing to change? The IDs for Observations in the .gfxtrace file? Yes, that could work, but would break file formats again.

If you're referring to all IDs, that breaks a whole bunch of fundamental assumptions, and would be a massive change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #1105 to give you this interface.

@@ -30,6 +31,16 @@ type ErrorState struct {
InterceptorsGlError GLenum
}

// EGLImageData is an extra used to store snapshot of external image source.
type EGLImageData struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to have this type here, but you could just use the proto directly.

ben-clayton added a commit to ben-clayton/gapid that referenced this pull request Sep 15, 2017
Used to let deserialized objects remap their Resource identifiers to those returned by database.Store.

See google#1103 for more info.
ben-clayton added a commit that referenced this pull request Sep 15, 2017
Used to let deserialized objects remap their Resource identifiers to those returned by database.Store.

See #1103 for more info.
@dsrbecky dsrbecky force-pushed the external-image branch 2 times, most recently from 053c624 to f34fd78 Compare September 19, 2017 14:14
Copy link
Contributor

@ben-clayton ben-clayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay

@@ -22,3 +22,13 @@ message ErrorState {
uint32 TraceDriversGlError = 1;
uint32 InterceptorsGlError = 2;
}

message EGLImageData {
string ID = 1; // Resource ID of the image data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could just use bytes to avoid a ID parse

@dsrbecky dsrbecky merged commit a66f669 into google:master Sep 21, 2017
@dsrbecky dsrbecky deleted the external-image branch September 21, 2017 12:45
purvisa-at-google-com pushed a commit that referenced this pull request Sep 29, 2022
Adds an error code to the validation result to help distinguish between different types of validation errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants