OSDN Git Service

linux_frontend: Add support for setting raw pixel data.
authorHarish Krupo <harish.krupo.kps@intel.com>
Mon, 5 Feb 2018 02:31:04 +0000 (08:01 +0530)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Fri, 9 Feb 2018 08:59:15 +0000 (00:59 -0800)
This is for cases where the buffer data is shared between processes
as a shared memory.

Jira: None
Test: Cursor shows up with Linux Backend.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
os/linux/iahwc.h
os/linux/linux_frontend.cpp
os/linux/linux_frontend.h

index ef27463..51f3c86 100644 (file)
@@ -42,6 +42,14 @@ typedef struct iahwc_device {
                                          int descriptor);
 } iahwc_device_t;
 
+typedef struct iahwc_raw_pixel_data {
+  void* buffer;
+  uint64_t width;
+  uint64_t height;
+  uint64_t stride;
+  uint32_t format;
+} iahwc_raw_pixel_data;
+
 typedef enum {
   IAHWC_ERROR_NONE = 0,
   IAHWC_ERROR_BAD_CONFIG,
@@ -76,6 +84,7 @@ enum iahwc_function_descriptors {
   IAHWC_FUNC_PRESENT_DISPLAY,
   IAHWC_FUNC_CREATE_LAYER,
   IAHWC_FUNC_LAYER_SET_BO,
+  IAHWC_FUNC_LAYER_SET_RAW_PIXEL_DATA,
   IAHWC_FUNC_LAYER_SET_ACQUIRE_FENCE,
   IAHWC_FUNC_LAYER_SET_USAGE,
   IAHWC_FUNC_LAYER_SET_TRANSFORM,
@@ -151,6 +160,9 @@ typedef int (*IAHWC_PFN_LAYER_SET_BO)(iahwc_device_t*,
                                       iahwc_display_t display_handle,
                                       iahwc_layer_t layer_handle,
                                       struct gbm_bo*);
+typedef int (*IAHWC_PFN_LAYER_SET_RAW_PIXEL_DATA)(
+    iahwc_device_t*, iahwc_display_t display_handle, iahwc_layer_t layer_handle,
+    struct iahwc_raw_pixel_data);
 typedef int (*IAHWC_PFN_LAYER_SET_ACQUIRE_FENCE)(iahwc_device_t*,
                                                  iahwc_display_t display_handle,
                                                  iahwc_layer_t layer_handle,
index 3ce2812..51dc6b6 100644 (file)
@@ -119,6 +119,10 @@ iahwc_function_ptr_t IAHWC::HookGetFunctionPtr(iahwc_device_t* /* device */,
     case IAHWC_FUNC_LAYER_SET_BO:
       return ToHook<IAHWC_PFN_LAYER_SET_BO>(
           LayerHook<decltype(&IAHWCLayer::SetBo), &IAHWCLayer::SetBo, gbm_bo*>);
+    case IAHWC_FUNC_LAYER_SET_RAW_PIXEL_DATA:
+      return ToHook<IAHWC_PFN_LAYER_SET_RAW_PIXEL_DATA>(
+          LayerHook<decltype(&IAHWCLayer::SetRawPixelData),
+                    &IAHWCLayer::SetRawPixelData, iahwc_raw_pixel_data>);
     case IAHWC_FUNC_LAYER_SET_ACQUIRE_FENCE:
       return ToHook<IAHWC_PFN_LAYER_SET_ACQUIRE_FENCE>(
           LayerHook<decltype(&IAHWCLayer::SetAcquireFence),
@@ -325,6 +329,19 @@ int IAHWC::IAHWCLayer::SetBo(gbm_bo* bo) {
   return IAHWC_ERROR_NONE;
 }
 
+int IAHWC::IAHWCLayer::SetRawPixelData(iahwc_raw_pixel_data bo) {
+  hwc_handle_.meta_data_.width_ = bo.width;
+  hwc_handle_.meta_data_.height_ = bo.height;
+  hwc_handle_.meta_data_.format_ = bo.format;
+  hwc_handle_.gbm_flags = 0;
+  hwc_handle_.is_raw_pixel_ = true;
+  hwc_handle_.pixel_memory_ = bo.buffer;
+
+  iahwc_layer_.SetNativeHandle(&hwc_handle_);
+
+  return IAHWC_ERROR_NONE;
+}
+
 int IAHWC::IAHWCLayer::SetAcquireFence(int32_t acquire_fence) {
   iahwc_layer_.SetAcquireFence(acquire_fence);
 
index 2cfb145..c1303dd 100644 (file)
@@ -37,6 +37,7 @@ class IAHWC : public iahwc_device {
     IAHWCLayer();
     ~IAHWCLayer();
     int SetBo(gbm_bo* bo);
+    int SetRawPixelData(iahwc_raw_pixel_data bo);
     int SetAcquireFence(int32_t acquire_fence);
     int SetLayerUsage(int32_t layer_usage);
     int32_t GetLayerUsage() {