In ARC++, the wayland sevice and the video stack rely on GRALLOC_DRM_GET_STRIDE and (*lock_ycbcr) with zero flags to return the metadata associated with the buffer. In the past, we've simply returned the metadata that was calculated during allocation. Since the current virtio-gpu API relies on shadow buffers, there's actually two different sets of metadata: 1) The metadata of the shadow buffer --> useful for mapping 2) The metadata of the host resource --> useful for passing to Chrome For the wayland_service and video stack, we want to return (2). For the Android framework, we want to return (1). BUG=b:132939420 TEST=compile Change-Id: I1134d651396ba68e064eaf2e3cad3cb3225d7c5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1681383 Reviewed-by: David Stevens <stevensd@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
/*
|
|
* Copyright 2017 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef CROS_GRALLOC_BUFFER_H
|
|
#define CROS_GRALLOC_BUFFER_H
|
|
|
|
#include "../drv.h"
|
|
#include "cros_gralloc_helpers.h"
|
|
|
|
class cros_gralloc_buffer
|
|
{
|
|
public:
|
|
cros_gralloc_buffer(uint32_t id, struct bo *acquire_bo,
|
|
struct cros_gralloc_handle *acquire_handle);
|
|
~cros_gralloc_buffer();
|
|
|
|
uint32_t get_id() const;
|
|
|
|
/* The new reference count is returned by both these functions. */
|
|
int32_t increase_refcount();
|
|
int32_t decrease_refcount();
|
|
|
|
int32_t lock(const struct rectangle *rect, uint32_t map_flags,
|
|
uint8_t *addr[DRV_MAX_PLANES]);
|
|
int32_t unlock();
|
|
int32_t resource_info(uint32_t strides[DRV_MAX_PLANES], uint32_t offsets[DRV_MAX_PLANES]);
|
|
|
|
private:
|
|
cros_gralloc_buffer(cros_gralloc_buffer const &);
|
|
cros_gralloc_buffer operator=(cros_gralloc_buffer const &);
|
|
|
|
uint32_t id_;
|
|
struct bo *bo_;
|
|
struct cros_gralloc_handle *hnd_;
|
|
|
|
int32_t refcount_;
|
|
int32_t lockcount_;
|
|
uint32_t num_planes_;
|
|
|
|
struct mapping *lock_data_[DRV_MAX_PLANES];
|
|
};
|
|
|
|
#endif
|